I have set up the following but really don't know how to get the impulse response. I tried using the @DLMirf, using unknown variables phi1 but dont know whether it is correct? The graphs were all flat at 0.5 or 1.0, if i am to use these values in the matrices. i want to do something where a normal IRF for an ordinary VAR, where the decomposition errors are reducing and the IRF graphs were exponential or at least not flat. As i estimated the different VAR equations separately, excluding the insignificant variables, i was not able to combine the equations and define it as a normal VAR model or is there a way to do it? Also, i would like to incorporate time variation into variances for states and measurement equations, something which Primiceri (2005) did in his paprer "Time Varying Structural Vector Autoregressions and Monetary Policy ". But, the DLM command doesn't allow it. I thought of getting the residuals from the linear regression and put it into X' and even use the SV number to reinsert into another DLM, but it looks weird. I am at a loss as to how to continue and if the IRF graphs cannot be derived, is it advisable to just use the drifting coefficients to explain? although VAR require IRFs to explain their evolution of the laggeds which should be the only way. I had read the user guide and reference many times, and hope that someone could guide me. Many thanks.
Code: Select all
linreg(define=ceqn,noprint) wtic 1997:11:28 2011:06:24 w
# trend1 wtic{1} bsbc{1}
linreg(define=ceqn1,noprint) hh 1997:11:28 2011:06:24 h
# hh{1} bsbc{1} bsbc{2}
linreg(define=ceqn2,noprint) bsbc 1997:11:28 2011:06:24 bs
# wtic{1} hh{1}
dis %logl
compute %sbc = -2.0*%logl/%nobs+log(%nobs)*%nreg/%nobs
compute %lwz = -2*%logl/(%nobs-%nreg)+%nreg*.299*log(%nobs)^2.1/%nobs
dis %sbc %lwz
dec vect[series] b(8) lower(8) upper(8) ts(8) vs(8) wtive(3)
*
dec vect lsigsqw(8) lsigsqvvv(3)
*
nonlin lsigsqvvv lsigsqw break1 break2 break4 break5 break6 break7 $
phi1 phi2 phi3 phi4 phi5 phi6 phi7 phi8 phi9
compute ab = $
||1.0,0.0|0.0,1.||~\||1.0,0.0|0.0,1.||~\||1.0,0.0|0.0,1.||~\||1.0,0.0|0.0,1.||
function flm
type rect flm
compute flm=$
||1.0,0.0,0.|0.0,1.,phi1|0.0,phi2,1.||~\$
||1.0,0.0,0.|0.0,1.,phi3|0.0,phi4,1.||~\$
||1.0,phi5|phi6,1.||
end
*alternately, i even tried:
compute flm=$
||1.0,0.0,0.|0.0,1.,0.5|0.0,0.5,1.||~\$
||1.0,0.0,0.|0.0,1.,0.5|0.0,0.5,1.||~\$
||1.0,1.0|0.5,1.||
end
compute lsigsqw=%log(||.001,.001,.001,.001,.001,.001,.001,.001||)
compute lsigsqvvv=%log(||.001,.001,.001||)
compute break1=break2=.1, break3=break4=break5=break6=break7=.1, phi1=phi2=phi3=phi4=phi5=phi6=phi7=phi8=phi9=.0
dlm(mu=||break1+break2*hh{1},break3+break4*wtic{1},break5+break6*trend1+break7*bsbc{1}||,$
a=ab,f=flm(), $
c=%eqnxvector(ceqn,t)~\%eqnxvector(ceqn1,t)~\%eqnxvector(ceqn2,t),sw=%diag(%exp(lsigsqw)),sv=%diag(%exp(lsigsqvvv)),y=||wtic,hh,bsbc||,$
method=bfgs,iters=500,type=smooth,vhat=wtivhat,yhat=wtiyhat) 1997:11:28 2011:06:24 xstates vstates
do i=1,8
set b(i)1997:11:28 2011:06:24 = xstates(t)(i)
set lower(i) 1997:11:28 2011:06:24 = b(i)-1.96*sqrt(vstates(t)(i,i))
set upper(i) 1997:11:28 2011:06:24 = b(i)+1.96*sqrt(vstates(t)(i,i))
set ts(i) 1997:11:28 2011:06:24 = xstates(t)(i)/sqrt(vstates(t)(i,i))
set vs(i) 1997:11:28 2011:06:24 = (vstates(t)(i,i))
end do i
do i=1,3
set wtive(i) 1997:12:28 2011:6:24 = %scalar(wtivhat(t)(i))
end do i
@dlmirf(a=ab,f=flm(),errors,steps=50)