Extracts structural shocks from reduced-form residuals using the Kalman
filter formula. Given the impact matrix Psi and the covariance matrices
of residuals on event and control days, the function recovers the latent
shocks for each observation. Optionally rescales shocks to unit variance.
Usage
kfpredict(Sig, SigR, Psi, et, tol = sqrt(.Machine$double.eps), scale = TRUE)Arguments
- Sig
Numeric matrix (N x N). Covariance matrix of reduced-form residuals on policy event days (e.g.
etfromhetiv()).- SigR
Numeric matrix (N x N). Covariance matrix of reduced-form residuals on control (non-event) days. Used to back out the implied shock variances when
scale = TRUE.- Psi
Numeric matrix (N x E). Impact matrix, i.e. the contemporaneous responses of all N variables to the E structural shocks (e.g.
Psifromhetiv()).- et
Numeric matrix or data frame (T x N). Reduced-form residuals on event days (e.g.
etfromhetiv()). Rows correspond to time periods, columns to variables.- tol
Numeric scalar. Tolerance for the generalized inverse (
MASS::ginv()). Clipped from below atsqrt(.Machine$double.eps).- scale
Logical. If
TRUE(default), shocks are rescaled to unit variance using the implied shock variances recovered fromSigandSigR. IfFALSE, the raw Kalman filter projection is returned.