# crost.ma: Moving average with Croston's method decomposition In tsintermittent: Intermittent Time Series Forecasting

 crost.ma R Documentation

## Moving average with Croston's method decomposition

### Description

Moving average with Croston's method decomposition for intermittent demand series with fixed or optimised parameters.

### Usage

```crost.ma(data,h=10,w=NULL,nop=c(2,1),type=c("croston","sba","sbj"),
cost=c("mar","msr","mae","mse"),outplot=c(FALSE,TRUE),
na.rm=c(FALSE,TRUE))
```

### Arguments

 `data` Intermittent demand time series. `h` Forecast horizon. `w` Moving average order. If w == NULL then moving average orders are optimised. If w is a single value then the same order is used for smoothing both the demand and the intervals. If two values are provided then the second is used to smooth the intervals. `nop` Specifies the number of model parameters. Used only if they are optimised. 1. 1 - Demand and interval moving average order are the same; 2. 2 - Different demand and interval orders. `type` Croston's method variant: 1. "croston" Croston's method; 2. "sba" Syntetos-Boylan approximation; 3. "sbj" Shale-Boylan-Johnston. `cost` Cost function used for optimisation: 1. "mar" - Mean Absolute Rate; 2. "msr" - Mean Squared Rate; 3. "mae" - Mean Absolute Error; 4. "mse" - Mean Squared Error. `outplot` If TRUE a plot of the forecast is provided. `na.rm` A logical value indicating whether NA values should be remove using the method.

### Value

 `model` Type of model fitted. `frc.in` In-sample demand rate. `frc.out` Out-of-sample demand rate. `order` Moving averages orders for demand and interval. `component` List of c.in and c.out containing the non-zero demand and interval vectors for in- and out-of-sample respectively. Third element is the coefficient used to scale demand rate for sba and sbj.

### Author(s)

Nikolaos Kourentzes

### References

Optimisation cost functions described in: 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.

`crost`, `tsb`, `sexsm`.
```crost.ma(ts.data1,outplot=TRUE)