|
As stated in the previous paragraphs, some of the matrices may
be unknown. In a usual application, the matrix and the covariance matrix
of the initial state may be assumed known.
Shumway and Stoffer (1982) have proposed an EM-algorithm
for the iterative estimation of the unknown parameters
,
,
and
.
The algorithm is derived under the assumption of Gaussian error terms.
Then the logarithm of the likelihood function is expressed as
![]() |
![]() |
![]() |
|
![]() |
![]() |
||
![]() |
This algorithm is implemented in
XploRe
by the quantlet
kem
. The input
parameters are almost the same as in the functions for Kalman filtering and smoothing,
although the values of
,
,
and
are used as initial
values for the first step of the EM-algorithm. The last parameter of the
quantlet is the maximum number of iterations allowed. This quantlet returns
estimated parameters
,
,
and
(in this order).
To run this quantlet on the ar2 series and view the estimates, you can use the following sample code. Please note that depending on your system the processing may take a while.
x0 = #(0,0) Sig = #(0,0)~#(0,0) H = 1~0 F = #(5,1)~#(1,5) Q = 10 R = #(1,0)~#(0,1) {Estmu, EstF, EstQ, EstR} = kem(ar2,x0,Sig,H,F,Q,R,20) Estmu EstF EstQ EstR
The state-space model proposed by the EM-algorithm should be similar to the following one (the numbers may differ for your particular ar2 series).
Contents of Estmu [1,] -0.049532 [2,] 0.011073 Contents of EstF [1,] 0.59788 0.060844 [2,] 0.73477 3.7628 Contents of EstQ [1,] 3.7002 Contents of EstR [1,] 0.20202 -0.031133 [2,] -0.031133 0.76948
Note that not knowing the particular shape of the system matrices (i.e.
the zero element in , for example) the quantlet proposed its own
state-space model. There are several works that generalize the EM-algorithm
so that it allows us to have some elements of the unknown matrices fixed or to apply some linear constraints on them. You may, for example, refer to the article
Hosking, Pai and Wu (1996). The implementation of these modifications in
XploRe
, based on
the quantlet
kem
, should be straightforward.