On Jueves, 17 de Septiembre de 2009 01:06:17 David T. Hamilton escribió:
Hi, I could use some guidance from seasoned Gretl users. I am trying
to
estimate the trend component of a univariate financial time series using an
unobserved components model and the Kalman Filter using the kalman command.
I'm new to Gretl and it's been some time since I've even looked at state
space models. Here are my equations:
Let x(t) be the univariate monthly financial time series data I have.
x(t) = w(t) + y(t) where w(t) is the trend and y(t) is the cycle
w(t) = x(t-1) + e(t)
y(t) = rho*y(t-1) + u(t)
e(t) and u(t) not correlated
In the notation of the Gretl users guide, I believe I have the following
matrices for the kalman command:
H = { 1 ; 1}
F = {1, 0; 0, rho}
Q = {var(e), 0; 0, var(u)}
I'm not sure what to do with the observation matrix -- this is where I'm
stuck. Also,should I specify statevar and obsvar as scalars instead? I
have a univariate time series, x(t). Once I have the system set up I could
proceed to estimate rho, var(e) and var(u), then calculate the trend
forecasts.
Any guidance would be greatly appreciated.
The model you are setting up with these matrices is not exactly the same you
are proposing above, in fact it is
x(t) = w(t) + y(t)
w(t) = w(t-1) + e(t)
y(t) = rho*y(t-1) + u(t)
which I think better than the one you write above. In fact it is a local level
model as the one you can find in example 2 in section 23.10 of the gretl
manual. In this case the observation matrix is TX1, your vector with the T obs
of variable x(t), and the statevar is 2X1:
alfa(t)=[w(t); y(t)]
--
Ignacio Diaz-Emparanza
DEPARTAMENTO DE ECONOMÍA APLICADA III (ECONOMETRÍA Y ESTADÍSTICA)
UPV/EHU
Avda. Lehendakari Aguirre, 83 | 48015 BILBAO
T.: +34 946013732 | F.: +34 946013754
www.et.bs.ehu.es