On Sun, 5 Jan 2020, Alecos Papadopoulos wrote:
As regards Suspicion 2, my "solution" makes the definition
of the Kalman
matrices a bit too long and a little confusing especially when the
restrictions are many and more complicated. The issue is that the mle takes
the likelihood expression from inside the Kalman bundle, this is why I think
It will not work if I try to define a "helper variable" as you write directly
inside the mle command block, as we often do in other cases... but maybe it
will work regardless. Maybe the following will work
[...]
It definitely should, but I strongly advise to use matrices and functions
to make your code more readable. Something like
<hansl>
function matrix small2big(matrix a)
matrix ret = a[1] | (a[1]/a[2]) | sin(a[1])*cos(a[2])
return ret
end function
###
### ...
###
mle loglik = do_something(b)
matrix b = small2big(a)
params a
end mle
</hansl>
That way, you're estimating the unrestricted parameters a; if you ever
need the restricted parameters b, all you need is the delta method, as in
<hansl>
J = fdjac(a, small2big(a))
b = small2big(a)
vcv_b = qform(J', $vcv)
se_b = sqrt(diag(vcv_b))
ps = b ~ se_b
names = "b[1] b[2] b[3]"
modprint ps names
</hansl>
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------