Hello,
I´m trying to estimate time varying betas in a model using the kalman filter and assuming that beta is time reverting. The model is:
Measurement equation
Y_t = (1 Rm)(alpha_t|beta_t) + u_t
Transition equation
(alpha_t|beta_t) = (1 , 0 | 0 , phi) (alpha_t-1|beta_t-1) +(0 | (1-phi)*betam) + (n_t |w_t)
I use the following code:
nonlin phi beta phi2
dec frml[rect] a
frml a=||1.0,0.0|0.0,phi||
compute phi2=(1.0-phi)*beta
compute sv1=0.2,varw1=0.3,varw2=1.1
dlm(y=y,c=||1.0,Rm||,a=a,z=||0|phi2||,sv=sv1,sw=%diag(||varw1,varw2||),exact,type=filter) / xstates vstates
set tvbeta = xstates(t)(2)
set tvalpha = xstates(t)(1)
print / tvalpha tvbeta
But I get the following error message:
## SX22. Expected Type FRML[RECTANGULAR[REAL]], Got RECTANGULAR[RECTANGULAR[REAL]] Instead
>>>>|1.0,0.0|0.0,phi||<<<<
What is wrong?
Thanks
DLM instruction to estimate mean-reverting betas
Re: DLM instruction to estimate mean-reverting betas
You need a space after the A in
frml a = ||1.0,0.0|0.0,phi||
Also, it doesn't look like phi, beta and phi2 are separate parameters. You either want
nonlin phi beta phi2=(1.0-phi)*beta
or you need to substitute out for the phi2 in the definition of Z.
frml a = ||1.0,0.0|0.0,phi||
Also, it doesn't look like phi, beta and phi2 are separate parameters. You either want
nonlin phi beta phi2=(1.0-phi)*beta
or you need to substitute out for the phi2 in the definition of Z.