MARSShatyt: Compute Expected Value of Y,YY, and YX
Description
Computes the expected value of random variables involving Y for the EM algorithm. This is a base function in the MARSS-package
.Usage
MARSShatyt( MLEobj )
Arguments
MLEobj
A marssMLE
object with the par
element of estimated parameters, model
element with the model description and data. Value
- A list with the following components (n is the number of state processes). Names ending in "T" are estimates from the Kalman smoother; J is also smoother output. Other components are output from the Kalman filter.
- ytTEstimates E[Y(t) | Y(1)=y(1)] (n x T matrix).
- OtTEstimates E[Y(t)t(Y(t) | Y(1)=y(1)] (n x n x T array).
- yxtTEstimates E[Y(t)t(X(t) | Y(1)=y(1)] (n x m x T array).
- errorsAny error messages due to ill-conditioned matrices.
- ok(T/F) Whether errors were generated.
Details
For state space models, MARSShatyt()
computes the expectations involving Y. If Y is completely observed, this entails simply replacing Y with the observed y. When Y is only partially observed, the expectation involves the conditional expectation of a multivariate normal.
Missing values in the data may be handled in one of two ways:
1. Missing values may be replaced with zeroes prior to passing to MARSSkf()
. Argument missing.matrix
must then be a matrix of the same dimensions as the data, with 0 in the positions of observed values and 1 in the positions of missing values.
2. Data containing missing values may be passed in. Argument miss.value
must then be the code used to represent missing values.
The function requires that you specify either a missing matrix or a miss.value. If there are no missing values, just set miss.value
to a value that is not in your data (like NA or -99).References
Holmes, E. E. (2012) Derivation of the EM algorithm for constrained and unconstrained multivariate autoregressive state-space (MARSS) models. Technical report. NOAA Fisheries, Northwest Fisheries Science
Center, 2725 Montlake Blvd E., Seattle, WA 98112. Type RShowDoc("EMDerivation",package="MARSS")
to open a copy.