## 7.1 Overview

As discussed in Chapter 6, the MARSS package fits multivariate state-space models in this form: $$$\begin{gathered} \mathbf{x}_t = \mathbf{B} \mathbf{x}_{t-1}+\mathbf{u}+\mathbf{w}_t \text{ where } \mathbf{w}_t \sim \,\text{N}(0,\mathbf{Q}) \\ \mathbf{y}_t = \mathbf{Z}\mathbf{x}_t+\mathbf{a}+\mathbf{v}_t \text{ where } \mathbf{v}_t \sim \,\text{N}(0,\mathbf{R}) \\ \mathbf{x}_0 = \boldsymbol{\mu} \end{gathered} \tag{7.1}$$$ where each of the bolded terms are matrices. Those that are bolded and small (not capitalized) have one column only, so are column matrices.

To fit a multivariate time series model with the MARSS package, you need to first determine the size and structure of each of the parameter matrices: $$\mathbf{B}$$, $$\mathbf{u}$$, $$\mathbf{Q}$$, $$\mathbf{Z}$$, $$\mathbf{a}$$, $$\mathbf{R}$$ and $$\boldsymbol{\mu}$$. This requires first writing down your model in matrix form. We will illustarte this with a series of models for the temporal population dynamics of West coast harbor seals.