Impulse responses, confidence bands and over-identification

Questions and discussions on Vector Autoregressions
researcher84
Posts: 19
Joined: Tue Feb 11, 2014 4:03 pm

Impulse responses, confidence bands and over-identification

Unread post by researcher84 »

Hello Tom and RATS users,

I'm estimating two SVAR models with the same variables and same order, but first one is just identified restrictions (model 1) and the second one is over-identified restrictions (model 2).

First: I estimated model 1 using Eviews and RATS. However, RATS produces impulse responses that looks very odd. Most variables do not respond to any shock. I wish you could look at the attached file and let me know if any things look wrong.

Second: I was able to estimate the over-identified model using cvmodel but I have no idea how to get the impulse responses with confidence bands. Can any one please explain how to do this part? or refer me to a clear example. Also, when we estimate the over-identified, RATS test the over-identification restrictions as following

Code: Select all

NO CONVERGENCE IN 100 ITERATIONS
LAST CRITERION WAS  0.0075070
Observations                              242
Log Likelihood                      5844.5720
Log Likelihood Unrestricted         5845.9289
Chi-Squared(4)                         2.7139
Significance Level                  0.6067931
Clearly, the test fails to reject the null hypothesis but just to be clear.... under the null hypothesis our over-identifying restrictions are valid .. so given the results we have above, the restrictions we have are valid. Thanks a lot for any help.
Last edited by researcher84 on Tue Apr 29, 2014 11:39 pm, edited 1 time in total.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Impulse responses, confidence bands and over-identificat

Unread post by TomDoan »

In model1.rpf, you're doing unit shocks. With CPI having a much smaller scale than the other variables, the effect of a unit shock to it will dwarf the other responses. The other responses are non-zero, they just look small because of the scale difference. Do Cholesky shocks instead.

In model2.rpf, AX(22) isn't included in the model, so you want to correct that. You also to increase the ITERS limit, since you're not fully converged at 100. However, yes, your restrictions are accepted.

Follow MONTESVAR.RPF for the error bands on the overidentified model.
researcher84
Posts: 19
Joined: Tue Feb 11, 2014 4:03 pm

Re: Impulse responses, confidence bands and over-identificat

Unread post by researcher84 »

Thanks a lot Tom!

I've fixed the problem with Model 1.

For Model 2, I followed "MONTESVAR.RPF " and modified it to fit my model but I still have some questions about the code.
In the original code "MONTESVAR.RPF ", they have only 3 shocks as following

Code: Select all

	*
   compute sumwt   =sumwt+weight
   compute sumwt2  =sumwt2+weight^2
   dim %%responses(draw)(nvar*3,nstep)
   compute weights(draw)=weight
   ewise %%responses(draw)(i,j)=xt=%xt(impulses,j),ix=%vec(%xcol(xt,3)~%xcol(xt,5)~%xcol(xt,6)),ix(i)
   infobox(current=draw)
end do draw
infobox(action=remove)


I modified this part to generate responses to all the shocks, please correct me if this is wrong

Code: Select all

	*
   compute sumwt   =sumwt+weight
   compute sumwt2  =sumwt2+weight^2
   dim %%responses(draw)(nvar*nvar,nstep)
   compute weights(draw)=weight
   ewise %%responses(draw)(i,j)=ix=%vec(%xt(impulses,j)),ix(i)
   infobox(current=draw)
end do draw
infobox(action=remove)
*
Please note that I have 8 variables, 5 lags , and 249 obs. For delta I have 8 variables+1/2 = 4.5 . In the original code "MONTESVAR.RPF " they write "compute nu=30.0" without explaining how you get that number. Could you please explain this part ? Those the only parts to my understanding that need to be changed to be able to use the code for my mode. Do you see any need for further changes on the codes?

Thank you very much for all the effort you put on this forum.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Impulse responses, confidence bands and over-identificat

Unread post by TomDoan »

To get the whole set of responses, you have the correct adjustment.

The below are two "tuning" parameters for the importance sampling. They might need to be changed if the number of effective draws drops too low. If you're getting under 10% effective sample, you may need to fatten up the tails by either decreasing NU or increasing the 1.2 scale factor.

