when creating a state space object, how can I set an initial value for a coefficient of the state space which comes from an object that already exists in my workfile? I know how to set an initial value in a state space, but I would like to use outside information to help/accelerate the maximum likelihood estimation.
For instance, consider that a sensible value for a coefficient in the state space comes from a regression. How could I reference this coefficient when I declare param in the state space?
Consider the two models below (they make no sense, they are simply there for the example):
Code: Select all
wfcreate(wf=annual, page=myproject) a 1950 2005
genr series1=nrnd
genr series2= 0.9*series1(-1)+ 0.1*nrnd
' Working state space
statespace locallevel ' Create and estimate the state space with initial values
locallevel.append @signal series2=mu +[ename = e1, var = exp(c(1))]
locallevel.append @state mu=mu(-1) +[ename = e2, var = exp(c(2))]
locallevel.append param c(1) -7 c(2) -8.5
locallevel.ml
and Model 2:
Code: Select all
' Not working state space
equation leastsquare ' estimate mock regression
leastsquare.ls series2 c series2(-1)
scalar coef1=leastsquare.@coefs(1)
statespace locallevelbis ' Create the state space
locallevelbis.append @signal series2=mu +[ename = e1, var = exp(c(1))]
locallevelbis.append @state mu=mu(-1) +[ename = e2, var = exp(c(2))]
locallevelbis.append param c(1) -7 c(2) coef1 ' append the scalar as initial value
locallevelbis.ml
Is model 2 possible? If so, how should I reference coef1?
Thanks a lot in advance.