Library: | kalman |
See also: | gkalfilter gkalsmoother gkallag gkalresiduals |
Quantlet: | gkalarray | |
Description: | This auxiliary quantlet sets the matrices for a time variable state space model. |
Usage: | gkalarrayOut = gkalarray(Y,M,IM,XM) | |
Input: | ||
Y | N_max x TIME matrix of endogenous observations | |
M | If M is a matrix in state equation: K x K with mM variable entries where K is the number of state variables. If M is a matrix in measurement equation: N_max x K with mM variable entries where N_max is the maximal number of observations in Y and K is the number of state variables. | |
IM | Index matrix. If M is a matrix in state equation: K x K matrix. If M is a matrix in measurement equation: N_max x K matrix. | |
XM | Matrix with observations for M_t. If M is a matrix in state equation: mM x TIME matrix. If M is a matrix in measurement equation: mM x TIME matrix. | |
Output: | ||
gkalarrayOut | If M is a matrix in state equation: K x K x TIME array. If M is a matrix in measurement equation: N_max x K x TIME array. |
State equation
alpha_t = c_t + T_t alpha_t-1 + e^s_t
Measurement equation
y_t = d_t + Z_t alpha_t + e^m_t
with
alpha_0 ~ (mu,Sig), e^s_t ~ (0,R_t), e^m_t ~ (0,H_t)
All parameters are known.
The entries of the index matrix are set to 0 if the elements of the corresponding system matrix are constant. The entries must be non-zero if the elements of the corresponding system matrix are time-varying. A non-zero value indicates the row of the corresponding observations matrix that contains the time-varying entry.
library("kalman") Y = read("houseprice.dat") Z = matrix(3)~0*matrix(3,4) IZ = 0*matrix(3,2)~(#(1:3)'|#(4:6)'|#(7:9)') XZ = read("housequality.dat") Za = gkalarray(Y,Z,IZ,XZ) Y[,5:6] Za[,,5:6]
Contents of _tmp [1,] +NAN 32.879 [2,] 32.115 27.465 [3,] 33.99 31.93 Contents of _tmp [,,1,1,1,1,1,1] [1,] 1 0 +NAN +NAN +NAN [2,] 1 0 -0.82342 0.032925 0.020662 [3,] 1 0 1.3762 0.021782 0.055013 [,,2,1,1,1,1,1] [1,] 1 0 1.2248 0.095754 -0.049138 [2,] 1 0 -2.0852 -0.093736 0.129 [3,] 1 0 2.2904 0.047536 -0.000714