Remark: There’s now a button for copying the code chunks. It’s useful; I needed it.

This post is a sequel of Beyond ARMA-GARCH: leveraging model-agnostic Machine Learning and conformal prediction for nonparametric probabilistic stock forecasting (ML-ARCH) and Python version of Beyond ARMA-GARCH: leveraging model-agnostic Quasi-Randomized networks and conformal prediction for nonparametric probabilistic stock forecasting (ML-ARCH).

The novelty in this post is that: you can use any statistical model (meaning Theta, ARIMA, exponential smoothing, etc.) for volatility forecasting. It will be adapted to the Python version (previous link) in the next few days. Remember that the models used below are not tuned, and that you need to tune them to reduce the forecasting uncertainty.

Installing the package

options(repos = c(
                techtonique = "https://r-packages.techtonique.net",
                CRAN = "https://cloud.r-project.org"
            ))            

install.packages("ahead")

Theta

# Default model for volatility (Ridge regression for volatility)
(obj_ridge <- ahead::mlarchf(fpp2::goog200, h=20L, B=500L, ml=FALSE, stat_model=forecast::thetaf))
plot(obj_ridge)

image-title-here

Mean forecast

(obj_ridge <- ahead::mlarchf(fpp2::goog200, h=20L, B=500L, ml=FALSE, stat_model=forecast::meanf))
plot(obj_ridge)

image-title-here

Auto ARIMA

(obj_ridge <- ahead::mlarchf(fpp2::goog200, h=20L, B=500L, ml=FALSE, stat_model=forecast::auto.arima))
plot(obj_ridge)

image-title-here

Exponential smoothing

(obj_ridge <- ahead::mlarchf(fpp2::goog200, h=20L, B=500L, ml=FALSE, stat_model=forecast::ets))
plot(obj_ridge)

image-title-here

Comments powered by Talkyard.