I'm trying to fit a multivariate dlm using the dlmodeler package. The model is a state space representation of a simplified macroeconomic model, as such:
Observation equations:
h(t) = c + A * h(t-1) + B * r(t) - B *rs(t) + err1(t)
pi(t) = C * h(t-1) + D * epi(t-1) + E * pi(t-1) + err2(t)
State equations:
rs(t) = F * g(t-1) + z(t-1)
z(t) = G * z(t-1) + err3(t)
This is a slightly changed version of Laubach and Williams' simplified macroeconomic model (more info and links to papers below).
I haven't written any code yet because I haven't figured out how to begin. Two things are particularly troubling to me:
rs is a state variable but at the same time it's determined by one observable variable (g) and another state variable (z). How do I add an exogenous variable to a state equation? How do I set up a state equation that depends on another state equation within the dlmodeler framework?
How to restrict the same coefficient (b) to r and rs in the observation equation?
Other questions:
- Is the dlmodeler package capable of handling this model? If not, any recommendations? I tried using (though not in depth) dlm and MARSS, particularly MARSS, but I struggled and went back to dlmodeler.
- Does anyone know of any specific reference to the issues in questions 1 and 2?
I'm new to R, so any help is more than welcome. Thanks in advance!
About the model above:
The variables are: h - GDP gap (gdp - potential gdp); r - real interest rate; rs - neutral real interest rate; pi - inflation rate; epi - expected inflation rate for t+1; g - growth rate of potential gdp; z - represents other variables that affect rs; errors (err 1, 2 and 3) are i.i.d.
My unobserved variable of interest is rs (which depends on another unobserved variable z, which in turn follows an autorregressive process). Those who know the LW model might have noticed I don't take potential gdp and its growth rate as unobserved variables, and this was a deliberate choice (these are determined exogenously in my work). Another important aspect is that r and rs have the same coefficient B. This is so because, in fact, the variable in the observation equation is the interest rate gap, which is equal to r - rs.
PAPERS: Laubach and Williams's original model: https://www.federalreserve.gov/pubs/feds/2001/200156/200156pap.pdf
Neto and Portugal's version (I'm doing the same as they did, only with the aforementioned variation in LW's model): http://www.scielo.br/pdf/rbe/v63n2/03.pdf