maeforecast: Economic Forecasting with High-Dimensional Data

Description Usage Arguments Details Value Note See Also

Description

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.

Usage

 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)

Arguments

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 maeforecast(model="ar") is equivalent to maeforecast.ar() and so on. See Details for the full list of supported models.

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, w_size should be set to be 72.

window

character, indicating the forecasting scheme to be applied. Options include "recursive", "rolling", and "fixed".

y.index

numeric, indicating the column position of the time series for which the forecasts are made (Y). Defualt is 1.

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 alpha's to use in aenet.

factor.num

numeric, indicating the number of dynamic factors to be extracted from the covariates in the Dynamic Factor Model. Default is 3.

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 TRUE.

ntree

numeric, number of trees to grow. Default is 500.

replace

logical, indicating whether sampling of cases should be done with replacement. Default is TRUE.

method

character, indicating which method should be used to extract dynamic factors. If "aggregation", the covariate time series are first clustered based on partitional method, and a simple aggreagtion is applied to each cluster. If "two-step", one factor is extracted within each cluster based on Doz, Giannone & Reichlin (2011).

lambda, lambda.ridge, lambda.lasso

optional user-supplied lambda sequence; default is NULL, and the function glmnet chooses its own sequence.

h

forecasting horizon. Default is 0.

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.select number of them with the highest test statistics will be included in the machine learning algorithms. Note that the forecasting horizon h is considered.

t.update

logical, indicating wheter the preselection process should be repeated in evert iteration, if t.select is specified. Under the defualt FALSE, the preselection process will be implemented only with for the first window.

Details

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.

Value

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.

Note

These functions have individual help pages available. To check them, call help(maeforecast.model_name) or ?maeforecast.model_name.

See Also

maeforecast.rw, maeforecast.ar, maeforecast.lasso, maeforecast.postlasso, maeforecast.ridge, maeforecast.alasso, maeforecast.postalasso, maeforecast.rf, maeforecast.postnet, maeforecast.dfm, maeforecast.dfm2


google-trends-v1/gtm documentation built on June 5, 2019, 5:13 p.m.