hp_gain() gives the gain of the estimate at every time \(t\) as a function of the frequency
(Hanif et al. 2017, eq. 6, Figures 2 and 2b): the factor by which the filter scales an oscillation of that
frequency. In the middle of a series the gain of the trend falls to zero at high frequencies; at the ends it does
not, so the trend there keeps part of the cycle.
Arguments
- x
the length \(T\) of a series, or a result of
hp_filter(),mhp_filter()orfmhp_filter()(withas_dt = FALSE).- lambda
a smoothing parameter, or one per observation (
form = "rows") or per second difference (form = "differences"); ignored for a result.- form
"rows"(default) or"differences"; seefmhp_filter().- theta
the frequencies (default 101 values from 0 to \(\pi\)).
- rows
the rows drawn by
plot()(default: the first, third, two middle and last two odd ones, as in the paper's figures).
Value
An object of class c("mhp_gain", "mhp_result", "list"): gain (a data.table with
t, theta, gain for every time and frequency), lambda_t, form, rows.
plot() draws the gains of the chosen rows.
Details
With \(b_{tj}\) the weights of hp_weights(), \(P_t(\omega) = |\sum_j b_{tj}
e^{i\omega(j - t)}|\). It is computed from two solves of the
smoothing system per frequency.
Author
Muhammad Yaseen (myaseen208@gmail.com)
