Package ForecastCombinations

Similar documents
Package ForecastComb

Package BayesNI. February 19, 2015

Package GeomComb. November 27, 2016

Package ltsbase. R topics documented: February 20, 2015

Package severity. February 20, 2015

Package ARCensReg. September 11, 2016

Forecast combinations in R using the ForecastCombinations package A Manual. 1. Introduction

Package flexcwm. R topics documented: July 2, Type Package. Title Flexible Cluster-Weighted Modeling. Version 1.1.

Introduction to Statistical modeling: handout for Math 489/583

Package BNN. February 2, 2018

Package MultisiteMediation

Package ForwardSearch

Forecasting. A lecture on forecasting.

Package flexcwm. R topics documented: July 11, Type Package. Title Flexible Cluster-Weighted Modeling. Version 1.0.

Forecasting. Bernt Arne Ødegaard. 16 August 2018

Package riv. R topics documented: May 24, Title Robust Instrumental Variables Estimator. Version Date

Package basad. November 20, 2017

Package nardl. R topics documented: May 7, Type Package

Package invgamma. May 7, 2017

Package gtheory. October 30, 2016

Package leiv. R topics documented: February 20, Version Type Package

Package esreg. August 22, 2017

Package factorqr. R topics documented: February 19, 2015

Package EMVS. April 24, 2018

DYNAMIC ECONOMETRIC MODELS Vol. 9 Nicolaus Copernicus University Toruń Mariola Piłatowska Nicolaus Copernicus University in Toruń

Package SimSCRPiecewise

Package TSF. July 15, 2017

Testing methodology. It often the case that we try to determine the form of the model on the basis of data

Package effectfusion

Package rgabriel. February 20, 2015

Package TSPred. April 5, 2017

Package TimeSeries.OBeu

Package tspi. August 7, 2017

Package dominanceanalysis

Package IsingFit. September 7, 2016

Econometric Forecasting

Package CPE. R topics documented: February 19, 2015

A Short Introduction to Curve Fitting and Regression by Brad Morantz

Package drgee. November 8, 2016

Package thief. R topics documented: January 24, Version 0.3 Title Temporal Hierarchical Forecasting

Brief Sketch of Solutions: Tutorial 3. 3) unit root tests

Package EnergyOnlineCPM

STATISTICS 110/201 PRACTICE FINAL EXAM

LECTURE 11. Introduction to Econometrics. Autocorrelation

Package depth.plot. December 20, 2015

Section 2 NABE ASTEF 65

Package SK. May 16, 2018

Package covtest. R topics documented:

Package ProDenICA. February 19, 2015

Regression: Main Ideas Setting: Quantitative outcome with a quantitative explanatory variable. Example, cont.

Topic 4 Unit Roots. Gerald P. Dwyer. February Clemson University

Final Review. Yang Feng. Yang Feng (Columbia University) Final Review 1 / 58

Package MicroMacroMultilevel

Bristol Business School

Package goftest. R topics documented: April 3, Type Package

36-309/749 Experimental Design for Behavioral and Social Sciences. Sep. 22, 2015 Lecture 4: Linear Regression

Regression I: Mean Squared Error and Measuring Quality of Fit

The Role of "Leads" in the Dynamic Title of Cointegrating Regression Models. Author(s) Hayakawa, Kazuhiko; Kurozumi, Eiji

Package BootPR. February 19, 2015

ISyE 691 Data mining and analytics

Package robustrao. August 14, 2017

Summary of OLS Results - Model Variables

Package multdm. May 18, 2018

Forecasting the unemployment rate when the forecast loss function is asymmetric. Jing Tian

Package weightquant. R topics documented: December 30, Type Package

Package wnl. April 2, 2018

Package blme. August 29, 2016

Package NlinTS. September 10, 2018

Package epr. November 16, 2017

Package IUPS. February 19, 2015

Variable Selection in Predictive Regressions

Package Metrics. November 3, 2017

Can a subset of forecasters beat the simple average in the SPF?

Package sym.arma. September 30, 2018

The Multiple Regression Model Estimation

Package mar. R topics documented: February 20, Title Multivariate AutoRegressive analysis Version Author S. M. Barbosa

On Autoregressive Order Selection Criteria

Do we need Experts for Time Series Forecasting?

Package ICGOR. January 13, 2017

Bristol Business School

Dimension Reduction Methods

Econometric Forecasting Overview

Quantitative Analysis of Financial Markets. Summary of Part II. Key Concepts & Formulas. Christopher Ting. November 11, 2017

