Estimation of the parameters in the general state space model via the EM algorithm. Inputs are not allowed; see the note.
EM1(num, y, A, mu0, Sigma0, Phi, cQ, cR, max.iter = 100, tol = 0.001)
number of observations
observation vector or time series; use 0 for missing values
observation matrices, an array with dim=c(q,p,n)
; use 0 for missing values
initial state mean
initial state covariance matrix
state transition matrix
Cholesky-like decomposition of state error covariance matrix Q -- see details below
R is diagonal here, so cR = sqrt(R)
-- also, see details below
maximum number of iterations
relative tolerance for determining convergence
Estimate of Phi
Estimate of Q
Estimate of R
Estimate of initial state mean
Estimate of initial state covariance matrix
-log likelihood at each iteration
number of iterations to convergence
relative tolerance at convergence
Practically, the script only requires that Q or R may be reconstructed as t(cQ)%*%(cQ)
or t(cR)%*%(cR)
, respectively.