Page 1 of 1
Shocks in Two-variable Threshold VECM
Posted: Thu Apr 24, 2014 12:18 pm
by TVolscho-286
Hi Tom,
Here is a perhaps simpler one. Dataset attached. Two variables, Corporate Tax Return Audit Rate (Corp_a) and Unreported AGI/Reported AGI(UAG_RAG). My goal is to show a plot of UAG_RAG responding to a negative shock to Corp_a. In the VECM for the below-threshold ECT is statistically significant suggesting that UAG responds to below-threshold deviations from equilibrium.
I am getting the following error:
Forecast for DCORP_A solves to NA at 2010:01, on iteration 1
Forecast for DUAG_RAG solves to NA at 2010:01, on iteration 1...
Code: Select all
linreg uag_rag / U
# constant corp_a
*
set du = u-u{1}
*
linreg(title="Engle-Granger Auxiliary Regression") du
# u{1} du{1}
set tseries = u{1}
@EndersSiklos(title="TAR with Empirical Threshold", threshold=tseries, pi=.10, lags=1) u
set mt1 = %if(u{1}>=%%breakvalue,1,0)
set mt2 = 1-mt1
set z1 = mt1*u{1}
set z2 = mt2*u{1}
**z1 and z2, the two error correction terms are lagged above***
linreg du
# z1 z2 du{1}
set dcorpplus = %max(dcorp_a,0)
set dcorpminus = %min(dcorp_a,0)
set duag_ragplus = %max(duag_rag,0)
set duag_ragminus = %min(duag_rag,0)
system(model=tvecm)
variables dcorp_a duag_rag
det dcorpplus{1} dcorpminus{1} duag_ragplus{1} duag_ragminus{1} z1 z2
end(system)
*
estimate
frml(identity) duageq uag_rag = uag_rag{1}+duag_rag
frml(identity) duag_ragpluseq duag_ragplus = %max(duag_rag,0)
frml(identity) duag_ragminuseq duag_ragminus = %min(duag_rag,0)
*
frml(identity) corpeq corp_a = corp_a{1}+dcorp_a
frml(identity) dcorp_apluseq duplus = %max(dcorp_a,0)
frml(identity) dcorp_aminuseq duminus = %min(dcorp_a,0)
*
frml(identity) zpluseq zplus = z1
frml(identity) zminuseq zminus = z2
*
group identities duageq corpeq duag_ragpluseq duag_ragminuseq $
dcorp_apluseq dcorp_aminuseq
*
compute fstart=%regend(),fend=fstart+9
forecast(model=tvecm+identities,results=baseresults,steps=10)
* Do Choleski factor
*
compute fsigma=%decomp(%sigma)
*
* Do responses with + and - shocks to IM
*
forecast(model=tvecm+identities,shocks = %xcol(fsigma,1),results=withplus,steps=10)
forecast(model=tvecm+identities,shocks = -1.0*%xcol(fsigma,1),results=withminus,steps=10)
*
* Take gap between the forecasts to get the IRF's
****Would the response OF UAG below be 3 or 4?***
set ircorpplus fstart fend = withplus(3)-baseresults(3)
set irfcorpminus fstart fend = withminus(3)-baseresults(3)
Re: Shocks in Two-variable Threshold VECM
Posted: Thu Apr 24, 2014 2:02 pm
by TomDoan
As you have this written, Z1 and Z2 are exogenous (there's no formula in the model which creates them). I doubt that's what you want. Also, shouldn't you be using z1{1} and z2{1} in the model rather than contemporaneous values?
Re: Shocks in Two-variable Threshold VECM
Posted: Thu Apr 24, 2014 11:26 pm
by TVolscho-286
Here is a refinement of the code. I get an error for %%breakvalue when I try to create the zplus and zminus variables.
Code: Select all
OPEN DATA "C:\Users\X201\Copy\Tax Evasion Paper\UAG Project.XLS"
DATA(FORMAT=XLS,ORG=COLUMNS) 1890:01 2013:01 YEAR CORP_A UAG_RAG
set duag_rag = uag_rag-uag_rag{1}
set dcorp_a = corp_a-corp_a{1}
linreg uag_rag / U
# constant corp_a
compute b=%beta
*
set du = u-u{1}
*
linreg(title="Engle-Granger Auxiliary Regression") du
# u{1} du{1}
set tseries = u{1}
@EndersSiklos(title="TAR with Empirical Threshold", threshold=tseries, pi=.10, lags=1) u
set zplus = %max(uag_rag-b(1)-b(2)*corp_a -%%breakvalue,0.0)
set zminus = %min(uag_rag-b(1)-b(2)*corp_a -%%breakvalue,0.0)
set dcorpplus = %max(dcorp_a,0)
set dcorpminus = %min(dcorp_a,0)
set duag_ragplus = %max(duag_rag,0)
set duag_ragminus = %min(duag_rag,0)
system(model=tvecm)
variables dcorp_a duag_rag
det dcorpplus{1} dcorpminus{1} duag_ragplus{1} duag_ragminus{1} zplus{1} zminus{1}
end(system)
*
estimate
frml(identity) duageq uag_rag = uag_rag{1}+duag_rag
frml(identity) duag_ragpluseq duag_ragplus = %max(duag_rag,0)
frml(identity) duag_ragminuseq duag_ragminus = %min(duag_rag,0)
*
frml(identity) corpeq corp_a = corp_a{1}+dcorp_a
frml(identity) dcorp_apluseq duplus = %max(dcorp_a,0)
frml(identity) dcorp_aminuseq duminus = %min(dcorp_a,0)
*
frml(identity) zpluseq zplus = %max(uag_rag-b(1)-b(2)*corp_a-%breakvalue,0.0)
frml(identity) zminuseq zminus = %min(uag_rag-b(1)-b(2)*corp_a-%breakvalue,0.0)
*
group identities duageq corpeq duag_ragpluseq duag_ragminuseq $
dcorp_apluseq dcorp_aminuseq
*
compute fstart=%regend(),fend=fstart+5
forecast(model=tvecm+identities,results=baseresults,steps=6)
* Do Choleski factor
*
compute fsigma=%decomp(%sigma)
*
* Do responses with + and - shocks to IM
*
forecast(model=tvecm+identities,shocks = %xcol(fsigma,1),results=withplus,steps=6)
forecast(model=tvecm+identities,shocks = -1.0*%xcol(fsigma,1),results=withminus,steps=6)
*
* Take gap between the forecasts to get the IRF's
*
set irfcorpplus fstart fend = withplus(3)-baseresults(3)
set irfcorpminus fstart fend = withminus(3)-baseresults(3)
Re: Shocks in Two-variable Threshold VECM
Posted: Fri Apr 25, 2014 6:50 am
by TomDoan
You're using %breakvalue (without %%) when you're defining the formulas.
Re: Shocks in Two-variable Threshold VECM
Posted: Fri Apr 25, 2014 8:27 am
by TVolscho-286
Hi Tom,
Even when I put the double %, I am still getting the following error:
## SX11. Identifier %%BREAKVALUE is Not Recognizable. Incorrect Option Field or Parameter Order?
>>>>rp_a -%%breakvalue,<<<<
I should note that this error comes after trying to set ZPLUS and ZMINUS (right after estimating the TAR with Enders-Siklos)
Re: Shocks in Two-variable Threshold VECM
Posted: Fri Apr 25, 2014 8:50 am
by TomDoan
1. You're missing your cal(a) 1890 instruction
2. That can't happen if you execute the @ENDERSSIKLOS procedure so somehow you're not executing everything when you get that error.
3. You didn't include the identities defining ZPLUS and ZMINUS in your IDENTITIES group.
Re: Shocks in Two-variable Threshold VECM
Posted: Fri Apr 25, 2014 9:03 am
by TVolscho-286
I made sure the Cal(A) (it is annual data) instruction was included. I am still getting the same error
Code: Select all
OPEN DATA "UAG Project.xlsx"
CALENDAR(A) 1890:1
DATA(FORMAT=XLSX,ORG=COLUMNS) 1890:01 2013:01 YEAR CORP_A UAG_RAG
set duag_rag = uag_rag-uag_rag{1}
set dcorp_a = corp_a-corp_a{1}
linreg uag_rag / U
# constant corp_a
compute b=%beta
*
set du = u-u{1}
*
linreg(title="Engle-Granger Auxiliary Regression") du
# u{1} du{1}
set tseries = u{1}
@EndersSiklos(title="TAR with Empirical Threshold", threshold=tseries, pi=.10, lags=1) u
set zplus = %max(uag_rag-b(1)-b(2)*corp_a - %%breakvalue,0.0)
set zminus = %min(uag_rag-b(1)-b(2)*corp_a - %%breakvalue,0.0)
set dcorpplus = %max(dcorp_a,0)
set dcorpminus = %min(dcorp_a,0)
set duag_ragplus = %max(duag_rag,0)
set duag_ragminus = %min(duag_rag,0)
system(model=tvecm)
variables dcorp_a duag_rag
det dcorpplus{1} dcorpminus{1} duag_ragplus{1} duag_ragminus{1} zplus{1} zminus{1}
end(system)
*
estimate
frml(identity) duageq uag_rag = uag_rag{1}+duag_rag
frml(identity) duag_ragpluseq duag_ragplus = %max(duag_rag,0)
frml(identity) duag_ragminuseq duag_ragminus = %min(duag_rag,0)
*
frml(identity) corpeq corp_a = corp_a{1}+dcorp_a
frml(identity) dcorp_apluseq duplus = %max(dcorp_a,0)
frml(identity) dcorp_aminuseq duminus = %min(dcorp_a,0)
*
frml(identity) zpluseq zplus = %max(uag_rag-b(1)-b(2)*corp_a-%%breakvalue,0.0)
frml(identity) zminuseq zminus = %min(uag_rag-b(1)-b(2)*corp_a-%%breakvalue,0.0)
*
group identities duageq corpeq duag_ragpluseq duag_ragminuseq $
dcorp_apluseq dcorp_aminuseq zpluseq zminuseq
*
compute fstart=%regend(),fend=fstart+5
forecast(model=tvecm+identities,results=baseresults,steps=6)
* Do Choleski factor
*
compute fsigma=%decomp(%sigma)
*
* Do responses with + and - shocks to IM
*
forecast(model=tvecm+identities,shocks = %xcol(fsigma,1),results=withplus,steps=6)
forecast(model=tvecm+identities,shocks = -1.0*%xcol(fsigma,1),results=withminus,steps=6)
*
* Take gap between the forecasts to get the IRF's
*
set irfcorpplus fstart fend = withplus(3)-baseresults(3)
set irfcorpminus fstart fend = withminus(3)-baseresults(3)
Re: Shocks in Two-variable Threshold VECM
Posted: Fri Apr 25, 2014 9:23 am
by TomDoan
You changed up your data series, but missed the change to the series name in the 2nd and 3rd equations:
frml(identity) corpeq corp_a = corp_a{1}+dcorp_a
frml(identity) dcorp_apluseq duplus = %max(dcorp_a,0)
frml(identity) dcorp_aminuseq duminus = %min(dcorp_a,0)
Those need to be dcorpxxxx not duxxxx.
Re: Shocks in Two-variable Threshold VECM
Posted: Fri Apr 25, 2014 1:35 pm
by TVolscho-286
success...thank for your time and patience in spotting the mistakes. Here is the code that works.
Just an informational question. In the last two lines of codes, since I have (3) in the brackets, is that the response of Corp_a or UAG_RAG? I would assume it is the response of Corp_a to UAG?
Code: Select all
OPEN DATA "C:\Users\Administrator\Copy\Tax Evasion Paper\UAG Project.xlsx"
CALENDAR(A) 1890:1
DATA(FORMAT=XLSX,ORG=COLUMNS) 1890:01 2013:01 YEAR CORP_A UAG_RAG
set duag_rag = uag_rag-uag_rag{1}
set dcorp_a = corp_a-corp_a{1}
linreg uag_rag / U
# constant corp_a
compute b=%beta
*
set du = u-u{1}
*
linreg(title="Engle-Granger Auxiliary Regression") du
# u{1} du{1}
set tseries = u{1}
@EndersSiklos(title="TAR with Empirical Threshold", threshold=tseries, pi=.10, lags=1) u
set zplus = %max(uag_rag-b(1)-b(2)*corp_a - %%breakvalue,0.0)
set zminus = %min(uag_rag-b(1)-b(2)*corp_a - %%breakvalue,0.0)
set dcorpplus = %max(dcorp_a,0)
set dcorpminus = %min(dcorp_a,0)
set duag_ragplus = %max(duag_rag,0)
set duag_ragminus = %min(duag_rag,0)
system(model=tvecm)
variables dcorp_a duag_rag
det dcorpplus{1} dcorpminus{1} duag_ragplus{1} duag_ragminus{1} zplus{1} zminus{1}
end(system)
*
estimate
frml(identity) duageq uag_rag = uag_rag{1}+duag_rag
frml(identity) duag_ragpluseq duag_ragplus = %max(duag_rag,0)
frml(identity) duag_ragminuseq duag_ragminus = %min(duag_rag,0)
*
frml(identity) corpeq corp_a = corp_a{1}+dcorp_a
frml(identity) dcorp_apluseq dcorpplus = %max(dcorp_a,0)
frml(identity) dcorp_aminuseq dcorpminus = %min(dcorp_a,0)
*
frml(identity) zpluseq zplus = %max(uag_rag-b(1)-b(2)*corp_a-%%breakvalue,0.0)
frml(identity) zminuseq zminus = %min(uag_rag-b(1)-b(2)*corp_a-%%breakvalue,0.0)
*
group identities duageq corpeq duag_ragpluseq duag_ragminuseq $
dcorp_apluseq dcorp_aminuseq zpluseq zminuseq
*
compute fstart=%regend(),fend=fstart+9
forecast(model=tvecm+identities,results=baseresults,steps=10)
* Do Choleski factor
*
compute fsigma=%decomp(%sigma)
*
* Do responses with + and - shocks to Corp_a
*
forecast(model=tvecm+identities,shocks = %xcol(fsigma,1),results=withplus,steps=10)
forecast(model=tvecm+identities,shocks = -1.0*%xcol(fsigma,1),results=withminus,steps=10)
*
* Take gap between the forecasts to get the IRF's
*
set irfcorpplus fstart fend = withplus(3)-baseresults(3)
set irfcorpminus fstart fend = withminus(3)-baseresults(3)
Re: Shocks in Two-variable Threshold VECM
Posted: Fri Apr 25, 2014 1:43 pm
by TomDoan
UAG_RAG. (If you put a PRINT option on one of the FORECAST instructions, you can see the order). With two variables in the TVECM, (3) will be the dependent variable in the first identity in the IDENTITIES group.
Re: Shocks in Two-variable Threshold VECM
Posted: Fri Apr 25, 2014 1:44 pm
by TVolscho-286
Very helpful! Thanks again!