Recently I posted about a paper I co-authored with Fotios Petropoulos, now in JORS: Forecast Combinations for Intermittent Demand. There we found that for intermittent demand data using multiple levels of temporal aggregation, forecasting them with the appropriate models and finally combining the forecasts performed best.

This approach has many analogies with the MAPA algorithm for non-intermittent time series. However, one difference between the original MAPA and its intermittent demand equivalent (let’s name it iMAPA for now) is that the former is fully automatic, while the latter was investigated with a-priori selected parameters for the intermittent demand methods (Croston and SBA). Therefore, although iMAPA outperformed the benchmarks, it was not fully automatic.

Recently, I published a paper on how to automatically select parameters for Croston’s method and its variants and put everything together in an R package to make it easily accessible to other researchers and practitioners. The apparent next step was to explore how automatic parameter specification worked with iMAPA and investigate whether this provided further improvements, as it was the case for Croston, SBA and TSB. In addition, following the original MAPA, I investigate the impact of the combination operator.

Using the same experimental setup as in the JORS paper the new results are as follows:

Method | Parameter | sMAE | |
---|---|---|---|

Croston | 0.10 | 1.770 | |

SBA | 0.10 | 1.724 | |

iMAPA (mean) | 0.10 | 1.696 | |

* | iMAPA (mean) | Optimal | 1.564 |

* | iMAPA (median) | Optimal | 1.482 |

The first three rows are taken from Table 2 in the paper. The last two rows refer to the new results (also highlighted with an *) for iMAPA with optimal parameters and mean or median combination of the temporally aggregated levels. We can observe interesting improvements for intermittent demand data, where methods typically perform similarly. When I get the chance I will look into the inventory implications in more detail.

The updated tsintermittent package for R includes the new function ‘imapa’ that was used to produce these results. To use it simply type:

> imapa(ts.data2,outplot=1)

The function accepts different arguments for the minimum and maximum temporal aggregation level, the combination method, a-priori selected model parameters or optimised and various visualisations of the results, such as the following example that summarises what model was selected in each aggregation level, using the PK classification:

Perhaps it is useful to note that if you select the same minimum and maximum temporal aggregation levels then iMAPA becomes similar to the ADIDA, albeit with automatic model selection and parameterisation, but constrained to using only Croston’s method, SBA or SES.

Hi Nikolaos,

I’m familiarizing myself with your packages, MAPA and tsintermittent. Do any of the functions provide Periods In Stock (PIS) or a variant, e.g. sAPIS?

Thank you,

Ryan

Hi Ryan,

I do not have any functions in the packages but here are two examples (provided by Fotios Petropoulos):

# H is forecasting horizon

# insample is a vector containing the actuals for the in-sample (training set)

# outsample is a vector containing the actuals for the out-of-sample, length of H

# fcs is a vector containing the forecasts, length of H

# Calculating PIS

PIS = 0

for (h in 1:H){

for (j in 1:h){

PIS = PIS + (fcs[j] - outsample[j])

}

}

PIS

# alternatively

PIS = 0

for (h in 1:H){

PIS = PIS + (fcs[h] - outsample[h])*(H+1-h)

}

PIS

# alternatively (and more optimal)

PIS = sum((fcs - outsample) * (H:1))

# Calculating sAPIS

sAPIS = abs(PIS) / mean(insample)

`# Calculating sAPIS in a single row:`

sAPIS = abs(sum((fcs - outsample) * (H:1))) / mean(insample)

Hope these help!

Nikos

Nikos,

Thank you so much for sharing your knowledge and replying so quickly. I believe I can use these examples, so thanks again and take care.

-Ryan

Hi Nikos,

I’m using your tsintermmitent package to predict intermittent spare parts demand for equipment at my company. The iMAPA and Croston’s methods work well, although I was wondering if there was a way to take the output $frc.out into a variable that I can combine into a forecasting table?

Specifically, I have 3,000+ parts that I am going to run different forecasting methods on monthly, and I want to combine all of the $frc.out’s into a table that lists monthly demand for each part by part number an month. I can make a table, just not sure of what to put before $frc.out?

Thanks for all your help and hard work!

Matt Coleman

Hi Matt,

I am planning to release an update for the package shortly that will permit producing forecasts for multiple SKUs easily, so the frc.out will in that case be a table. I think that is what you are looking for. Hopefully the update will be released end of next week (it is a bit busy at the university now!).

Thanks,

Nikos

Thanks Nikos, that is exactly what I’m looking for. I don’t want to run each part independently every month, so I’m hoping to bring in a dataset with dates and monthly demand and run iMAPA on the dataset. The output would be a table with forecasted demands for each SKU that I can then submit as a spare parts plan that my team can evaluate and modify.

I would love to know when you complete the update.

Thanks,

Matt

Hi Nikos,

Any idea when the package update will be complete? I was hoping to use it soon, but am just curious.

Thanks,

Matt

Hi Matt,

I have just submitted the new version (1.7) on CRAN, but it should take some hours before you it is available for download. I will write a post explaining the changes. The important one is a new function

`data.frc`

that can take a data.frame as input and output a data.frame with all forecasts with a single command.