Calculate one-step-ahead (OSA) residuals for stochastic volatility model.
Source:R/residuals.R
residuals.stochvolTMB.RdThe OSA residual of observation y_t is qnorm(F_t(y_t)), where F_t is the predictive
distribution function of y_t given y_1, ..., y_{t-1} at the estimated parameters. If the model is
correct, the residuals are independent and standard gaussian.
Arguments
- object
A
stochvolTMBobject.- conditional
Index vector of observations that are not predicted. Residuals are returned for the other observations. If
NULL, the"grid"method returns residuals for all observations, and the"tmb"method uses1:(object$nobs - 100). Useinteger(0)to get all residuals with"tmb".- method
"grid"or"tmb". See details.- grid_size
Number of grid points for
h_tin the"grid"method.- ...
Currently not used.
Value
Vector of one-step-ahead residuals. If the model is correctly specified, these should be standard normal.
Details
Two methods are available:
"grid"(default): an exact filter on a grid for the log-volatilityh_t. Becauseh_tis one-dimensional, the predictive distribution can be calculated by summation over the grid, without the Laplace approximation. It calculates the residuals for all observations in a few seconds."tmb": oneStepPredict withmethod = "oneStepGeneric". It uses the Laplace approximation and takes about one to three seconds per observation, so by default only the last 100 observations are used. It is not available for the"skew_t_leverage"model, wherey_talso enters the model forh_{t+1}.
References
Thygesen, U. H., Albertsen, C. M., Berg, C. W., Kristensen, K. and Nielsen, A. (2017). Validation of ecological state space models using the Laplace approximation. Environmental and Ecological Statistics, 24(2), 317-339. doi:10.1007/s10651-017-0372-4