mapacalc {MAPA}R Documentation

MAPA Internal Calculation of Forecasts

Description

The following function produces a simple MAPA forecast from a given origin. This is meant to be an internal function. Use mapafor instead.

Usage

mapacalc(y, mapafit, fh = 0, comb = c("w.mean","w.median","mean","median","wght"), 
         outplot = c(0,1,2), hybrid = c(TRUE,FALSE), xreg=NULL)

Arguments

y

In sample observations of a time series (vector).

mapafit

Fitted MAPA model (from mapaest).

fh

Forecast horizon. Default = ppy.

comb

Combination operator. This can be: "mean"; "median"; "wght" - where each aggregation level is weighted inversly to aggregation; "w.mean" - level and trend components are averaged, but seasonal and xreg follow the wght combination; "w.median" - as w.mean, but with median. It is suggested that for data with high sampling frequency to use one of the "w.mean" and "w.median".

outplot

Provide output plot. 0 = no; 1 = time series and forecast only; 2 = time series, forecasts and components. For the components the spectral colouring scheme is used. Dark red is aggregation level 1. Default is 1.

hybrid

Provide hybrid forecasts, as in Kourentzes et al. paper. If minimumAL > 1 then the minimumAL ETS forecasts are used. Default is TRUE.

xreg

Vector or matrix of exogenous variables to be included in the MAPA. If matrix then rows are observations and columns are variables. Must be at least as long as in-sample plus fh. Additional observations are unused.

Value

forecasts

Vector with forecasts.

components

Array with MAPA components.

Author(s)

Nikolaos Kourentzes, nikolaos@kourentzes.com; Fotios Petropoulos.

References

See Also

mapafor, mapa.

Examples

mapafit <- mapaest(admissions,outplot=0)
mapacalc(admissions,mapafit,outplot=2)

[Package MAPA version 2.0.7 Index]