mlarchf.Rd
Conformalized Forecasting using Machine Learning (and statistical) models with ARCH effects
mlarchf(
y,
h = 10L,
mean_model = forecast::auto.arima,
model_residuals = forecast::meanf,
fit_func = ahead::ridge,
predict_func = predict,
lags_vol = 10L,
type_pi = c("surrogate", "bootstrap", "kde"),
type_sim_conformalize = c("surrogate", "block-bootstrap", "bootstrap", "kde",
"fitdistr"),
ml_method = NULL,
level = 95,
B = 250L,
ml = TRUE,
stat_model = NULL,
n_clusters = 0,
clustering_dist = "euclidean",
clustering_method = "kmeans",
...
)
A numeric vector or time series of class ts
Forecasting horizon
Function to fit the mean model (default: forecast::auto.arima
)
Function to model the residuals (default: forecast::thetaf
)
Fitting function for the variance model (default: ahead::ridge
)
Prediction function for the variance model (default: predict
)
Number of lags for squared residuals regression
Type of prediction interval ("kde", "surrogate", or "bootstrap") for volatility modeling
Type of simulation for conformalization of standardized residuals ("block-bootstrap", "surrogate", "kde", "bootstrap", or "fitdistr")
caret package Machine learning method to use, if fit_func
and predict_func
aren't provided.
If NULL, uses fit_func
and predict_func
. See unique(caret::modelLookup()$model)
.
Confidence level for prediction intervals
Number of bootstrap replications or simulations
If TRUE
, fit_func
and predict_func
are used, otherwise a statistical model in stat_model
A statistical model, e.g forecast::thetaf
or forecast::auto.arima
Number of clusters for residuals (default is 0) for ml == TRUE
and ml_method
not NULL
Only if n_clusters > 0
. If "euclidean", then mean square error, if "manhattan ", the mean absolute error is used.
Only if n_clusters > 0
. If "kmeans", then we have the kmeans clustering method, if "hardcl" we have the On-line Update (Hard Competitive learning) method, and if "neuralgas", we have the Neural Gas (Soft Competitive learning) method. Abbreviations of the method names are accepted.
Additional parameters to be passed to stat_model
A forecast object containing predictions and prediction intervals
y <- fpp2::goog200
# Default model for volatility (Ridge regression for volatility)
(obj_ridge <- ahead::mlarchf(y, h=20L, B=500L))
#> Point Forecast Lo 95 Hi 95
#> 201 533.4806 512.7812 549.9381
#> 202 534.7064 515.7697 552.1797
#> 203 538.8649 484.1721 616.3803
#> 204 536.1930 523.4435 551.1034
#> 205 536.8055 520.5741 556.1976
#> 206 537.5393 520.6689 553.1701
#> 207 537.6365 524.3945 548.4499
#> 208 537.4759 511.4850 552.1990
#> 209 539.1986 522.4345 551.1335
#> 210 539.4604 519.2788 557.4779
#> 211 540.2246 514.9235 557.3380
#> 212 542.1635 527.1610 558.9331
#> 213 542.3887 518.5475 567.8483
#> 214 543.2326 524.3450 559.1676
#> 215 543.8326 519.7481 563.2478
#> 216 544.5939 522.5941 563.2784
#> 217 544.6853 533.4650 554.1662
#> 218 547.5403 518.1748 587.8554
#> 219 546.7615 517.4711 571.0961
#> 220 547.3477 528.1812 567.5666
plot(obj_ridge)