auto_hpfj_fix {jumps} | R Documentation |
Automatic selection of the optimal HP filter with jumps and fixed smoothing constant
Description
The regularization constant for the HP filter with jumps is the
maximal sum of standard deviations for the level disturbance. This value
has to be passed to the hpfj_fix
function. The function auto_hpfj_fix
runs hpfj_fix
on a grid of regularization constants and returns the
output of hpfj_fix
according to the chosen information criterion.
Usage
auto_hpfj_fix(
y,
lambda,
grid = seq(0, sd(y) * 10, sd(y)/10),
ic = c("bic", "hq", "aic", "aicc"),
edf = TRUE
)
Arguments
y |
numeric vector cotaining the time series; |
lambda |
smoothing constant; |
grid |
numeric vector containing the grid for the argument |
ic |
string with information criterion for the choice: the default is "bic" (simulations show this is the best choice), but also "hq", "aic" and "aicc" are available; |
edf |
logical scalar: TRUE (default) if the number of degrees of freedom should be computed as "effective degrees of freedom" (Efron, 1986) as opposed to a more traditional way (although not supported by theory) when FALSE. |
Value
The ouput of the hpjf
function corresponding to the best
choice according to the selected information criterion.
Examples
mod <- auto_hpfj_fix(Nile, "annual")
plot(as.numeric(Nile))
lines(mod$smoothed_level)