Description Usage Arguments Details Value References See Also Examples
yth_glm
fits a generalized linear model suggested by James D. Hamilton as a better alternative to the Hodrick-Prescott Filter.
1 |
x |
A univariate |
h |
An |
p |
An |
... |
all arguments passed to the function |
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.
y_{t+h} = β_0 + β_1 y_t + β_2 y_{t-1} + β_3 y_{t-2} + β_4 y_{t-3} + v_{t+h}
\hat{v}_{t+h} = y_{t+h} - \hat{β}_0 + \hat{β}_1 y_t + \hat{β}_2 y_{t-1} + \hat{β}_3 y_{t-2} + \hat{β}_4 y_{t-3}
Which can be rewritten as:
y_{t} = β_0 + β_1 y_{t-8} + β_2 y_{t-9} + β_3 y_{t-10} + β_4 y_{t-11} + v_{t}
\hat{v}_{t} = y_{t} - \hat{β}_0 + \hat{β}_1 y_{t-8} + \hat{β}_2 y_{t-9} + \hat{β}_3 y_{t-10} + \hat{β}_4 y_{t-11}
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.
1 2 3 4 5 6 7 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.