Title: | Data from the M-Competitions |
---|---|
Description: | The 1001 time series from the M-competition (Makridakis et al. 1982) <DOI:10.1002/for.3980010202> and the 3003 time series from the IJF-M3 competition (Makridakis and Hibon, 2000) <DOI:10.1016/S0169-2070(00)00057-1>. |
Authors: | Rob Hyndman [aut, cre, cph] , Muhammad Akram [ctb], Christoph Bergmeir [ctb] , Mitchell O'Hara-Wild [ctb], Yangzhuoran Fin Yang [ctb] |
Maintainer: | Rob Hyndman <[email protected]> |
License: | GPL-3 |
Version: | 2.9 |
Built: | 2024-12-28 06:46:06 UTC |
Source: | https://github.com/robjhyndman/Mcomp |
The 1001 time series from the M-competition (Makridakis et al. 1982), and the 3003 time series and forecasts from the IJF-M3 competition (Makridakis and Hibon, 2000).
Rob J Hyndman. [email protected], with assistance from Muhammad Akram and Christoph Bergmeir.
http://forecasters.org/resources/time-series-data/m3-competition/.
Makridakis, S., A. Andersen, R. Carbone, R. Fildes, M. Hibon, R. Lewandowski, J. Newton, E. Parzen, and R. Winkler (1982) The accuracy of extrapolation (time series) methods: results of a forecasting competition. Journal of Forecasting, 1, 111–153.
Makridakis and Hibon (2000) The M3-competition: results, conclusions and implications. International Journal of Forecasting, 16, 451-476.
The time series from the M1 forecasting competition.
M1
M1
M1 is a list of 1001 series of class Mcomp
.
Each series within M1
is of class Mdata
with the following structure:
Name of the series
Series number and period. For example "Y1" denotes first yearly series, "Q20" denotes 20th quarterly series and so on.
The number of observations in the time series
The number of required forecasts
Interval of the time series. Possible values are "YEARLY", "QUARTERLY", "MONTHLY" & "OTHER".
The type of series. Possible values are "DEMOGR", "INDUST", "MACRO1", "MACRO2", "MICRO1", "MICRO2" & "MICRO3".
A short description of the time series
A time series of length n
(the historical data)
A time series of length h
(the future data)
Muhammad Akram and Rob Hyndman
http://forecasters.org/resources/time-series-data/m-competition/.
Makridakis, S., A. Andersen, R. Carbone, R. Fildes, M. Hibon, R. Lewandowski, J. Newton, E. Parzen, and R. Winkler (1982) The accuracy of extrapolation (time series) methods: results of a forecasting competition. Journal of Forecasting, 1, 111–153.
M1 plot(M1$YAF2) subset(M1,"monthly")
M1 plot(M1$YAF2) subset(M1,"monthly")
The time series from the M3 forecasting competition.
M3
M3
M3 is a list of 3003 series of class Mcomp
. Each series within M3
is
of class Mdata
with the following structure:
Name of the series
Series number and period. For example "Y1" denotes first yearly series, "Q20" denotes 20th quarterly series and so on.
The number of observations in the time series
The number of required forecasts
Interval of the time series. Possible values are "YEARLY", "QUARTERLY", "MONTHLY" & "OTHER".
The type of series. Possible values for M3 are "DEMOGRAPHIC", "FINANCE", "INDUSTRY", "MACRO", "MICRO", "OTHER".
A short description of the time series
A time series of length n
(the historical data)
A time series of length h
(the future data)
Muhammad Akram and Rob Hyndman
http://forecasters.org/resources/time-series-data/m3-competition/.
Makridakis and Hibon (2000) The M3-competition: results, conclusions and implications. International Journal of Forecasting, 16, 451-476.
M3 plot(M3[[32]]) subset(M3,"monthly")
M3 plot(M3[[32]]) subset(M3,"monthly")
The forecasts from all the original participating methods in the M3 forecasting competition.
M3Forecast
M3Forecast
M3Forecast is a list of data.frames. Each list element is the result of one forecasting method. The data.frame then has the following structure: Each row is the forecast of one series. Rows are named accordingly. In total there are 18 columns, i.e., 18 forecasts. If fewer forecasts than 18 exist, the row is filled up with NA values.
Christoph Bergmeir and Rob Hyndman
http://forecasters.org/resources/time-series-data/m3-competition/.
Makridakis and Hibon (2000) The M3-competition: results, conclusions and implications. International Journal of Forecasting, 16, 451-476.
M3Forecast[["NAIVE2"]][1,] ## Not run: # calculate errors using the accuracy function # from the forecast package errors <- lapply(M3Forecast, function(f) { res <- NULL for(x in 1:length(M3)) { curr_f <- unlist(f[x,]) if(any(!is.na(curr_f))) { curr_res <- accuracy(curr_f, M3[[x]]$xx) } else { # if no results are available create NA results curr_res <- accuracy(M3[[x]]$xx, M3[[x]]$xx) curr_res <- rep(NA, length(curr_res)) } res <- rbind(res, curr_res) } rownames(res) <- NULL res }) ind_yearly <- which(unlist(lapply(M3, function(x) {x$period == "YEARLY"}))) ind_quarterly <- which(unlist(lapply(M3, function(x) {x$period == "QUARTERLY"}))) ind_monthly <- which(unlist(lapply(M3, function(x) {x$period == "MONTHLY"}))) ind_other <- which(unlist(lapply(M3, function(x) {x$period == "OTHER"}))) yearly_errors <- t(as.data.frame(lapply(errors, function(x) {colMeans(x[ind_yearly,])}))) quarterly_errors <- t(as.data.frame(lapply(errors, function(x) {colMeans(x[ind_quarterly,])}))) monthly_errors <- t(as.data.frame(lapply(errors, function(x) {colMeans(x[ind_monthly,])}))) other_errors <- t(as.data.frame(lapply(errors, function(x) {colMeans(x[ind_other,])}))) yearly_errors quarterly_errors monthly_errors other_errors ## End(Not run)
M3Forecast[["NAIVE2"]][1,] ## Not run: # calculate errors using the accuracy function # from the forecast package errors <- lapply(M3Forecast, function(f) { res <- NULL for(x in 1:length(M3)) { curr_f <- unlist(f[x,]) if(any(!is.na(curr_f))) { curr_res <- accuracy(curr_f, M3[[x]]$xx) } else { # if no results are available create NA results curr_res <- accuracy(M3[[x]]$xx, M3[[x]]$xx) curr_res <- rep(NA, length(curr_res)) } res <- rbind(res, curr_res) } rownames(res) <- NULL res }) ind_yearly <- which(unlist(lapply(M3, function(x) {x$period == "YEARLY"}))) ind_quarterly <- which(unlist(lapply(M3, function(x) {x$period == "QUARTERLY"}))) ind_monthly <- which(unlist(lapply(M3, function(x) {x$period == "MONTHLY"}))) ind_other <- which(unlist(lapply(M3, function(x) {x$period == "OTHER"}))) yearly_errors <- t(as.data.frame(lapply(errors, function(x) {colMeans(x[ind_yearly,])}))) quarterly_errors <- t(as.data.frame(lapply(errors, function(x) {colMeans(x[ind_quarterly,])}))) monthly_errors <- t(as.data.frame(lapply(errors, function(x) {colMeans(x[ind_monthly,])}))) other_errors <- t(as.data.frame(lapply(errors, function(x) {colMeans(x[ind_other,])}))) yearly_errors quarterly_errors monthly_errors other_errors ## End(Not run)
Functions to plot a time series from the M competition data sets, showing both the training and test sections of the series.
## S3 method for class 'Mdata' plot(x, xlim = c(tsp(x$x)[1], tsp(x$xx)[2]), ylim = range(x$x, x$xx), main = x$sn, xlab, ylab = "", ...) ## S3 method for class 'Mdata' autoplot(object, ...)
## S3 method for class 'Mdata' plot(x, xlim = c(tsp(x$x)[1], tsp(x$xx)[2]), ylim = range(x$x, x$xx), main = x$sn, xlab, ylab = "", ...) ## S3 method for class 'Mdata' autoplot(object, ...)
x , object
|
A series of M-competition data |
xlim |
Limits on x-axis |
ylim |
Limits on y-axis |
main |
Main title |
xlab |
Label on x-axis |
ylab |
Label on y-axis |
... |
Other plotting arguments passed to |
autoplot.Mdata
returns a ggplot2 object, while
plot.Mdata
returns nothing. Both functions produce a time series plot
of the selected series.
Rob Hyndman
library(ggplot2) plot(M1[[1]]) autoplot(M1$YAF3) autoplot(M3[["N0647"]])
library(ggplot2) plot(M1[[1]]) autoplot(M1$YAF3) autoplot(M3[["N0647"]])
subset.Mcomp
returns a subset of the time series data from the M
Competitions. Subsets can be for specific periods, or specific types of data
or both.
## S3 method for class 'Mcomp' subset(x, cond1, cond2, ...)
## S3 method for class 'Mcomp' subset(x, cond1, cond2, ...)
x |
M-competition data or a subset of M-competition data |
cond1 |
Type or period of the data. Type is a character variable and period could be character or numeric. |
cond2 |
Optional second condition specifying type or period of the
data, depending on |
... |
Other arguments. |
Possible values for cond1
and cond2
denoting period are 1, 4,
12, "yearly", "quarterly", "monthly" and "other".
If cond1
or cond2
equals 111, then the 111 series used in the
extended comparisons in the 1982 M-competition are selected.
Possible values for cond1
and cond2
denoting type are "macro",
"micro", "industry", "finance", "demographic", "allother", "macro1",
"macro2", "micro1", "micro2", "micro3". These correspond to the descriptions
used in the competitions. See the references for details.
Partial matching used for both conditions.
An object of class Mcomp
consisting of the selected series.
Muhammad Akram and Rob Hyndman
Makridakis, S., A. Andersen, R. Carbone, R. Fildes, M. Hibon, R. Lewandowski, J. Newton, E. Parzen, and R. Winkler (1982) The accuracy of extrapolation (time series) methods: results of a forecasting competition. Journal of Forecasting, 1, 111–153.
Makridakis and Hibon (2000) The M3-competition: results, conclusions and implications. International Journal of Forecasting, 16, 451-476.
M3.quarterly <- subset(M3,4) M1.yearly.industry <- subset(M1,1,"industry")
M3.quarterly <- subset(M3,4) M1.yearly.industry <- subset(M1,1,"industry")