ml_forecast.RdForecasting using Machine Leaning models
ml_forecast(
y,
h,
level = 95,
lags = 1,
fit_func = ahead::ridge,
predict_func = predict,
xreg = NULL,
coeffs = NULL,
...
)A numeric vector or time series of class ts
Forecasting horizon
Confidence level for prediction intervals
Number of lags of the input time series considered in the regression
Fitting function (Statistical/ML model). Default is Ridge regression.
Prediction function (Statistical/ML model)
External regressor variable
Coefficients of the fitted model. If provided, a linear combination with the coefficients is used to compute the prediction.
additional parameters passed to the fitting function fit_func
An object of class 'forecast'
if (FALSE) { # \dontrun{
plot(ahead::ml_forecast(AirPassengers, h=20L))
plot(ahead::ml_forecast(AirPassengers, h=25L, lags=20L, fit_func=glmnet::cv.glmnet))
res <- ahead::ml_forecast(USAccDeaths, h=15L, lags=15L)
plot(res)
res <- ahead::ml_forecast(USAccDeaths, fit_func = glmnet::cv.glmnet, h=15L, lags=15L)
plot(res)
res <- ahead::ml_forecast(USAccDeaths, fit_func = e1071::svm, h=15L, lags=15L)
plot(res)
res <- ahead::ml_forecast(mdeaths, h=15L, lags=15L)
plot(res)
res <- ahead::ml_forecast(fdeaths, fit_func = glmnet::cv.glmnet, h=15L, lags=25L)
plot(res)
res <- ahead::ml_forecast(fdeaths, fit_func = randomForest::randomForest, h=15L, lags=15L)
plot(res)
} # }