library(fpp2)
## Warning: package 'fpp2' was built under R version 3.6.1
## Loading required package: ggplot2
## Registered S3 methods overwritten by 'ggplot2':
##   method         from 
##   [.quosures     rlang
##   c.quosures     rlang
##   print.quosures rlang
## Loading required package: forecast
## Warning: package 'forecast' was built under R version 3.6.1
## Registered S3 method overwritten by 'xts':
##   method     from
##   as.zoo.xts zoo
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
## Registered S3 methods overwritten by 'forecast':
##   method             from    
##   fitted.fracdiff    fracdiff
##   residuals.fracdiff fracdiff
## Loading required package: fma
## Warning: package 'fma' was built under R version 3.6.1
## Loading required package: expsmooth
## Warning: package 'expsmooth' was built under R version 3.6.1

Often data comes in the form of counts. For example, we may wish to forecast the number of customers who enter a store each day. We could have 0,1,2 customers, but we cannot not have 3.14159 customer

If the number is large say 100, 101 then you can use previous methods. However if the data contains small counts (0,1,2) the we need to use forecasting methods that are more appropriate for a sample space of non-negative integers.

With Croston’s method, we construct two new series from our original time series by noting which time periods contain zero values(a), and which periods contain non-zero values(q).Croston’s method involves separate simple exponential smoothing forecasts on the two new series and . Because the method is usually applied to time series of demand for items, q is often called the “demand” and a is called the “inter-arrival time”

productC
##   Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
## 1   0   2   0   1   0  11   0   0   0   0   2   0
## 2   6   3   0   0   0   0   0   7   0   0   0   0
## 3   0   0   0   3   1   0   0   1   0   1   0   0

Several years ago, we assisted an oil company with forecasts of monthly lubricant sales. One of the time series is shown in the table below. The data contain small counts, with many months registering no sales at all, and only small numbers of items sold in other months. Lets apply Croston method on it

productC %>% croston() %>% autoplot()