Package darts. February 19, 2015

Package gma. September 19, 2017

Automatic Forecasting

Package REGARMA. R topics documented: October 1, Type Package. Title Regularized estimation of Lasso, adaptive lasso, elastic net and REGARMA

Package milineage. October 20, 2017

Variable Selection in Restricted Linear Regression Models. Y. Tuaç 1 and O. Arslan 1

Outline. Mixed models in R using the lme4 package Part 3: Longitudinal data. Sleep deprivation data. Simple longitudinal data

Model Selection. Frank Wood. December 10, 2009

Week 5 Quantitative Analysis of Financial Markets Modeling and Forecasting Trend

Multiple Regression Analysis

Package metafuse. October 17, 2016

Package SpatialVS. R topics documented: November 10, Title Spatial Variable Selection Version 1.1

Testing and Model Selection

Package sodavis. May 13, 2018

Exercises (in progress) Applied Econometrics Part 1

Package Tcomp. June 6, 2018

Departamento de Economía Universidad de Chile

Transcription:

Type Package Title Forecast Combinations Version 1.1 Date 2015-11-22 Author Eran Raviv Package ForecastCombinations Maintainer Eran Raviv <eeraviv@gmail.com> November 23, 2015 Description Aim: Supports the most frequently used methods to combine forecasts. Among others: Simple average, Ordinary Least Squares, Least Absolute Deviation, Constrained Least Squares, Variance-based, Best Individual model, Complete subset regressions and Information-theoretic (information criteria based). Depends quantreg, quadprog, utils Suggests MASS License GPL-2 NeedsCompilation no Repository CRAN Date/Publication 2015-11-23 12:20:30 R topics documented: Forecast_comb....................................... 1 Forecast_comb_all..................................... 3 Index 6 Forecast_comb Forecasts combination using regression, robust regression, constrained regression or variance based 1

2 Forecast_comb Description Combine different forecasts. Use simple average, Ordinary Least Squares (OLS), robust regression, inverse mean squared error (IMSE), constrained least squares (CLS), or simply use the best forecast based on the MSE metric. Usage Forecast_comb(obs, fhat, fhat_new= NULL, Averaging_scheme= c("simple", "ols", "robust", "cls", "variance based", "best") ) Arguments obs fhat Details Value Observed series fhat Matrix of available forecasts. These are used to retrieve the weights. How each forecast should be weighted in the overall combined forecast. fhat_new Matrix of available forecasts as a test set. Optional, default to NULL. Averaging_scheme Which averaging scheme should be used? Performs simple forecast averaging where each forecast carries equal weight: 1 p with p the column dimension of fhat. OLS forecast combination is based on obs t = const + p w i ôbs it + e t, where obs is the observed values and ôbs is the forecast, one out of the p forecasts available. i=1 Robust regression performs the same, but minimize different loss function, which is less sensitive to outliers (see quantile regression and references therein). Constrained least squares minimize the sum of squared errors under the restriction that the weights sum up to 1, and that the forecasts themselves are unbiased (no intercept in the regression). The variance-based method computes the mean squared error and weigh the forecasts according to their accuracy. Accurate forecasts (based on MSE metric) receive relatively more weight. The best restric all the weights to zero apart from the best forecast, again based on the MSE. Essentially selecting only one forecast to be used. Forecast_comb returns a list that contains the following objects: fitted pred weights Vector of fitted values. Vector of prediction. This object is empty if there was no test matrix fhat_new provided. Vector of weights based on the Averaging_scheme.

Forecast_comb_all 3 Author(s) Eran Raviv (<eeraviv@gmail.com>) References Bates, J. M., Granger, C.W. (1969), The combination of forecasts, Operations Research Quarterly, 20(4), 451-468 Clemen, R.T. (1989) Combining forecasts: A review and annotated bibliography. International Journal of Forecasting 5, 559-583. Koenker, R. (2005) Quantile Regression. Cambridge University Press. Timmermann, A.G. (2006) Forecast combinations. In: Elliott, G., Granger, C.W., Timmermann, A. (Eds.), Handbook of Economic Forecasting, Elsevier, 135-196. Examples library(mass) tt <- NROW(Boston)/2 TT <- NROW(Boston) y <- Boston[1:tt, 14] # dependent variable is columns number 14 # Create two sets of explanatory variables x1 <- Boston[1:tt, 1:6] # The first 6 explanatories x2 <- Boston[1:tt, 7:13]# The last 6 explanatories #create two forecasts based on the two different x1 and x2 coef1 <- lm(y~as.matrix(x1))$coef coef2 <- lm(y~as.matrix(x2))$coef f1 <- t(coef1 %*% t(cbind(rep(1,tt), Boston[(tt+1):TT, 1:6] ))) f2 <- t(coef2 %*% t(cbind(rep(1,tt), Boston[(tt+1):TT, 7:13] ))) ff <- cbind(f1, f2) scheme=c("simple", "ols", "robust", "variance based", "cls", "best") example0 <- list() for ( i in scheme) { example0[[i]] <- Forecast_comb(obs = Boston[(tt+1):TT, 14], fhat = ff, Averaging_scheme = i) cat(i, ":", sqrt(mean((example0[[i]]$fitted - Boston[(tt+1):TT, 14] )^2)), "\n" ) } # Compare with apply(ff, 2, function(x) { sqrt(mean((x - Boston[(tt+1):TT, 14])^2)) } ) Forecast_comb_all All posible combinations forecast averaging

