29.0 KFILTER Command
The KFILTER command can be used to solve and forecast with a Kalman
Filter or State Space Model with up to ten series. Basic references are:
- Aoki, Masano, "State Space Modeling of Time Series,"
Springer-Verlag, New York 1987.
- Harvey, A. C. "The Economic Analysis of Time Series,",
New York: John Wiley (1981)
- Harvey, A. C. "Time Series Models,", New York: John Wiley (1981)
Form of KFILTER command.
B34SEXEC KFILTER $
SERIESN VAR=Xvar1 DIFF=n1 LOGS$
ESTIMATE options parameters$
B34SEEND$
The SERIESN and ESTIMATE sentences are required.
KFILTER sentence parameters.
IBEGIN=n1 Sets beginning observation. Defaults to 1.
IEND=n2 Sets ending observation. Defaults to NOOB.
SERIESN sentence.
The SERIESN sentence is used to input the series. It is recommended
that the "most exogenous" series be listed first. There can be up to 10
SERIESN sentences. The parameter VAR is required.
Options on SERIESN sentence.
LOGS - If present will take natural logs of the data.
Paramaters on SERIESN sentence.
VAR = Xvar Inputs the variable.
DIFF=n1 Will form newY = Y(t) - Y(t-n1).
ESTIMATE sentence.
The ESTIMATE sentence controls the estimation of of the Kalman
Filter (State Space) Model.
ESTIMATE sentence options.
IORGS - Turns on a print of original data.
INEWS - Turns on a print of the data with means
subtracted.
IRES - Turns on print of residuals.
INSFOR - Turns on print of in sample forecast.
IPRED - Turns on print of in sample forecast of
transformed data. This is usually not needed.
Use ires and insfor.
IHANKL - Turns on print of hankle and associated matrices.
GEIGENV - Turns on print of eigenvector matrix.
GUMATRIX - Turns on print of U matrix.
GAMATRIX - Turns on print of A matrix.
FORECAST - Requests 23 out of sample forecasts.
IOLDD - If sets, calls original EIGEN routine. This
option is not recmmmended since EISPACK (the
default routines used are TRED2 and IMTQ2) is more
accurate to decompose the henkle matrix.
ESTIMATE sentence parameters.
K=n1 - Sets number of lags on Hankel Matrix. Default=6.
NSTAR=n2 - Dimension of state vector. Default = 1.
MXITER=n3 - Sets maximum number of iterations. Default=500.
It is imperative to experiment with lower values
of MXITER since the recursive riccati solution
may be unstable for large values of MXITER. In
addition, on different platforms, accuracy
differences will make quite a difference. The
used should be guided by the sum of squares
before and after and the percentage reduction.
EPS=r1 - Step size. Default = .05. If there are
convergence problems solving the riccati
equation, try lower values of EPS.
Notes: In additon to experimenting with MXITER, various values of K and
NSTAR should be tried. Higher values of MXITER can be used with
lower step sizes. If NSTAR and K are set too large overflows
can occure, especially if real*16 add or real*16 mult is in
effect.
Sample job.
b34sexec kfilter$
seriesn var=y diff=1$
estimate k=15 nstar=10 forecast ihankl$
b34seend$