9

I am currently using dynamic linear regression (dynlm) for my analysis. However, I do also find another model called dynamic linear model (dlm).

I find that dlm has an official mathematical expression by West and Harrison (1989) and everywhere. However, I cannot find an official mathematical expression for dynlm elsewhere. Even the official R program document verbally explains that it is just an extended version of linear regression that allows additional feature but with no explicit mathematical expression.

Can I assume the official mathematical expression for dynlm and dlm identical? If not, may I know the official mathematical expression for dynlm in r programming?

Eric
  • 528
  • 1
  • 8
  • 26

1 Answers1

4

From Furman university documentation:

The interface and internals of dynlm are very similar to lm, but currently dynlm offers two advantages over the direct use of lm: 1. extended formula processing, 2. preservation of time-series attributes.

For specifying the formula of the model to be fitted, there are additional functions available which facilitate the specification of dynamic models. An example would be d(y) ~ L(y, 2), where d(x, k) is diff(x, lag = k) and L(x, k) is lag(x, lag = -k), note the difference in sign. The default for k is in both cases 1.

The specification of dynamic relationships only makes sense if there is an underlying ordering of the observations. Currently, lm offers only limited support for such data, hence a major aim of dynlm is to preserve time-series properties of the data. Explicit support is currently available for "ts" and "zoo" series. Internally, the data is kept as a "zoo" series and coerced back to "ts" if the original dependent variable was of that class (and not internal NAs were created by the na.action).

jtillman
  • 339
  • 1
  • 3
  • Thank you so much. But my question was between dynlm and dlm not lm. – Eric Nov 04 '17 at 14:26
  • Do you mind if you could explain the difference in mathematical expression between dynlm and dlm not lm please? – Eric Nov 04 '17 at 17:14
  • 1
    No problem. I’m at a bulls game now, so give me a few hours. – jtillman Nov 04 '17 at 23:38
  • Ok no problem. See you soon. – Eric Nov 05 '17 at 09:03
  • How was your bulls game? – Eric Nov 06 '17 at 00:10
  • 1
    Not bad. But I’m personally running examples of dynlm and dlm in r and I’m not seeing any differences here other than functionality and forgiveness on 0s in the equation. I’ll keep going and let you know if i see anything mathematically different but so far not really. I’m going to edit my answer to give you that math expression when I get back to my own computer – jtillman Nov 06 '17 at 02:30
  • Thank you so much for your ongoing help. – Eric Nov 06 '17 at 07:29