This function is still in beta development. Not exported in version 3.5. Computes the expected values of states (X component) and observations (Y component) for MARSS models fit with MARSS
. A list of newdata
, which includes the inputs (e.g. c and d in a marxss model) must be passed in if they are included in the model. Optionally data (Y) can be passed in in newdata
. This can be the original data or new data and can have missing values. To simulate data, use simulate.marssMLE
.
# S3 method for marssMLE
predict(object, ...,
n.ahead=1,
t.start=NULL,
newdata=list(),
se.fit=TRUE,
nboot=1000,
param.gen="hessian",
verbose=FALSE,
prediction.intervals=TRUE)
A marssMLE object marssMLE
.
Not used.
Number of time steps ahead to predict (starting from t.start
).
A what t to start the prediction relative to the start (t=1) of the data to which the model was fit. The default is to start at t=T+1, where T is the length of the data to which the model was fit. For example, if TT=10, t.start=1 and n.ahead = 5, prediction is for time steps 1, 2, 3, 4, 5 so is not past the end of the data.
Data (explanatory variables) to be used for prediction if included in the model.
Logical: should standard errors of prediction be returned?
Logical. Whether to return prediction intervals. Calculation of prediction intervals can be slow (if param.gen="MLE"
) and will exit with an error if the Hessian cannot be computed (if param.gen="hessian"
).
"MLE" or "hessian". Default="hessian". The perdiction interval calculation requires samples of the parameters from their estimated distribution. You can generate these via the estimated Hessian matrix (fast but assumes normality) or via parametric bootstrapped (terribly slow).
Number of bootstrapped parameter sequences to generate for the prediction interval calculation.
If TRUE, the boot straps used for the prediction interval calculation are returned.
A matrix of the expected values of the states (X) given newdata
. This is the Kalman smoother xtT
output using newdata
as the input for data and any inputs. See MARSSkf
.
A matrix of the expected values of the observations (Y) given newdata
. This is ytT
output using newdata
as the input for data and any inputs. See MARSShatyt
.
A matrix of the estimated standard errors of the X predictions.
A matrix of the estimated standard errors of the Y predictions.
The newdata
list that was constructed from the inputs.
The marssMLE
object that was constructed with newdata
. This can be passed to MARSSkf
if the full Kalman filter and smoother output is needed.
The marssMLE
object that was constructed with newdata
. This can be passed to MARSSkf
if the full Kalman filter and smoother output is needed.
The marssMLE
object that was constructed with newdata
. This can be passed to MARSSkf
if the full Kalman filter and smoother output is needed.
newdata
needs to be consistent with the model fitted. Thus if the model included inputs (in X or Y component) then these must also be included in newdata
and have the proper size and form. If newdata$data
is not passed in, then data (Y component) are assumed to be all missing and the expected values of the data (Ys) will be returned. The data is assumed to be all missing even if t.start
is less than T and thus the prediction period overlaps the data to which the model was fit. If that data should be included in the predictions, then it must be passed in in newdata
. The number of time steps in components of newdata
must be consistent with n.ahead
.
Prediction of the state (X) component is via the Kalman smoother (i.e. conditioned on all the data, if there is any) using MARSSkf
. Prediction of the observation (Y) component is via MARSShatyt
, and is also smoothed (i.e. conditioned on all the data, if there is any). The standard errors of prediction exclude the uncertainty in the estimation of the model parameters. You could use bootstrapping via MARSSboot
if you wanted to include that.