yth_glm | R Documentation |
yth_glm
fits a generalized linear model suggested by James D. Hamilton
as a better alternative to the Hodrick-Prescott Filter.
yth_glm(x, h = 8, p = 4, ...)
x |
A univariate |
h |
An |
p |
An |
... |
Additional arguments passed to |
For time series of quarterly periodicity, Hamilton suggests parameters of
h = 8 and p = 4, or an AR(4)
process, additionally lagged by 8
lookahead periods. Econometricians may explore variations of h. However, p is
designed to correspond with the seasonality of a given periodicity and should
be matched accordingly.
yth_glm
returns a generalized linear model object of class
glm
, which inherits from lm
.
James D. Hamilton. Why You Should Never Use the Hodrick-Prescott Filter. NBER Working Paper No. 23429, Issued in May 2017.
glm
, lm
data(GDPC1)
gdp_model <- yth_glm(GDPC1, h = 8, p = 4, family = gaussian)
summary(gdp_model)
plot(gdp_model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.