Hi everybody,
I am using Kalman filter to esteem a particular financial model. The problem
is that Gretl cannot complete the maximum likelihood estimation (see Gretl
script below) and report this message:
Sono state usate derivate numeriche
Tolleranza = 1,81899e-012
failed to invert OPG matrix GG'
Errore nell'esecuzione dello script: abbandono
end mle
I cannot understand what is the problem, maybe someone can help me
Thanks
Here is the script:
matrix y={ENI_Return, ENI_OF, Enel_Return, Enel_OF}
/* parameter initalization */
fic = 0.95
fieni = 0.95
fienel = 0.95
b1r = 0
b1o = 0
b2r = 0
b2o = 0
c1r = 0
c1o = 0
c2r = 0
c2o = 0
/* Kalman filter setup */
matrix H = {b1r, b1o, b2r, b2o; c1r, c1o, 0, 0; 0, 0, c2r, c2o}
matrix F = {fic, 0, 0; 0, fieni, 0; 0, 0, fienel}
matrix Q = {1, 0, 0; 0, 1, 0; 0, 0, 1}
matrix A = {-0.0000015464, 0.20765, 0.000011055, 0.010607}
matrix R = {0.00000316057284, 0, 0, 0; 0, 68.26394884, 0, 0; 0, 0,
0.00000264875625, 0; 0, 0, 0, 17.57705625}
kalman
obsy y
obsymat H
statemat F
statevar Q
obsxmat A
obsvar R
end kalman
/* maximum likelihood estimation */
mle logl = ERR ? NA : $kalman_llt
H[1,1] = b1r
H[1,2] = b1o
H[1,3] = b2r
H[1,4] = b2o
H[2,1] = c1r
H[2,2] = c1o
H[3,3] = c2r
H[3,4] = c2o
F[1,1] = fic
F[2,2] = fieni
F[3,3] = fienel
ERR = kfilter()
params fic fieni fienel b1r b1o b2r b2o c1r c1o c2r c2o
end mle
/* return the smoothed estimate of \Unobsrved variables_t */
kalman
obsy y
obsymat H
statemat F
statevar Q
obsxmat A
obsvar R
end kalman --diffuse
series epsilon = ksmooth()
--
Marcello Bonassoli
Politecnico di Milano Graduate student