defining coefficients

Discussion of State Space and Dynamic Stochastic General Equilibrium Models
chiade
Posts: 28
Joined: Wed Sep 14, 2011 2:11 am

defining coefficients

Unread post by chiade »

Dear Sir,

I am trying to extract coefficients from the DLM model, which includes both drfiting and fixed coefficients. i set up the below, and use b(i) to extract the xstates and the fixed coefficients. I then create a group with these equations consisting of all these coefficients, re-pegging the values of the model with the ones extracted from the DLM using %modelsetcoeffs. Everthing was going fine but there was no rectangular array i.e. 0x0 in my model! I thought i was on the right track and even analyzed todd clark's program on @vartvpksc.src where he used "comp %modelsetcoeffs(varmodel,%vectorect(pidraw(vtime),ncoef))". The ncoef is confusing! According to the user's guide, r is row or n in %vectorect( V, r ) whihc was used in varlagselect.src. Something must be wrong with my coding. Could you see whether there is anything wrong as this model is to be used in the impulse function? Many thanks for all the help.


Code: Select all

linreg(define=ceqn,noprint) wtic 1997:11:28 2011:6:24  a1
#  trend1 wtic{1}

linreg(define=ceqn1,noprint) hh 1997:11:28 2011:6:24  a1
# trend1 hh{1}

dec vect[series] b(8)  
dec vect lsigsqw(4)
dec symm lsigsqv(2,2)
dec rect[ser] whsv(4,2)

nonlin lsigsqv lsigsqw break1 break2 break3 break4

compute lsigsqw=%log(||.0001,.0001,.0001,.0001||)
compute lsigsqv=%log(||.0001,.0001|.0001,.0001||)

compute break1=break2=.1, break3=break4=break5=break6=break7=break8=break9=.1,  $
break10=break11=break12=break13=break14=break15=break16=break17=break18=break19=break20=.1,$
phi1=phi2=phi3=phi4=phi5=phi6=phi7=phi8=phi9=.1

dlm(mu=||break1+BREAK2*HH{1},break3+BREAK4*wtic{1}||,c=%eqnxvector(ceqn,t)~\%eqnxvector(ceqn1,t),sw=%diag(%exp(lsigsqw)),sv=%exp(lsigsqv),presample=ergodic,y=||wtic,hh||,$
  method=bfgs,iters=500,type=smooth,vhat=wHvhat,svhat=wHsvhat,yhat=wHyhat) 1997:11:28 2011:6:24 xstates vstates
*
set b(1) 1997:11:28 2011:6:24 = %beta(8)
set b(2) 1997:11:28 2011:6:24 = %beta(9)
set b(3) 1997:11:28 2011:6:24 = xstates(t)(1)
set b(4) 1997:11:28 2011:6:24 = xstates(t)(2)
set b(5) 1997:11:28 2011:6:24 = %beta(10)
set b(6) 1997:11:28 2011:6:24 = %beta(11)
set b(7) 1997:11:28 2011:6:24 = xstates(t)(3)
set b(8) 1997:11:28 2011:6:24 = xstates(t)(4)

linreg(define=ceqx,noprint) wtic 1997:11:28 2011:6:24  a1
# constant hh{1} trend1 wtic{1}

linreg(define=ceqx1,noprint) hh 1997:11:28 2011:6:24  a1
# constant wtic{1} trend1 hh{1}

group eq  ceqx ceqx1
do t = 1997:11:28,2011:6:24,+1
comp %modelsetcoeffs(eq,%vectorect(b(t),2))
comp x = %modelgetcoeffs(eq)
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: defining coefficients

Unread post by TomDoan »

What are %beta(8) to %beta(11) supposed to be? You only have six parameters in the non-linear parameter set.
Post Reply