Skip to content

FilterResult

@dataclass(frozen=True)
class FilterResult()

Stores filter outputs and relevant descriptors of state/observable variables.

Fields:

Name Type Description
x_pred ndarray Predicted \(x\) states over time.
x_filt ndarray Filtered \(x\) states over time.
P_pred ndarray Predicted state covariance \(P\) over time.
P_filt ndarray Filtered state covariance \(P\) over time.
y_pred ndarray Predicted observables over time.
y_filt ndarray Filtered observables over time.
innov ndarray Observable innovations \(y_t - y_{t\mid t-1}\).
S ndarray Innovation covariance over time.
eps_hat ndarray \| None Conditional estimates of structural shocks given observed data (present when return_shocks=True).
loglik float log likelihood (\(\boldsymbol{\ell}\)) of measurements.
Predicted Outputs

FilterResult uses the *_pred convention to mark predicted outputs. Strictly speaking, predictions are not a "filter" output but a calculation step where time (or index) \(t+1\) is predicted by transition structure encoded. The most DSGE adjacent example of this is x_pred which is simply a one-step prediction of \(x\) using the state transition matrix \(A\):

\[ x_{t+1} = A \times x_t \]

Stochastic terms and their covariances come into calculations through \(P\) (and implicitly through \(\lbrace Q, B \rbrace\)), ignore the lack of the standard \(B\) matrix in this display.

Filtered Outputs

Filtered outputs use the *_filt convention in FilterResult. These outputs are generated by removing model-implied observation noise from predicted outputs. Matrices that introduce or explain uncertainty (\(\lbrace S, R, C\rbrace\) for example) are used to derive the correctly dampened (or "filtered") innovation terms to previously deterministic prediction outputs. Carrying on with the \(x\) matrix example from above, we can define x_filt as:

\[ \hat{x}_{t\mid t} = x_{t\mid t-1} + K_t \times v_t \]

Where \(K_t\) (kalman gain) is the dampening factor calculated at time \(t\) and \(v_t\) are innovations calculated. Therefore, in very simplistic terms, \(K\) defines how much of the residual between predicted/observed \(y\) are inferred to be noise/measurement error.