## 8.1 Overview

A multivariate autoregressive state-space (MARSS) model with covariate effects in both the process and observation components is written as: $$$\begin{gathered} \mathbf{x}_t = \mathbf{B}_t\mathbf{x}_{t-1} + \mathbf{u}_t + \mathbf{C}_t\mathbf{c}_t + \mathbf{w}_t, \text{ where } \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{v}_t, \text{ where } \mathbf{v}_t \sim \text{MVN}(0,\mathbf{R}_t) \end{gathered} \tag{8.1}$$$ where $$\mathbf{c}_t$$ is the $$p \times 1$$ vector of covariates (e.g., temperature, rainfall) which affect the states and $$\mathbf{d}_t$$ is a $$q \times 1$$ vector of covariates (potentially the same as $$\mathbf{c}_t$$), which affect the observations. $$\mathbf{C}_t$$ is an $$m \times p$$ matrix of coefficients relating the effects of $$\mathbf{c}_t$$ to the $$m \times 1$$ state vector $$\mathbf{x}_t$$, and $$\mathbf{D}_t$$ is an $$n \times q$$ matrix of coefficients relating the effects of $$\mathbf{d}_t$$ to the $$n \times 1$$ observation vector $$\mathbf{y}_t$$.

With the MARSS() function, one can fit this model by passing in model$c and/or model$d in the model argument as a $$p \times T$$ or $$q \times T$$ matrix, respectively. The form for $$\mathbf{C}_t$$ and $$\mathbf{D}_t$$ is similarly specified by passing in model$C and/or model$D. $$\mathbf{C}$$ and $$\mathbf{D}$$ are matrices and are specified as 2-dimensional matrices as you would other parameter matrices.