FcCrostonIntermittentDemand: Forecasting with Croston Intermittent Demand

View source: R/FcCrostonIntermittentDemand.R

FcCrostonIntermittentDemandR Documentation

Forecasting with Croston Intermittent Demand

Description

The Croston model answers the question How much demand will we have on average per period? This function CrostonIntermittentDemand returns forecasts and other information for Croston's forecasts.

Usage

FcCrostonIntermittentDemand(DataVec, Time,

ForecastHorizon,SplitAt,

Frequency = "days", ModelType = "sbj", 

PlotIt = FALSE, ...)

Arguments

DataVec

[1:n] numerical vector time series data.

Time

[1:n] [1:n] character vector of Time in the length of data

Frequency

either days, weeks, months or quarters or years

ForecastHorizon

Scalar defining the timesteps to forecast ahead, has to be set.

SplitAt

Index of row where the DataVec is divided into test and train data. If not given n is used

ModelType

Croston's method variant: 1. "croston" Croston's method; 2. "sba" Syntetos-Boylan approximation; 3. "sbj" Shale-Boylan-Johnston, see crost.

PlotIt

FALSE (default), do nothing. TRUE: plots the result.

...

Further optional parameters for crost

Details

The Croston method is suitable if demand appears at random, with many or even most time periods having no demand; where demand does occur, the historical data is randomly distributed, independently or almost independently of the demand interval. Such demand patterns are known as "lumpy demand" or intermittent, irregular, random or sporadic demand. The approach is based on Croston's (1972) method for intermittent demand forecasting, also described in Shenstone and Hyndman (2005).

Croston's method involves using simple exponential smoothing (SES) on the non-zero elements of the time series and a separate application of SES to the times between non-zero elements of the time series. The smoothing parameters of the two applications of SES are assumed to be equal and are denoted by alpha. Optimisation of the types of croston methods is described in [Kourentzes, 2014].

Value

List with

Forecast

[1:ForecastHorizon] numeric vector, forecast for test set times

Model

Output of crost

TrainingSet

[1:ForecastHorizon] Trainingset

TestSet

[ForecastHorizon+1:n] TestSet

Author(s)

Michael Thrun

References

Croston, J. (1972) "Forecasting and stock control for intermittent demands", Operational Research Quarterly, 23(3), 289-303.

Shenstone, L., and Hyndman, R.J. (2005) "Stochastic models underlying Croston's method for intermittent demand forecasting". Journal of Forecasting, 24, 389-402.

N. Kourentzes, 2014, On intermittent demand model optimisation and selection, International Journal of Production Economics, 156: 180-190. http://dx.doi.org/10.1016/j.ijpe.2014.06.007.

See Also

crost,ConvertNumerical2TSobject

Examples

data(Sales)
#set arbitrary dates
y=seq(from=as.Date('1970-01-01'),by='days',to=as.Date('1970-04-01'))[1:length(Sales)]
out=FcCrostonIntermittentDemand(Sales,y,Frequency = 'days',ForecastHorizon = 12,SplitAt=49,PlotIt = TRUE)
plot(out$TestSet,main='Plotting Testset Evaluation',xlab='Time',ylab='Sales')
points(time(out$TestSet),out$Forecast)

Mthrun/TSAT documentation built on Feb. 5, 2024, 11:15 p.m.