Replication material for: 'Factor-based forecasting in the presence of outliers: Are factors better selected and estimated by the median than the mean?'
This repository contains the material necessary to replicate the empirical application in: 'Factor-based forecasting in the presence of outliers: Are factors better selected and estimated by the median than the mean?' The code is a partial re-write of the code originally released with the paper. Since the original version of the code changes in the KFAS package has caused the code for the Kalman-filter-based benchmark model included in the paper to break. I have, therefore, not included that model here. However, the original code for the model can be found at the link above.
The forecastexp package is required for the estimation and the macrods package provides the data functions:
library('devtools')
install_github('johannestang/forecastexp')
install_github('johannestang/macrods')
In addition the following packages should be installed : pryr, and xtable, both available from CRAN.
Note: Total runtime is approximately 5 hours when using a 20 core machine (2 E5-2680 v2 CPUs @ 2.8 GHz).
- forecastapp.R estimates the models and produces all output.
- simple.R function for forecasting using simple means/medians.
- FRED.rda the dataset.