Chapter 2 Quick Start

The default MARSS model is: \[\begin{equation} \begin{gathered} \mathbf{x}_t = \mathbf{B}_t\mathbf{x}_{t-1} + \mathbf{u}_t + \mathbf{C}_t\mathbf{c}_t + \mathbf{G}_t\mathbf{w}_t, \text{ } \mathbf{w}_t \sim \,\text{MVN}(0,\mathbf{Q}_t) \\ \mathbf{y}_t = \mathbf{Z}_t\mathbf{x}_t + \mathbf{a}_t + \mathbf{D}_t\mathbf{d}_t + \mathbf{H}_t\mathbf{v}_t, \text{ } \mathbf{v}_t \sim \,\text{MVN}(0,\mathbf{R}_t) \\ \mathbf{x}_1 \sim \,\text{MVN}(\boldsymbol{\pi},\boldsymbol{\Lambda}) \text{ or } \mathbf{x}_0 \sim \,\text{MVN}(\boldsymbol{\pi},\boldsymbol{\Lambda}) \end{gathered} \tag{2.1} \end{equation}\] \(\mathbf{c}\) and \(\mathbf{d}\) are inputs (aka, exogenous variables or covariates or indicator variables) and must have no missing values. In most cases, \(\mathbf{G}\) and \(\mathbf{H}\) are fixed (not estimated) and must have no missing values. \(\mathbf{w}_t\) and \(\mathbf{v}_t\) are uncorrelated. The \(\mathbf{R}\), \(\mathbf{Q}\) and \(\boldsymbol{\Lambda}\) variance-covariance matrices can be set to zero (or partially to zero) to specify partially deterministic systems.

If you already work with models in the form of Equation (2.1), you can immediately fit your model with the MARSS package. Install the MARSS package and then type library(MARSS) at the command line to load the package.

The call to fit a model in MARSS is

fit <- MARSS(data, model=model.list)

The data must be entered as a \(n \times T\) matrix, a ts object (which will be converted to a \(n \times T\) matrix) or a vector (which will be converted to a \(1 \times T\) matrix). No missing time steps are allowed. Data missing for a time step are specified with NA. NAs may appear anywhere in the data and do not need to line up across the rows in data.

model.list is a list that specifies the form of each of the parameter matrices in Equation (2.1). See next section and Chapter 4.

There are plot (and autoplot), print, summary, coef, fitted, tsSmooth, residuals and predict (and forecast) functions for marssMLE objects. See the man files, e.g. ?plot, and Part ?? for examples.