Skip to contents

Computes the expected value of random variables involving \(\mathbf{Y}\). Users can use tsSmooth() or print( MLEobj, what="Ey") to access this output. See print.marssMLE.

Usage

MARSShatyt(MLEobj, only.kem = TRUE)

Arguments

MLEobj

A marssMLE object with the par element of estimated parameters, model element with the model description and data.

only.kem

If TRUE, return only ytT, OtT, yxtT, and yxttpT (values conditioned on the data from \(1:T\)) needed for the EM algorithm. If only.kem=FALSE, then also return values conditioned on data from 1 to \(t-1\) (Ott1 and ytt1) and 1 to \(t\) (Ott and ytt), yxtt1T (\(\textrm{var}[\mathbf{Y}_t, \mathbf{X}_{t-1}|\mathbf{y}_{1:T}]\)), var.ytT (\(\textrm{var}[\mathbf{Y}_t|\mathbf{y}_{1:T}]\)), and var.EytT (\(\textrm{var}_X[E_{Y|x}[\mathbf{Y}_t|\mathbf{y}_{1:T},\mathbf{x}_t]]\)).

Details

For state space models, MARSShatyt() computes the expectations involving \(\mathbf{Y}\). If \(\mathbf{Y}\) is completely observed, this entails simply replacing \(\mathbf{Y}\) with the observed \(\mathbf{y}\). When \(\mathbf{Y}\) is only partially observed, the expectation involves the conditional expectation of a multivariate normal.

Value

A list with the following components (n is the number of state processes). Following the notation in Holmes (2012), \(\mathbf{y}(1)\) is the observed data (for \(t=1:T\)) while \(\mathbf{y}(2)\) is the unobserved data. \(\mathbf{y}(1,1:t-1)\) is the observed data from time 1 to \(t-1\).

ytT

E[Y(t) | Y(1,1:T)=y(1,1:T)] (n x T matrix).

ytt1

E[Y(t) | Y(1,1:t-1)=y(1,1:t-1)] (n x T matrix).

ytt

E[Y(t) | Y(1,1:t)=y(1,1:t)] (n x T matrix).

OtT

E[Y(t) t(Y(t)) | Y(1,1:T)=y(1,1:T)] (n x n x T array).

var.ytT

var[Y(t) | Y(1,1:T)=y(1,1:T)] (n x n x T array).

var.EytT

var_X[E_Y[Y(t) | Y(1,1:T)=y(1,1:T), X(t)=x(t)]] (n x n x T array).

Ott1

E[Y(t) t(Y(t)) | Y(1,1:t-1)=y(1,1:t-1)] (n x n x T array).

var.ytt1

var[Y(t) | Y(1,1:t-1)=y(1,1:t-1)] (n x n x T array).

var.Eytt1

var_X[E_Y[Y(t) | Y(1,1:t-1)=y(1,1:t-1), X(t)=x(t)]] (n x n x T array).

Ott

E[Y(t) t(Y(t)) | Y(1,1:t)=y(1,1:t)] (n x n x T array).

yxtT

E[Y(t) t(X(t)) | Y(1,1:T)=y(1,1:T)] (n x m x T array).

yxtt1T

E[Y(t) t(X(t-1)) | Y(1,1:T)=y(1,1:T)] (n x m x T array).

yxttpT

E[Y(t) t(X(t+1)) | Y(1,1:T)=y(1,1:T)] (n x m x T array).

errors

Any error messages due to ill-conditioned matrices.

ok

(TRUE/FALSE) Whether errors were generated.

References

Holmes, E. E. (2012) Derivation of the EM algorithm for constrained and unconstrained multivariate autoregressive state-space (MARSS) models. Technical report. arXiv:1302.3919 [stat.ME] Type RShowDoc("EMDerivation",package="MARSS") to open a copy. See the section on 'Computing the expectations in the update equations' and the subsections on expectations involving Y.

Author

Eli Holmes, NOAA, Seattle, USA.

See also

Examples

dat <- t(harborSeal)
dat <- dat[2:3, ]
fit <- MARSS(dat)
#> Success! abstol and log-log tests passed at 93 iterations.
#> Alert: conv.test.slope.tol is 0.5.
#> Test with smaller values (<0.1) to ensure convergence.
#> 
#> MARSS fit is
#> Estimation method: kem 
#> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001
#> Estimation converged in 93 iterations. 
#> Log-likelihood: 5.398098 
#> AIC: 3.203804   AICc: 7.203804   
#>  
#>                                           Estimate
#> R.diag                                     0.02219
#> U.X.CoastalEstuaries                       0.06169
#> U.X.OlympicPeninsula                       0.04324
#> Q.(X.CoastalEstuaries,X.CoastalEstuaries)  0.01119
#> Q.(X.OlympicPeninsula,X.OlympicPeninsula)  0.00538
#> x0.X.CoastalEstuaries                      7.40989
#> x0.X.OlympicPeninsula                      7.18906
#> Initial states (x0) defined at t=0
#> 
#> Standard errors have not been calculated. 
#> Use MARSSparamCIs to compute CIs and bias estimates.
#> 
EyList <- MARSShatyt(fit)