MARSS.dfa | R Documentation |
The Dynamic Factor Analysis model in MARSS is
The argument form="marxss"
in a MARSS()
function call specifies a MAR-1 model with eXogenous variables model. This is a MARSS(1) model of the form:
\mathbf{x}_{t} = \mathbf{x}_{t-1} + \mathbf{w}_t, \textrm{ where } \mathbf{W}_t \sim \textrm{MVN}(0,\mathbf{I})
\mathbf{y}_t = \mathbf{Z}_t \mathbf{x}_t + \mathbf{D}_t \mathbf{d}_t + \mathbf{v}_t, \textrm{ where } \mathbf{V}_t \sim \textrm{MVN}(0,\mathbf{R}_t)
\mathbf{X}_1 \sim \textrm{MVN}(\mathbf{x0}, 5\mathbf{I})
Note, by default \mathbf{x}_1
is treated as a diffuse prior.
Passing in form="dfa"
to MARSS()
invokes a helper function to create that model and creates the \mathbf{Z}
matrix for the user. \mathbf{Q}
is by definition identity, \mathbf{x}_0
is zero and \mathbf{V_0}
is diagonal with large variance (5). \mathbf{u}
is zero, \mathbf{a}
is zero, and covariates only enter the \mathbf{y}
equation. Because \mathbf{u}
and \mathbf{a}
are 0, the data should have mean 0 (demeaned) otherwise one is likely to be creating a structurally inadequate model (i.e. the model implies that the data have mean = 0, yet data do not have mean = 0 ).
Some arguments are common to all forms: "y" (data), "inits", "control", "method", "form", "fit", "silent", "fun.kf". See MARSS
for information on these arguments.
In addition to these, form="dfa" has some special arguments that can be passed in:
demean
Logical. Default is TRUE, which means the data will be demeaned.
z.score
Logical. Default is TRUE, which means the data will be z-scored (demeaned and variance standardized to 1).
covariates
Covariates (d
) for the y
equation. No missing values allowed and must be a matrix with the same number of time steps as the data. An unconstrained D
matrix will estimated.
The model
argument of the MARSS()
call is constrained in terms of what parameters can be changed and how they can be changed. See details below. An additional element, m
, can be passed into the model
argument that specifies the number of hidden state variables. It is not necessarily for the user to specify Z
as the helper function will create a Z
appropriate for a DFA model.
The model
argument is a list. The following details what list elements can be passed in:
B
"Identity". The standard (and default) DFA model has B="identity". However it can be "identity", "diagonal and equal", "diagonal and unequal" or a time-varying fixed or estimated diagonal matrix.
U
"Zero". Cannot be changed or passed in via model argument.
Q
"Identity". The standard (and default) DFA model has Q="identity". However, it can be "identity", "diagonal and equal", "diagonal and unequal" or a time-varying fixed or estimated diagonal matrix.
Z
Can be passed in as a (list) matrix if the user does not want a default DFA Z
matrix. There are many equivalent ways to construct a DFA Z
matrix. The default is Zuur et al.'s form (see User Guide).
A
Default="zero". Can be "unequal", "zero" or a matrix.
R
Default="diagonal and equal". Can be set to "identity", "zero", "unconstrained", "diagonal and unequal", "diagonal and equal", "equalvarcov", or a (list) matrix to specify general forms.
x0
Default="zero". Can be "unconstrained", "unequal", "zero", or a (list) matrix.
V0
Default=diagonal matrix with 5 on the diagonal. Can be "identity", "zero", or a matrix.
tinitx
Default=0. Can be 0 or 1. Tells MARSS whether x0 is at t=0 or t=1.
m
Default=1. Can be 1 to n (the number of y time-series). Must be integer.
See the User Guide chapter on Dynamic Factor Analysis for examples of of using form="dfa"
.
A object of class marssMLE
. See print()
for a discussion of the various output available for marssMLE
objects (coefficients, residuals, Kalman filter and smoother output, imputed values for missing data, etc.). See MARSSsimulate()
for simulating from marssMLE
objects. MARSSboot()
for bootstrapping, MARSSaic()
for calculation of various AIC related model selection metrics, and MARSSparamCIs()
for calculation of confidence intervals and bias.
MARSS(y,
inits = NULL,
model = NULL,
miss.value = as.numeric(NA),
method = "kem",
form = "dfa",
fit = TRUE,
silent = FALSE,
control = NULL,
fun.kf = "MARSSkfas",
demean = TRUE,
z.score = TRUE)
Eli Holmes, NOAA, Seattle, USA.
The MARSS User Guide: Holmes, E. E., E. J. Ward, and M. D. Scheuerell (2012) Analysis of multivariate time-series using the MARSS package. NOAA Fisheries, Northwest Fisheries Science
Center, 2725 Montlake Blvd E., Seattle, WA 98112 Type RShowDoc("UserGuide",package="MARSS")
to open a copy.
MARSS()
, MARSS.marxss()
## Not run:
dat <- t(harborSealWA[,-1])
# DFA with 3 states; used BFGS because it fits much faster for this model
fit <- MARSS(dat, model = list(m=3), form="dfa", method="BFGS")
# See the Dynamic Factor Analysis chapter in the User Guide
RShowDoc("UserGuide", package = "MARSS")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.