Dear community,

I was trying to estimate state space models and I came to the point where I have negative coefficients for standard deviation parameters. Eviews, for example, requires these parameters to be specified as var=exp(c), eventually to avoid this. Is there a very simple way in the code to avoid these negative sigmas?

Here follows the arma.gdt example from the manual with a subtle adaptation near the end made by me to lead to a negative sigma coefficient:

<hansl>
function void arma11_via_kalman (series y)
/* parameter initialization */
scalar phi = 0
scalar theta = 0
scalar sigma = 0.1

/* state-space model setup */
matrix H = {1; theta}
matrix F = {phi, 0; 1, 0}
matrix Q = {sigma^2, 0; 0, 0}
bundle kb = ksetup(y, H, F, Q)

/* maximum likelihood estimation */
mle logl = ERR ? NA : kb.llt
kb.obsymat[2] = theta
kb.statemat[1,1] = phi
kb.statevar[1,1] = sigma^2
ERR = kfilter(&kb)
params phi theta sigma
end mle --hessian
end function
# ------------------------ main ---------------------------
open arma.gdt # open the "arma" example dataset
z = log(abs(y))
arma11_via_kalman(z) # estimate an arma(1,1) model
</hansl>

Many thanks.
Regards,
Filipe Costa