hpfilterFS HP filter with missing/excluded observations via selection matrix.
Model interpretation (Gaussian).
$y=(y_1, y_2, \ldots, y_T)'$ is the observed time series. $y_bsb$ is a subset of units from $y$ of length $n_{bsb}$.
$Sy=y_{bsb} = Sm + S\epsilon$, $\epsilon \sim N(0, \sigma_\epsilon^2 I_{nbsb})$;
$D m = u$, $u \sim N(0, \sigma^2_\epsilon (1/\lambda) I_T)$.
HP ratio: $\lambda=\sigma^2_\epsilon/\sigma^2_u$, the greater $\lambda$, the smoother is the trend.
$D$ is the Second-difference matrix of size (T-2 x T):
each row has [1 -2 1].
$S$ is the selection matrix of size nbsb x T. Note that $SS'=I_{nbsb}$.
Conditioning on observed subset y_bsb = S y, using W = S'S (diag 0/1).
Posterior mean:
mhat = $\hat m= E(m|y_{bsb})=argmin_m ||S(y-m)||^2 + \lambda ||D m||^2$ = $(W + \lambda D'D) \ (W y)$.
Posterior cov:
$Cov(m|y_{bsb}) = \sigma^2_\epsilon (W + \lambda D'D)^{-1}$
Call to hpfilterFS with optional argument bsb.out
=hpfilterFS(y,
Name, Value)
Hutchinson, M. F. (1989), A stochastic estimator of the trace of the influence matrix for laplacian smoothing splines, "Communications in Statistics Simulation and Computation", Vol. 18, pp. 1059–1076.
Hodrick, R. J., & Prescott, E. C. (1997), Postwar U.S. Business Cycles:
An Empirical Investigation, "Journal of Money, Credit and Banking", Vol. 29, pp. 1–16.
Ravn, M. O., & Uhlig, H. (2002), On Adjusting the Hodrick–Prescott Filter for the Frequency of Observations, "Review of Economics and Statistics", Vol. 84, pp. 371–376.