Code: Select all

*
* <<faxx>> is a factor of the (estimated) inverse Hessian at the final
* estimates. This gets scaled slightly to fatten up the tails a bit.
*
compute faxx=1.2*%decomp(%xx)
*
* <<nu>> is the degrees of freedom for the multivariate Student used in
* drawing A's.
*
compute nu=30.0
researcher84
Posts: 19
Joined: Tue Feb 11, 2014 4:03 pm

Re: Impulse responses, confidence bands and over-identificat

Unread post by researcher84 »

Thanks again. Just to be clear about this. You said "If you're getting under 10% effective sample, you may need to fatten up the tails by either decreasing NU or increasing the 1.2 scale factor" When I run the original program I get

Code: Select all

Effective sample size    1056.61521
When I run mine with 5 lags, I get "Effective sample size 255.96191" but with 13 lags I get "Effective sample size 1852.28480" How can we read those results intuitively? Are they related to the 10% you mentioned in your reply? Thanks.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Impulse responses, confidence bands and over-identificat

Unread post by TomDoan »

Out of 10000, 255 isn't very good (2.55%); 1852 is OK.
researcher84
Posts: 19
Joined: Tue Feb 11, 2014 4:03 pm

Re: Impulse responses, confidence bands and over-identificat

Unread post by researcher84 »

Dear Tom,

Few questions about the codes

1) It seems that the model gives different effective sample size every time I run it.. is that normal?
2) When I modified model 2 to include the impulse responses under the over identified model, the result doesn't report the test for the over identifying restrictions any more... how to fix that?. ( I attached my final draft code)

3) Please not that in the codes I attached, we have two cvmodel commands.. the only difference in the two is the method as you can see. Why do we need the two together?

Code: Select all

*
compute delta=4.5
cvmodel(parmset=mymodel,dfc=ncoef,pdf=delta,dmatrix=marginalized,method=bfgs,ITERS=3000) vmat afrml
dec rect faxx
*

Code: Select all

  *
      compute a       =afrml(1)
      compute dhat    =a*vmat*tr(a)
      compute ddiag   =%xdiag(dhat)
      cvmodel(parmset=mymodel,dfc=ncoef,pdf=delta,dmatrix=marginalized,method=evaluate, ITERS=3000 ) vmat afrml
      compute pdensity=%funcval
      *
4) I noticed that in the impulse response commands, there is no consideration for the over-identified restricted model ...which is parmset=mymodel ... is that normal? unless that factor=fsigmad capture that .... if it does then how that related to the two cvmodel commands we have above?

Code: Select all

 compute %modelsetcoeffs(varmodel,betadraw)
   compute nshock=1
   impulse(noprint,model=varmodel,factor=fsigmad,results=impulses,steps=nstep) nvar
	*
	* Store the impulse responses and the draw weight
	*
   compute sumwt   =sumwt+weight
   compute sumwt2  =sumwt2+weight^2
   dim %%responses(draw)(nvar*nvar,nstep)
   compute weights(draw)=weight
   ewise %%responses(draw)(i,j)=ix=%vec(%xt(impulses,j)),ix(i)
   infobox(current=draw)
end do draw
infobox(action=remove)
5) I'll be estimating the same model with asymmetric lags VAR.. Do you have any example or codes that have done asymmetric VAR models? I couldn't find anything related to this in the users guide.
Thanks a lot for your help.
Attachments
Model2_impulses (3).RPF
(4.86 KiB) Downloaded 1364 times
Last edited by researcher84 on Tue Apr 29, 2014 11:41 pm, edited 1 time in total.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Impulse responses, confidence bands and over-identificat

Unread post by TomDoan »

researcher84 wrote:Dear Tom,

Few questions about the codes

1) It seems that the model gives different effective sample size every time I run it.. is that normal?
Yes. It's a sampling process.

researcher84 wrote: 2) When I modified model 2 to include the impulse responses under the over identified model, the result doesn't report the test for the over identifying restrictions any more... how to fix that?. ( I attached my final draft code)
The marginalized estimator isn't maximum likelihood so it doesn't generate a LR statistic.
researcher84 wrote: 3) Please not that in the codes I attached, we have two cvmodel commands.. the only difference in the two is the method as you can see. Why do we need the two together?

