Changelog
Source:NEWS.md
stochvolTMB 0.4.0
Breaking changes
- The skew-Gaussian models estimate the skewness instead of the shape
alpha. The fixed parameteralphais replaced bylogit_skewness.summary(report = "transformed")andcoef()report bothskewnessandalpha, andsim_sv()still takesalpha. -
residuals()uses the exact grid filter by default (method = "grid") and returns residuals for all observations. Usemethod = "tmb"forTMB::oneStepPredict. -
demo()is deprecated. Userun_shiny_demo().
New features and fixes
New
var_es()calculates the one-day Value at Risk and Expected Shortfall from the exact one-step-ahead predictive distribution, for every observation and for the next day after the data. It uses the same filter on a grid asresiduals().New
backtest_var()backtests the Value at Risk with the unconditional coverage test of Kupiec (1995), the independence test of Christoffersen (1998) and their combination, and reports the ratio of the realized losses to the Expected Shortfall on the exceedances.New
forecast_var_es()simulates Value at Risk and Expected Shortfall for several days ahead, for the daily and the cumulative returns.New
plot_var()plots the returns with the Value at Risk and Expected Shortfall and marks the exceedances.New
compare_models()fits several models and ranks them by AIC. It also reports if the optimizer converged and if the Hessian is positive definite, and it keeps the fitted models.predict()for theleveragemodel now uses the last observed return for the first volatility shock, as for the skew models with leverage. Before, the first predicted volatility ignored the correlation with the last return.New model
skew_gaussian_leveragethat combines skew-Gaussian returns with the leverage effect. The skew-Gaussian return shock drives the volatility shock,eta_t = rho * z_t + sqrt(1 - rho^2) * e_t. This order keeps the Laplace approximation accurate. The other order (skew noise added torho * eta_t) made the approximation overestimate the likelihood, and the fit diverged torho = -1and|alpha| -> Inf.The skew-Gaussian models now estimate the skewness instead of the shape
alpha. The fixed parameteralphais replaced bylogit_skewness, and the skewness is bounded by|skewness| < 0.99(|alpha| <= 27).summary(report = "transformed")reports bothskewnessandalpha. Before, the optimizer started atalpha = 0, where the likelihood is flat (the score is exactly zero), and the fit often stayed atalpha = 0.The skew-Gaussian density now uses a numerically stable
log(pnorm(x))instead oflog(1e-5 + pnorm(x)).New model
skew_t: the skew t distribution of Jones and Faddy (2003), standardized to mean zero and unit variance, with separate degrees of freedom for the left and the right tail (df_left,df_right). Supported byestimate_parameters(),sim_sv(),predict(),residuals()andplot_returns().New model
skew_t_leverage: the skew t return shock drives the volatility shock, as inskew_gaussian_leverage. It estimatesdf_left,df_rightandrho. On the S&P 500 data it has the smallest AIC of all models, and its one-step-ahead residuals have a straight Q-Q plot.residuals(method = "tmb")is not available for this model.The degrees of freedom of the
tandskew_tmodels are capped at 10,000. For larger values thelgammadifferences in the density lost all precision, and the fit of thetmodel could run todf = 1e14with a meaningless likelihood. At 10,000 degrees of freedom the distribution is gaussian for all practical purposes.New
plot_returns()plots the returns with the central interval of the fitted conditional distribution and marks the returns outside it.New
plot_diagnostics()plots a Q-Q plot and the autocorrelation of the one-step-ahead residuals and of the squared residuals.residuals()has a new default method,method = "grid". It calculates the one-step-ahead residuals exactly with a filter on a grid for the log-volatility, for all observations in a few seconds. The old method,TMB::oneStepPredictwith the Laplace approximation, takes one to three seconds per observation and is available withmethod = "tmb". Withmethod = "grid",residuals()returns residuals for all observations by default.residuals(method = "tmb")no longer fails with “Multiple TMB models loaded” when several TMB models are loaded, for example afterdevtools::load_all(). It then calculates the residuals without parallel processing.residuals()is now an S3 method,residuals.stochvolTMB(). Before, the package exported a plainresiduals()function that hidstats::residuals(), so for exampleresiduals(lm(...))failed when stochvolTMB was attached. Calls of the formresiduals(fit)do not change.New
coef()andvcov()methods. By default they return the parameters on their natural scale (for examplesigma_y,phiandrho) and their covariance matrix. Usescale = "estimation"for the parameters on the scale they were estimated.The shiny demo is now started with
run_shiny_demo().demo()without arguments still runs it, with a deprecation warning. With arguments,demo()callsutils::demo(), sodemo(topic)works again when stochvolTMB is attached.Plots use
linewidthinstead of the deprecatedsizefor lines.ggplot2(>= 3.4.0) is required.
stochvolTMB 0.2.0
CRAN release: 2021-08-13
- Added
predictfunction that makes it possible to simulate future volatility and log-returns. -
plothas a newforecastargument that makes it possible to include forecasted volatility. - The degrees of freedom for the
tmodel is estimated on log scale and shifted by 2 so that it is guaranteed to be greater than 2. This is to ensure that the variance is finite. - Changed parameter names from
phi_logitandrho_logittologit_phiandlogit_rhoto be consistent with other parameter names. - Updated README.
- Updated documentation.