4 Forecast_comb_all Description Combine different forecasts using complete subset regressions. Apart from the simple averaging, weights based on information criteria (AIC, corrected AIC, Hannan Quinn and BIC) or based on the Mallow criterion are also available. Usage Forecast_comb_all(obs, fhat, fhat_new = NULL) Arguments obs fhat fhat_new Observed series. fhat Matrix of available forecasts. Matrix of available forecasts as a test set. Optional, default to NULL. Details OLS forecast combination is based on obs t = const + p w i ôbs it + e t, where obs is the observed values and ôbs is the forecast, one out of the p forecasts available. i=1 The function computes the complete subset regressions. So a matrix of forecasts based on all possible subsets of fhat is returned. Those forecasts can later be cross-sectionally averaged to create a single combined forecast. Additional weight-vectors which are based on different information criteria are also returned. This is in case the user would like to perform the frequensit version of forecast averaging or based on the Mallows criterion (see references for more details). Although the function is geared towards forecast averaging, it can be used in any other application as a generic complete subset regression. Value Forecast_comb_all returns a list that contains the following objects: pred Vector of fitted values if fhat_new is not NULL or the vector of predictions if fhat_new is provided. full_model_crit List. The values of information criteria computed based on a full model, the one which includes all available forecasts. aic aicc A vector of weights for all possible forecast combinations based on the Akaike s information criterion. A vector of weights for all possible forecast combinations based on the corrected Akaike s information criterion.

Forecast_comb_all 5 bic hq mal A vector of weights for all possible forecast combinations based on the Bayesian s information criterion. A vector of weights for all possible forecast combinations based on the Hannan Quinn s information criterion. A vector of weights for all possible forecast combinations based on the Mallow s information criterion. Author(s) Eran Raviv (<eeraviv@gmail.com>) References Hansen, B. (2008) Least-squares forecast averaging. Journal of Econometrics, Vol. 146, No. 2., pp. 342-350 Kapetanios, G., Labhard V., Price, S. Forecasting Using Bayesian and Information-Theoretic Model Averaging. Journal of Business & Economic Statistics, Vol. 26, Iss. 1, 2008 Koenker R. (2005) Quantile Regression. Cambridge University Press. Graham, E., Garganob, A., Timmermann, A. (2013) Complete subset regressions. Journal of Econometrics. Vol 177, 2, pp. 357-373. Examples library(mass) tt <- NROW(Boston)/2 TT <- NROW(Boston) y <- Boston[1:tt, 14] # dependent variable is columns number 14 # Create two sets of explanatory variables x1 <- Boston[1:tt, 1:6] # The first 6 explanatories x2 <- Boston[1:tt, 7:13]# The last 6 explanatories # create two forecasts based on the two different x1 and x2 coef1 <- lm(y ~ as.matrix(x1))$coef coef2 <- lm(y ~ as.matrix(x2))$coef f1 <- t(coef1 %*% t(cbind(rep(1,tt), Boston[(tt+1):TT, 1:6] ))) f2 <- t(coef2 %*% t(cbind(rep(1,tt), Boston[(tt+1):TT, 7:13] ))) ff <- cbind(f1,f2) comb_all <- Forecast_comb_all(obs = Boston[(tt+1):TT, 14], fhat = ff) # To get the combined forecasts from the all subset regression: Combined_forecast <- apply(comb_all$pred, 1, mean) # To get the combined forecasts based on aic criteria for example: Combined_forecast_aic <- t(comb_all$aic %*% t(comb_all$pred))

Index Forecast_comb, 1 Forecast_comb_all, 3 6