Am 21.08.2015 um 16:37 schrieb Fernando Fernandes Neto:
Dear Sven,
Thanks a lot for your attention.
What you've commented makes a lot of sense to me. So actually, I would
have a vector of Time Varying Coefficients (that would be my exogenous
variables), and a vector of unitary constants, being added to the State?
Forget my remark about the constant, that was probably off-track. What I
have in mind is more or less the following.
Suppose you have a scalar state variable s_t, and your state transition
equation is like this (in Latex format):
$s_{t+1} = G s_t + D z_t$
where z_t is your exogenous variable and I have omitted the innovation
because I'm lazy. If there was no exogenous variable (if D were zero)
then the gretl manual would use F as the name of G. But here the
time-varying transition matrix F_t is going to be something else.
Now expand your state to a vector $\xi_t$ with an identity (like you
said) to re-formulate the equation like this (mish-mash of Latex and a
matrix format where semi-colons come between one row and the next):
(s_{t+1}, 1)' = \xi_{t+1} = (G, D*z_t; 0, 1) \xi_t = F_t * (s_t, 1)'
The 1 as the auxiliary second state element should of course be
initialized to 1 and should not get a variance. The new 2x2 state
transition matrix F_t = (G, Dz_t; 0, 1) is now time-varying as it
depends on z_t.
As explained in the gretl manual (ch. 30 about the Kalman filter) you
can make the 'statemat' time-varying by writing a function that updates
its value, so you would write:
statemat F ; modify_F(&F, z)
where z is a matrix (vector) holding your z_t values. (I guess it must
be a matrix and cannot be a gretl series.)
The function modify_F in this example would have to look something like
this:
<hansl>
function void modify_F(matrix *F, matrix z)
tstep = $kalman_t
F[1,2] = F[1,2] * z[tstep] / z[tstep-1]
end function
</hansl>
This function takes the upper-right element of the matrix which on entry
will have the value D*z_{t-1} and turns it into D*z_t. (Obviously this
will fail if z_t contains zero values, I guess one could think about
workarounds for this problem.)
So that's the idea, but I must stress that I have never tried it and I
would be interested in hearing (a) your experience, and (b) jack's
thoughts on this.
good luck,
sven