yth_glm.Rd
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 |
... | all arguments passed to the function |
yth_glm
returns a generalized linear model object of class glm
,
which inherits from lm
.
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} = \beta_0 + \beta_1 y_t + \beta_2 y_{t-1} + \beta_3 y_{t-2} + \beta_4 y_{t-3} + v_{t+h}$$ $$\hat{v}_{t+h} = y_{t+h} - \hat{\beta}_0 + \hat{\beta}_1 y_t + \hat{\beta}_2 y_{t-1} + \hat{\beta}_3 y_{t-2} + \hat{\beta}_4 y_{t-3}$$ Which can be rewritten as: $$y_{t} = \beta_0 + \beta_1 y_{t-8} + \beta_2 y_{t-9} + \beta_3 y_{t-10} + \beta_4 y_{t-11} + v_{t}$$ $$\hat{v}_{t} = y_{t} - \hat{\beta}_0 + \hat{\beta}_1 y_{t-8} + \hat{\beta}_2 y_{t-9} + \hat{\beta}_3 y_{t-10} + \hat{\beta}_4 y_{t-11}$$
James D. Hamilton. Why You Should Never Use the Hodrick-Prescott Filter. NBER Working Paper No. 23429, Issued in May 2017.
#> #> Call: #> stats::glm(formula = formula, family = ..1, data = data) #> #> Deviance Residuals: #> Min 1Q Median 3Q Max #> -1190.8 -158.8 34.0 170.7 594.3 #> #> Coefficients: #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) 178.41673 33.91736 5.260 2.89e-07 *** #> xt_0 1.67144 0.27413 6.097 3.62e-09 *** #> xt_1 -0.43146 0.44670 -0.966 0.335 #> xt_2 -0.22220 0.44680 -0.497 0.619 #> xt_3 0.01173 0.27554 0.043 0.966 #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> (Dispersion parameter for gaussian family taken to be 77394.31) #> #> Null deviance: 7233021580 on 280 degrees of freedom #> Residual deviance: 21360829 on 276 degrees of freedom #> (11 observations deleted due to missingness) #> AIC: 3967.5 #> #> Number of Fisher Scoring iterations: 2 #>plot(gdp_model)