Processing math: 100%

MARSS model specification

FISH 507 – Applied Time Series Analysis

Eli Holmes

22 Jan 2019

MARSS Package

We will be using the MARSS package to fit univariate and multivariate state-space models.

The main function is MARSS():

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

data are a vector or a matrix with time going along the columns.

model list is a list with the structure of all the parameters.

MARSS model notation

xt=Bxt1+U+wt,wtN(0,Q) yt=Zxt+A+vt,vtN(0,R)

The MARSS model list follows this notation one-to-one.

Example 2 x time series

[x1x2]t=[1001][x1x2]t1+[uu]+[w1w2]t

[w1w2]tN(0,[q00q])

Let’s write out the x parameters

B=[1001]

B <- diag(1,2)
B
##      [,1] [,2]
## [1,]    1    0
## [2,]    0    1

U=[uu]

U <- matrix("u",2,1)
U
##      [,1]
## [1,] "u" 
## [2,] "u"

A value in quotes is a character vector and is the name of a parameter to be estimated.

Q=[qccq]

Q <- matrix(c("q","c","c","q"),2,2)
Q
##      [,1] [,2]
## [1,] "q"  "c" 
## [2,] "c"  "q"

or use

Q <- "equalvarcov"

Example 2 y time series

[y1y2]t=[1001][x1x2]t+[00]+[v1v2]t

[v1v2]tN(0,[r00r])

Let’s write out the y parameters

The Z and A are just like B and U, but R is different.

R=[r00r]

R <- matrix(list(0),2,2)
diag(Q) <- "r"
R
##      [,1] [,2]
## [1,] 0    0   
## [2,] 0    0

or use

R <- "diagonal and equal"

R has both fixed values (the 0s) and estimated values (the r), so we need both numbers and charaters in our matrix.