Skip to content

DLM - Covariates in the system equation

2 messages · jens.keller at unisg.ch, Giovanni Petris

#
Is there a way to add covariates to the system equation in a time-varying 
approach:

Y[t] = F'[t]theta[t] + v[t], v[t] ~ N[0,V] #observation equation
theta[t]  = theta[t-1] + psi*Z[t] + w[t], w[t] ~ N[0,W] #system equation

While F[t] is a matrix of regressors to capture the short term effect on 
the response series Y,
Z[t] measures the long-term effect of either
(1) two policies by a step dummy or
(2) various policies with a continuous variable.

I appreciate any kind of help!
Thanks in advance!
Jens
#
Hi Jens,

I assume you are using package dlm. 

To add covariates to the system equation the workaround is to include
psi in the state vector. Suppose your observation and system equations are
as follow:

Y[t] = F[t]theta[t] + v[t], v[t] ~ N[0,V] #observation equation
theta[t]  = G[t]theta[t-1] + Z[t]psi + w[t], w[t] ~ N[0,W] #system equation

(Note that I wrote F[t]theta[t] instead of F'[t]theta[t], Z[t]psi
instead of psi*Z[t], and G[t]theta[t-1] instead of simply theta[t-1])

Defining 

thetahat[t] = [theta[t]'  psi']'


Fhat[t] = [ F[t]  0 ]


          [ G[t]  Z[t] ]
Ghat[t] = [            ]
          [  0     Id  ]


What = blockdiag(W, 0)


you have a new DLM that satisfies your requirement. I hope this is
clear enough for you to implement it in R. If not, please send a small
example telling us what you want to do. By the way, questions about
contributed packages should be addressed to the package maintainer
first. 

Best,
Giovanni Petris
(author of package dlm)