TomDoan wrote:No. Kim and Nelson really focus on MS models, so the state space examples are rather simple. The Harvey example isn't that hard to figure out just from the code.
Dear Pro. Doan Thank you for the reply. I looked the code of the example. I think I get the basic idea about what the example tries to show. However, I still have questions about some details and I am seeking for your help. Correct me if I am making mistakes, please.
Basically, the estimation model for the example is that
Unemplt=trendt+Unemplt-1+output+output-1+output-2+Et
Trendt=trendt-1+trendratet+Ut
Trendratet=trendratet-1+Vt
frml(reg, vectpr=b) linereq
#empl{1} output{0 1}
Compute b=%zero(3,1)
These are codes ask Rats to run a simple linear regression for unemployment on its own lag and the output, output lagged once and output lagged twice and calculate the coefficients on three explanatory variables and store them in b.
I want to make sure whether b=%zero(3,1) means keep none-zero elements in a 3x1 vector.
@localdlm(type=trend, shocks=both, a=at,c=ct,f=ft)
This code is for the only state variable in the model (trend).
Nonlin sigspeps sigsqeta sigsqzeta b
This code is to specify the coefficients we are interested about. Sigspeps=var(Et), sigspeps=var(Ut) and sigsgzeta=var(Vt)
Compute sigsqeps=.5*1.e+4*%seesq, sigsqeta=.01*sigsqeps, sigsqzeta=sigsqeta
I am not too sure what this code for. Could you please explain it to me? The tip says that the variances have a naturally very small magnitude, so we force the estimated versions to be 4 orders of magnitude larger.
dlm(a=at,c=ct,f=ft,mu=lineareq,sv=1.e-4*sigsqeps,sw=%diag(||1.e-4*sigsqeta,1.e-4*sigsqzeta||),$
exact,y=empl,method=bfgs,vhat=vhat,svhat=svhat,type=smoothed) 2 * xstates
I know this is code for running state space model in Rats. However, I am not sure why sv=1.e-4*sigsqeps,sw=%diag(||1.e-4*sigsqeta,1.e-4*sigsqzeta||) and 2 * xstates. Could you please explain it to me?
set stdu 2 * = %scalar(vhat)/sqrt(%scalar(svhat))
This is code for generating stud2.
@STAMPdiags stdu
This is code for running state space model diagnostics on stud.
I am terribly sorry for asking so many questions to you at once. I am looking forward to hearing from you soon.
Best regards,
Fan