knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.align = "center", fig.width = 5, fig.height = 3, echo = TRUE ) library(knitr)
The R package Mcomp contains the 1001 time series from the M-competition (Makridakis et al. 1982), the 3003 time series from the IJF-M3 competition (Makridakis and Hibon, 2000), and the forecasts contributed to the IJF-M3 competition. See also the tscompdata package for data from other forecasting competitions.
The M1 forecasting competition was organized by Spyros Makridakis and Michèle Hibon, involving 1001 series. In this competition, anyone could submit forecasts, making this the first true forecasting competition as far as I am aware. They also used multiple forecast measures to determine the most accurate method.
The 1001 time series were taken from demography, industry and economics, and ranged in length between 9 and 132 observations. All the data were either non-seasonal (e.g., annual), quarterly or monthly. Curiously, all the data were positive, which made it possibly to compute mean absolute percentage errors, but was not really reflective of the population of real data.
The M1 competition data are stored as M1
.
library(Mcomp)
M1
Functions are provided to plot and manage the date. The plot.Mdata()
and autoplot.Mdata()
functions plot a time series, showing both the training and test sections of the series.
plot(M1[[1]]) autoplot(M1[[1]])
subset.Mcomp()
returns a subset of the time series data; subsets can be for specific periods, or specific types of data or both.
subset(M1, "monthly") subset(M1, "macro1") subset(M1, "macro1", "monthly")
The 111 series used in the extended comparisons in the 1982 M-competition can also be selected.
subset(M1, 111)
M1
is of class Mcomp
which is a list, where each element is also a list containing information about one time series. For example, the first element contains the following information.
str(M1[[1]])
The various items are as follows:
st
: the series number and period. For example Y1
denotes the first yearly series, Q20
denotes the 20th quarterly series, and so on;n
: the number of observations in the training part of the time series;h
: the number of required forecasts (equivalently the number of observations in the test part of the time series);period
: interval of the time series. Possible values are YEARLY
, QUARTERLY
, MONTHLY
& OTHER
.type
: the type of series. Possible values are DEMOGR
, INDUST
, MACRO1
, MACRO2
, MICRO1
, MICRO2
& MICRO3
.description
: a short description of the time series;x
: the training part of the time series of length n
;xx
: the test part of the time series of length h
.sn
: name of the series;In 1998, Makridakis & Hibon ran their M3 competition. Entrants had to forecast 3003 time series and the results were compared to a test set that was withheld from participants. The time series were all taken from business, demography, finance and economics, and ranging in length between 14 and 126 observations. Again, the data were all either non-seasonal (e.g., annual), quarterly or monthly, and all were positive.
The time series from the M3 forecasting competition and the forecasts from all the original participating methods are stored in M3
and M3Forecast
respectively. plot.Mdata()
, autoplot.Mdata()
and subset.Mcomp()
work on M3
as well. The structure of M3
is the same as for M1
.
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. Each column corresponds to a forecast horizon. There are 18 columns, as the maximum number of forecasts for any series is 18. If fewer forecasts than 18 exist, the row is padded with NA
values.
M3 autoplot(M3[[1]]) subset(M3, "macro")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.