[R] DLM - Covariates in the system equation

Giovanni Petris GPetris at uark.edu
Mon Dec 8 18:45:22 CET 2008


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)

> Date: Mon, 08 Dec 2008 00:17:29 -0500
> From: jens.keller at unisg.ch
> Sender: r-help-bounces at r-project.org
> Precedence: list
> 
> 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
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 

Giovanni Petris  <GPetris at uark.edu>
Associate Professor
Department of Mathematical Sciences
University of Arkansas - Fayetteville, AR 72701
Ph: (479) 575-6324, 575-8630 (fax)
http://definetti.uark.edu/~gpetris/



More information about the R-help mailing list