MAPAx available for R & new MAPA package on CRAN

By | November 17, 2016

The previous version of the MAPA package implemented only the univariate aspect of the algorithm. Version 2.0.1 implements MAPAx as well, which allows incorporating regressors in your forecasts. In this paper we demonstrated the usefulness of temporal aggregation in the case of forecasting demand in the presence of promotions. In particular, we showed that MAPAx substantially outperformed regression promotions models (of this type), as well as exponential smoothing with promotional information (see Fig. 1).

mapax_res

Fig. 1. Bias and accuracy results for heavily promoted items. Description and details of the case study and experiment can be found here.

To use MAPAx call the usual mapa functions with the addition of the argument xreg. You can also control whether the regressors are transformed using principal components or not, using the argument pr.comp.  By default no transformation is performed. Note that MAPAx can only be used when type="es". It is recommended that when the regressors are related to high-frequency information, such as promotions, to use the combination options (argument comb): w.mean or w.median that weight high-frequency seasonality and xreg states more heavily.

The following example illustrates the strength of MAPAx when additional information is available. We model the demand of a promoted product with conventional MAPA and MAPAx. Fig. 2 provides the in-sample rolling forecasts and the out-of-sample forecast for 13 weeks.

mapax

Fig. 2. MAPA and MAPAx forecasts for the demand of a promoted product.

Observe that MAPAx models the past and future promotions and also provides tighter prediction intervals, since more information in the past sales is captured.

The stable version of the package with MAPAx is 2.0.1 and is available on CRAN. The development version, which includes the latest bugfixes, can be found on GitHub, where I also provide the versions available at both CRAN and GitHub so you can check whether you have the latest version or not. MAPAx, similar to high-frequency MAPA, requires the smooth package. Make sure you have the latest version of that as well!

6 thoughts on “MAPAx available for R & new MAPA package on CRAN

  1. Forecaster

    Excellent package and method. MAPAx would be very helpful for solving real world industry problems. I would like to know if MAPAx can handle decay effect /carryover effect that we typically see in promotional modeling in time series? Transfer function modelling can easily incorporate it.

    Reply
    1. Nikos Post author

      The way that dynamic promotion effects can be easily incorporated in MAPAx is by adding leads and lags to the promotional events, much like with conventional regression modelling. Some dynamics are internal, depending on the underlying exponential smoothing model that is identified. Let me also add here that it may make a lot of sense to first log-transform your demand series to be able to model mnultiplicative promotional effects.
      The existing code does not allow for transfer function modelling of promotions, though in principle it would be quite easy to do so. If you would like to try temporal hierarchies and transfer functions right away, you may want to take a look at the thief package, which implements this working paper.

      Reply
  2. Rohan Singh

    I have a doubt. What if my data is at week level and I am passing a predictor variable. But when temporal aggregation is being done will it aggregate predictor variable also?
    In one of my case, the predictor variable weekly number aggregation to month/quarter/year will give the wrong number. Is there a way that we can provide week, month and quarter number separately for the same predictor variable?
    Sorry if it’s a silly question 🙂

    Reply
    1. Nikos Post author

      It will do what you described. It will aggregate the predictor variable as well. But why would the umber be wrong? Can you describe a bit more the case you have in mind? Thakns, Nikos

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *