imapa | R Documentation |
MAPA for intermittent demand data with automatic model selection based on the PK classification.
imapa(data,h=10,w=NULL,minimumAL=1,maximumAL=NULL,comb=c("mean","median"), init.opt=c(TRUE,FALSE),paral=c(0,1,2),outplot=c(0,1,2,3,4),model.fit=NULL, na.rm=c(FALSE,TRUE))
data |
Intermittent demand time series. |
h |
Forecast horizon. |
w |
Smoothing parameters. If w == NULL then parameters are optimised. If w is w single parameter then the same is used for smoothing both the demand and the intervals. If two parameters are provided then the second is used to smooth the intervals. SES is always optimised. |
minimumAL |
Lowest aggregation level to use. Default = 1. |
maximumAL |
Highest aggregation level to use. Default = maximum interval. |
comb |
Combination operator. One of "mean" or "median". Default is "mean". |
init.opt |
If init.opt==TRUE then Croston and SBA initial values are optimised. |
paral |
Use parallel processing. 0 = no; 1 = yes (requires initialised cluster); 2 = yes and initialise cluster. Default is 0. |
outplot |
Optional plot: 0 = No plot; 1 = Time series and combined forecast; 2 = Time series and all aggregation level forecasts; 3 = Summary model selection plot; 4 = Detailed model selection plot. |
model.fit |
Optional input with model types and parameters. This is the model.fit output from this function. If used it overrides other model settings. |
na.rm |
A logical value indicating whether NA values should be remove using the method. |
frc.in |
In-sample demand rate. |
frc.out |
Out-of-sample demand rate. |
summary |
An array containing information for each aggregation level: AL - Aggregation level; n - Number of observations of aggregated series; p - Average inter-demand interval; cv2 - Coefficient of variation squared of non-zero demand; model - Selected model, where 1 is Croston, 2 is SBA and 3 is SES; use - If == 0 then this aggregation level is ignored because it contains less than 4 observations. |
model.fit |
Parameters and initialisation values of fitted model in each aggregation level. |
Note on optimal model paramaters: This implementation of MAPA for intermittent demand data optimises smoothing parameters for all Croston's method, SBA and SES. Optimisation is based on:
N. Kourentzes, 2014, On intermittent demand model optimisation and selection, International Journal of Production Economics, 156: 180-190. doi: 10.1016/j.ijpe.2014.06.007.
Note on parallelisation: Option paral=2 incurs substantial overheads. For a single time series using no parallelisation seems to be as good. If imapa is to be applied on multiple series, then initialising the parallel cluster externally and using the option paral=1 is advised.
Nikolaos Kourentzes
Optimisation of the methods described in: F. Petropoulos and N. Kourentzes, 2015, Forecast Combinations for Intermittent Demand, Journal of Operational Research Society. https://link.springer.com/article/10.1057/jors.2014.62.
https://kourentzes.com/forecasting/2014/05/13/forecast-combinations-for-intermittent-demand/
tsb
, sexsm
, crost
, idclass
.
imapa(ts.data1,outplot=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.