Description Usage Arguments Details Value Note See Also
This function calculates one-step-ahead point forecasts with recursive, rolling or fixed windows in a data-rich environment. Supported machine learning algorithms include Lasso, Ridge, Adaptive Lasso, Adaptive Elastic Net, as well as AR(1) model as a potential benchmark. Dynamic factor models, Regression Trees and Random Forest algorithms are also supported. Out-of-sample forecasts are returned alongside mean squred errors and success ratios.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | maeforecast(data, model="ar", w_size, window="recursive", y.index=1,
h=0, ...)
maeforecast.ar(data, w_size, window="recursive", y.index=1, h=0)
maeforecast.rw(data, w_size, windoe="recursive", y.index=1, h=0)
maeforecast.lasso(data, w_size, window="recursive", y.index=1,
standardize=TRUE, lambda, h=0, t.select, t.update=F)
maeforecast.postlasso(data, w_size, window="recursive", y.index=1,
standardize=TRUE, lambda, h=0, t.select, t.update=F)
maeforecast.ridge(data, w_size, window="recursive", y.index=1,
standardize=TRUE, lambda, h=0, t.select, t.update=F)
maeforecast.alasso(data, w_size, window="recursive", y.index=1,
standardize=TRUE, lambda.ridge, lambda.lasso, h=0,
t.select, t.update=F)
maeforecast.postalasso(data, w_size, window="recursive", y.index=1,
standardize=TRUE, lambda.ridge, lambda.lasso, h=0,
t.select, t.update=F)
maeforecast.postnet(data, w_size, window="recursive", pred, y.index=1,
standardize=TRUE, h=0, t.select, t.update=F,
alphas=c(0.2, 0.8, 0.02))
maeforecast.rf(data, w_size, window="recursive", ntree=500, y.index=1,
replace=TRUE, h=0, t.select, t.update=F)
maeforecast.dfm(data, w_size, window="recursive", y.index=1,
factor.num, h=0, t.select, t.update=F)
maeforecast.dfm2(data, w_size, window="recursive", y.index=1,
factor.num=3, method="two-step", clustor.type="partitional",
h=0, t.select, t.update=F)
|
data |
a data frame or a matrix containing the time series for which the forecasts are made as well as predictors. |
model |
character, indicating which model should be used to make the forecasts. Default is an AR(1) model. Note that |
w_size |
numeric, indicating the index where the forecasting should begin. If the first point forecast should be made at the 73th observation, for example, |
window |
character, indicating the forecasting scheme to be applied. Options include |
y.index |
numeric, indicating the column position of the time series for which the forecasts are made (Y). Defualt is |
pred |
numeric, indicating the number of predicators being considered in the Adaptive Elastic Net model. Default is set to be equal to the number of observations. |
alphas |
vector of candidate |
factor.num |
numeric, indicating the number of dynamic factors to be extracted from the covariates in the Dynamic Factor Model. Default is |
standardize |
logical, indicating whether the data matrix should be scaled before the model is fitting, for the use of variable selection/shrinkage models. Default is |
ntree |
numeric, number of trees to grow. Default is |
replace |
logical, indicating whether sampling of cases should be done with replacement. Default is |
method |
character, indicating which method should be used to extract dynamic factors. If |
lambda, lambda.ridge, lambda.lasso |
optional user-supplied lambda sequence; default is NULL, and the function |
h |
forecasting horizon. Default is |
t.select |
number of covariates to be included. If omitted, every covariate will be included. Otherwise, a regression between the dependant variable, its lag and each covariate will be run and a statistical test will be applied for the significance of the covariate's coefficient. The covariates will then be ranked based on their test statistics, and |
t.update |
logical, indicating wheter the preselection process should be repeated in evert iteration, if |
Supported models include "ar"
, "rw"
(Random Walk), "lasso"
, "postlasso"
(Post-Lasso), "ridge"
, "alasso"
(Adaptive Lasso), "postalasso"
(Post-AdaptiveLasso), "postnet"
(Post-Adaptive ElasticNet), "rf"
(Random Forests), "dfm"
& "dfm2"
(Dynamic Factor Models).
For shrinkage models, the penalty factor lambda is selected automatically by 10-fold cross-validation.
Forecasts |
data matrix, containing the point forecasts, realized values, forecast errors, signs of the forecasts and realized values, and success in predicting the signs. |
MSE |
numeric, mean squred error of the point forecasts. |
SRatio |
numeric, success ratio of the point forecasts. Success is claimed when the point forecasts and realized values have the same sign. |
Data |
the data as used in the model. |
Model |
some specifics about the model used. |
The following extra component is returned by shrinkage models:
Variables |
list, containing the predictors selected by the shrinkage model at every iteration. |
These functions have individual help pages available. To check them, call help(maeforecast.model_name)
or ?maeforecast.model_name
.
maeforecast.rw
, maeforecast.ar
, maeforecast.lasso
, maeforecast.postlasso
, maeforecast.ridge
, maeforecast.alasso
, maeforecast.postalasso
, maeforecast.rf
, maeforecast.postnet
, maeforecast.dfm
, maeforecast.dfm2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.