Code: Select all

*
compute delta=4.5
cvmodel(parmset=mymodel,dfc=ncoef,pdf=delta,dmatrix=marginalized,method=bfgs,ITERS=3000) vmat afrml
dec rect faxx
*

Code: Select all

  *
      compute a       =afrml(1)
      compute dhat    =a*vmat*tr(a)
      compute ddiag   =%xdiag(dhat)
      cvmodel(parmset=mymodel,dfc=ncoef,pdf=delta,dmatrix=marginalized,method=evaluate, ITERS=3000 ) vmat afrml
      compute pdensity=%funcval
      *
The one inside the loop is used to evaluate the posterior at the draw for the coefficients. You can't simply estimate the over identified model with a new covariance matrix.
researcher84 wrote: 4) I noticed that in the impulse response commands, there is no consideration for the over-identified restricted model ...which is parmset=mymodel ... is that normal? unless that factor=fsigmad capture that .... if it does then how that related to the two cvmodel commands we have above?

Code: Select all

 compute %modelsetcoeffs(varmodel,betadraw)
   compute nshock=1
   impulse(noprint,model=varmodel,factor=fsigmad,results=impulses,steps=nstep) nvar
	*
	* Store the impulse responses and the draw weight
	*
   compute sumwt   =sumwt+weight
   compute sumwt2  =sumwt2+weight^2
   dim %%responses(draw)(nvar*nvar,nstep)
   compute weights(draw)=weight
   ewise %%responses(draw)(i,j)=ix=%vec(%xt(impulses,j)),ix(i)
   infobox(current=draw)
end do draw
infobox(action=remove)
It's computing fsigmad using the over identified model and computing the coefficient draw using fsigmad.
researcher84 wrote: 5) I'll be estimating the same model with asymmetric lags VAR.. Do you have any example or codes that have done asymmetric VAR models? I couldn't find anything related to this in the users guide.
See Cushman and Zha JME 1997. That's for a particularly large near-VAR. The description there includes a link to a smaller one.



You might want to look into the VAR or Bayesian Econometrics e-courses.
researcher84
Posts: 19
Joined: Tue Feb 11, 2014 4:03 pm

Re: Impulse responses, confidence bands and over-identificat

Unread post by researcher84 »

The marginalized estimator isn't maximum likelihood so it doesn't generate a LR statistic.
How can we test the over identifying restrictions ? Is it acceptable to run the model 2 without the impulses and use its results for over identifying restrictions test and use the impulse responses from the modified one ? Basically, I need to report a result for the over identifying restrictions test and the impulse responses for the the over identifying model.

I'll have to look into your other points and get back here if I have questions. Thanks again Tom, this is extremely helpful!!
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Impulse responses, confidence bands and over-identificat

Unread post by TomDoan »

Estimate by maximum likelihood for the test of over identification, then use the posterior estimator to do the error bands.
researcher84
Posts: 19
Joined: Tue Feb 11, 2014 4:03 pm

Re: Impulse responses, confidence bands and over-identificat

Unread post by researcher84 »

I used a different data set to estimate and test the over identifying restrictions but I oddly got wired estimates that tend to explode. Could you plz look at the results and let me know if any thing wrong with it? I'm thinking about using Cholesky estimates as initial values, do you think it is a good idea? if yes, is there any example has used that? I dont know where to start. Thanks for all the help!
Attachments
Data2.xls
(68.5 KiB) Downloaded 1068 times
Model 2 with different data.RPF
(1.02 KiB) Downloaded 1331 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Impulse responses, confidence bands and over-identificat

Unread post by TomDoan »

That's telling you that your sixth equation is normalized wrong---you have the unit coefficient on a natural zero.
researcher84
Posts: 19
Joined: Tue Feb 11, 2014 4:03 pm

Re: Impulse responses, confidence bands and over-identificat

Unread post by researcher84 »

