Applies the fitted model parameters to a user-supplied out-of-sample dataset to compute predicted and filtered states and observations. Robust and classical inference procedures are supported depending on the class of the input model.
Arguments
- y_oos
A numeric matrix containing out-of-sample observations. Each row corresponds to a time point.
- model
A fitted model object of class
roams_SSM,classical_SSM,oracle_SSM,huber_robust_SSM, ortrimmed_robust_SSM.- build
A function that maps a numeric parameter vector to a corresponding
dlmmodel object. Thespecify_SSMfunction can be used to create thisbuildfunction.- outlier_locs
A logical or binary vector of the same length as
nrow(y), indicating time points to be treated as missing (i.e., time points that are known to be outliers). Used only withoracle_SSMmodels.- threshold
Mahalanobis distance threshold for detecting out-of-sample outliers in
roams_SSMmodels. Set toInfto recover the usual Kalman filter. Default issqrt(qchisq(0.99, ncol(y))).- multiplier
Multiplier for how quickly the filter grows its filtered state variance (uncertainty) after detecting an outlier in
roams_SSMmodels. It is the tuneable parameter \(b\) of the `fast-updating threshold' filter. Only works ifthresholdis notInf. Default is2.
Value
A named list containing out-of-sample inference results:
filtered_statesFiltered state estimates using out-of-sample data.
predicted_statesOne-step-ahead state predictions.
filtered_observationsExpected observations given past out-of-sample data.
predicted_observationsOne-step-ahead forecasts of observations.
filtered_states_varList of filtered state variance matrices.
predicted_states_varList of one-step-ahead state prediction variances.
predicted_observations_varList of one-step-ahead observation forecast variances.
mahalanobis_residualsVector of Mahalanobis distances of residuals from predicted observations.
outliers_flaggedVector of 1's and 0's indicating whether timepoints are flagged as outlying or not based on the
thresholdsupplied (only available ifmodelis of classroams_SSM).
Details
The function reuses the model's fitted parameters to generate inference on new data y_oos. Robust variants use appropriate robust filters, while the classical and oracle models use standard Kalman filtering. For oracle_SSM models, observations flagged in outlier_locs are treated as missing during filtering.
