8.1 RW observed with multiple time series
A univariate random walk observed by 3 observation time series. \[\begin{equation} \begin{gathered} x_{t} = x_{t-1} + u + w_{t}, \text{ } w_t \sim \,\text{N}(0,q) \\ \\ \begin{bmatrix}y_1\\y_2\\y_3\end{bmatrix}_t = \begin{bmatrix}1\\1\\1\end{bmatrix} x_t + \begin{bmatrix}0\\0\\0\end{bmatrix} + \begin{bmatrix}v_1\\ v_2\\ v_3\end{bmatrix}, \textrm{ } \mathbf{v}_t \sim \,\text{MVN}\begin{pmatrix}\begin{bmatrix}0\\0\\0\end{bmatrix},\begin{bmatrix}r&0&0\\0&r&0\\0&0&r\end{bmatrix} \end{pmatrix} \end{gathered} \tag{8.2} \end{equation}\]
Create set up the model:
<- matrix(1, 3, 1)
Z <- "diagonal and equal" R
Fit with MARSS()
:
<- t(harborSealWA)[c("EBays", "PSnd", "HC"), ]
yt <- MARSS(yt, model = list(R = R, Z = Z)) fit
Get confidence intervals with tidy()
:
::tidy(fit) broom
term estimate std.error conf.low conf.up
1 A.PSnd -0.793079609 0.083137017 -0.956025168 -0.630134050
2 A.HC -0.864545855 0.090775537 -1.042462638 -0.686629073
3 R.diag 0.041048591 0.011183264 0.019129797 0.062967385
4 U.U 0.030295215 0.013645831 0.003549878 0.057040552
5 Q.Q 0.002704196 0.003471737 -0.004100284 0.009508676
6 x0.x0 6.964254445 0.122862306 6.723448750 7.205060139
plot.pars(fit)