I think you meant the 'seventh equation because the odd coefficients are those in the seventh equations not the sixth one. Can you please elaborate on what this results mean? I don't quite get what you said.

Code: Select all

14. AX(14)                          959253.047583  205879450.337526      0.00466  0.99628243
15. AX(15)                       -11140753.304543 2391073622.135053     -0.00466  0.99628242
16. AX(16)                        17308919.969753 3714914888.052826      0.00466  0.99628243
The sixth variable is the policy interest rate, do you think it is not identified right? Are you saying the 1 on the sixth equation should be zero? but that would not allow us to shock interest rate, right? Sorry but I hope you explain little more. Also, I noticed that the over identifying test actually fail to reject my assumptions. They pass the test!


On the other side, when I estimate the same model with the same lags but instead, I use what you recommended me to use before "MONTESVAR.RPF ", I get different estimates for the same variables.. Is that normal?

Code: Select all

Covariance Model-Marginal Posterior - Estimation by BFGS
Convergence in    49 Iterations. Final criterion was  0.0000074 <=  0.0000100
Observations                              230
Function Value                      3694.6132
Prior DF                               4.5000

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  AX(1)                        -0.465861689  0.127334390     -3.65857  0.00025363
2.  AX(2)                        -0.627327063  1.719807471     -0.36477  0.71528619
3.  AX(3)                        -0.214696043  1.032623270     -0.20791  0.83529672
4.  AX(4)                         0.026239246  0.205217233      0.12786  0.89825911
5.  AX(5)                        -0.221988471  0.120709345     -1.83903  0.06591033
6.  AX(6)                        -0.019730158  0.008748411     -2.25528  0.02411546
7.  AX(7)                        -0.019549044  0.051224390     -0.38164  0.70273177
8.  AX(8)                         0.042584411  0.029770188      1.43044  0.15259132
9.  AX(9)                        -0.004083974  0.002202481     -1.85426  0.06370182
10. AX(10)                       -0.009677654  0.018494508     -0.52327  0.60078513
11. AX(11)                        0.156738602  0.128872614      1.21623  0.22389773
12. AX(12)                       -0.264951538  0.527760854     -0.50203  0.61564674
13. AX(13)                        0.001963733  0.008254544      0.23790  0.81196080
14. AX(14)                       -0.056021452  0.494962546     -0.11318  0.90988530
15. AX(15)                       -1.901953331  8.061881099     -0.23592  0.81349529
16. AX(16)                       -2.872146791  4.095250233     -0.70134  0.48309330
17. AX(17)                        0.312171501  0.626887898      0.49797  0.61850504
18. AX(18)                        0.114518374  0.329979156      0.34705  0.72855579
19. AX(19)                        0.045179169  0.024376741      1.85337  0.06382906
20. AX(20)                       -0.190931866  0.213232481     -0.89542  0.37056452
21. AX(21)                        0.213406206  0.954426711      0.22360  0.82307150
22. AX(22)                       -0.593977751  0.159712023     -3.71905  0.00019997
23. AX(23)                       -0.023370825  0.014130415     -1.65394  0.09814019

Effective sample size    1067.88915
Thank you so much Tom for your time!
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Impulse responses, confidence bands and over-identificat

Unread post by TomDoan »

If you change the normalization in equation 6 to have a unit on the 7th variable rather than the 6th, the model estimates correctly with a near-zero coefficient on the diagonal. It sounds like the data are telling you that your intended interpretation of the 6th and 7th equations isn't correct.
researcher84
Posts: 19
Joined: Tue Feb 11, 2014 4:03 pm

Re: Impulse responses, confidence bands and over-identificat

Unread post by researcher84 »

Urgent question!....

When we use "MONTESVAR.RPF " and "MCGraphIRF" to graph the impulse functions.. nothing I could find that specify the confidence intervals? I only found the following in "MCGraphIRF" Not sure if it refers to confidence intervals

Code: Select all

PERCENTILES=||percentiles for lower and upper bounds|| [||.16,.84||]
What can we say about the confidence intervals is it 90% ? 95% ? and how can we modify it ? Thanks a lot Tom for all the help.
Post Reply