# Toulo-useR!

## Three parts to this talk

1. On the ForecastComb package
2. Other things combinations
3. How the ForecastComb came to be

# Part 1 The ForecastComb package

## Forecast Combinations in our Context

• What is it: $f^{combined} = \frac{\sum_{i = 1}^P f_i }{P}$
• Why is it: Because it works
• And why is that: More research is needed
• Intuition: Biases and Model risk

## Data preparation

train.obs <- electricity[1:84, 6]
train.pred <- electricity[1:84, 1:5]
test.obs <- electricity[85:123, 6]
test.pred <- electricity[85:123, 1:5]

input_data <- foreccomb(train.obs, train.pred,
test.obs, test.pred)

## Individual performance

indi_perf <- matrix(nrow = 5, ncol = 2)
colnames(indi_perf) <- c("Train", "Test")
rownames(indi_perf) <- input_data$modelnames for (i in 1:5){ indi_perf[i, 1] <- RMSE(train.pred[,i], train.obs) indi_perf[i, 2] <- RMSE(test.pred[,i], test.obs) } Train Test arima 1.24 0.99 ets 1.17 0.87 nnet 1.27 0.98 dampedt 1.18 0.92 dotm 1.04 0.77 “…combining multiple forecasts leads to increased forecast accuracy. In many cases one can make dramatic performance improvements by simply averaging the forecasts.” (source: Forecasting: Principles and Practice. Rob J Hyndman and George Athanasopoulos) ## OLS combination $y_t = {\alpha} + \sum_{i = 1}^P {\beta_i} f_{i,t} +\varepsilon_t.$ The combined forecast is then given by: $f^{comb} = \widehat{\alpha} + \sum_{i = 1}^P \widehat{\beta}_i f_i.$ ## Simple combination Does not outperform the best model: Train Test arima 1.24 0.99 ets 1.17 0.87 nnet 1.27 0.98 dampedt 1.18 0.92 dotm 1.04 0.77 # Simple Average SA <- comb_SA(input_data) as.data.frame(names(SA)) > names(SA) > 1 Method > 2 Models > 3 Fitted > 4 Accuracy_Train > 5 Input_Data > 6 Weights > 7 Forecasts_Test > 8 Accuracy_Test formatC(SA$Accuracy_Test[,"RMSE"]/1000)
>  "0.7823"

## OLS combination

Indeed outperforms the best model:

Train Test
arima 1.24 0.99
ets 1.17 0.87
nnet 1.27 0.98
dampedt 1.18 0.92
dotm 1.04 0.77

# OLS combination
OLSA <- comb_OLS(input_data)