[R] DLM - Covariates in the system equation
GPetris at uark.edu
Mon Dec 8 18:45:22 CET 2008
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
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])
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
(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
> 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!
> R-help at r-project.org mailing list
> 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>
Department of Mathematical Sciences
University of Arkansas - Fayetteville, AR 72701
Ph: (479) 575-6324, 575-8630 (fax)
More information about the R-help