I would like to know how can I write in dlm form ( dlm PAckage by Petris) a state equation like this:

$$a(t+1) = k(t) + F*a(t) + T(t)w(t)$$

where $w$ is $N(0,1)$.

To make it easier I can assume $k$ and $T$ constant. My question is how can I rearrange it in the way described by "An R Package for Dynamic Linear Models"?



If $w(t)$ is $N(0,1)$ you can define $w^*(t) = T(t)w(t)$ which will have covariance matrix $Q(t)= T(t)T(t)'$; you can always subsume the $T(t)$ part in the covariance matrix of the random vector $w(t)$ which drives the state equation.

As for the $k(t)$ part, which you are willing to assume constant, you might perhaps augment the state vector and write:

$ \qquad\qquad\begin{bmatrix} a(t+1) \\ k(t+1) \end{bmatrix} = \begin{bmatrix} F & 1 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} a(t) \\ k(t) \end{bmatrix} + \begin{bmatrix} w^*(t) \\ \epsilon \end{bmatrix}$

with the augmented noise vector having distribution normal, with mean vector $\vec{0}$ and covariance matrix

$\qquad\qquad Q = \begin{bmatrix} T(t)T(t)' & 0 \\ 0 & 0 \end{bmatrix}.$

If you initialize the filter with whatever prior you use for the $a(t)$ part and $N(k,0)$ for the $k(t)$ element of the state vector, it will take value $k$ for all $t$. I think dlm will cope with the singular matrices above, but have no chance to test at my present location.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.