EM Algorithm for General State Space Models - This script has been superseded by EM.
EM Algorithm for General State Space Models - This script has been superseded by EM.
Estimation of the parameters in the general state space model via the EM algorithm. Inputs are not allowed; see the note. NOTE: This script has been superseded by EM and scripts starting with an x are scheduled to be phased out.
xEM1(num, y, A, mu0, Sigma0, Phi, cQ, cR, max.iter =100, tol =0.001)
Arguments
num: number of observations
y: observation vector or time series; use 0 for missing values
A: observation matrices, an array with dim=c(q,p,n); use 0 for missing values
mu0: initial state mean
Sigma0: initial state covariance matrix
Phi: state transition matrix
cQ: Cholesky-like decomposition of state error covariance matrix Q -- see details below
cR: R is diagonal here, so cR = sqrt(R) -- also, see details below
max.iter: maximum number of iterations
tol: relative tolerance for determining convergence
Returns
Phi: Estimate of Phi
Q: Estimate of Q
R: Estimate of R
mu0: Estimate of initial state mean
Sigma0: Estimate of initial state covariance matrix
like: -log likelihood at each iteration
niter: number of iterations to convergence
cvg: relative tolerance at convergence
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The webpages for the texts and some help on using R for time series analysis can be found at https://nickpoison.github.io/.
Author(s)
D.S. Stoffer
Details
cQ and cR are the Cholesky-type decompositions of Q and R. In particular, Q = t(cQ)%*%cQ and R = t(cR)%*%cR is all that is required (assuming Q and R are valid covariance matrices).