Here is the link: https://github.com/trnnick/mapa

It has been a long time I wanted to rework the MAPA package for R, but I could not find the time. Finally I got around starting it. There are three objectives in this:

- Clean up code and introduce S3methods. MAPA was the first package that I wrote!
- Incorporate the
`es`

exponential smoothing implementation from the`smooth`

package. This is an alternative to`ets`

that will remain as the default. It allows longer seasonal cycles and some additional customisation in the specification of the exponential smoothing models. - Implement MAPAx that permits introducting exogenous variables to MAPA.

Tidying up the code is an ever-ongoing process, so (1) will never finish! I have already sorted (2) out and the next task is to work on (3). You can grab the development version on GitHub. At the time of writing you will need the development version of `smooth`

for this to work, on which Ivan has been ironing out a few peculiar bugs that MAPA brought to surface. You will be amazed how much temporal aggregation can mess up otherwise stable code!

Here is a sneak peak of things you could not do with MAPA before:

mapafit <- mapaest(taylor,ppy=336,type="es") plot(mapafit)

The new argument is `type="es"`

that lets MAPA know what exponential smoothing implementation to use. Once the estimation is done we can use this to forecast as usual.

mapacalc(taylor,mapafit,comb="wght",outplot=2)

So finally we can now easily use MAPA for series with seasonality more than 24 periods! You may have observed that I am using a different combination of the temporal aggregation states: `wght`

. This is still experimental, so use it at your own risk! I would still recommend using either `median`

or `mean`

.

Another nice feature that the `es`

implementation offers is more flexibility in specifying models. Before we could use the `model="ZZZ"`

to let `ets`

select the best model for each aggregation level. Now we can use the letters `X`

and `Y`

to restrict the search to only additive orĀ multiplicative options (including `N`

) respectively. So for example we could set `model="ZXA"`

to have MAPA look for exponential smoothing models with any type of error, trend that can be none, additive or damped additive and additive seasonality.

Which of `ets`

or `es`

is most accurate to use with MAPA? This is a difficult question to answer. In different examples I tried, I got different results, but there are a few things I can point out. `ets`

from the `forecast`

package by default does not allow multiplicative trends. This was done as using only additive trends seems to work better for `ets`

. This is not the case for `es`

that considers all possible trends. In the current MAPA implementation you can use the argument `allow.multiplicative.trend=TRUE`

to make `ets`

consider all trends. Similarly, with `es`

you can use `model="ZXZ"`

to restrict it to additive trends. On the M3 dataset, once the specification is identical (only additive trends) `es`

based MAPA performs about 5% worse than `ets`

based MAPA, which is fairly small difference, with no evidence of statistically significant differences. So my recommendation is as follows: MAPA with `ets`

works fine and is the default core, but if the additional flexibility of `es`

is needed, feel confident in using it!