I am trying to understand the specifics of how "crost {tsintermittent}" and "croston {forecast}" calculate the in-sample (training) values. They appear to give similar, but different results. (See sample code below) I am not sure if the two calculations are different, or am I not comparing the same results (each package uses different terminology).
library (tsintermittent)
library (forecast)
# create an intermittent time-series
x = c(5,5,5,5,5,5,6,8,0,8,0,8,0,0,4,0,0,6,7,0,0,0,9,0,11,0,0)
x_crost = crost(x,h=5) # from the tsintermittent package
x_croston=croston(x,h=5) # from the forecast package
x_croston$fitted
y=data.frame(x,x_crost$frc.in,x_croston$fitted)
y # viex_croston results
plot(x_croston)
lines(x_croston$fitted, col="red")
lines(x_crost$frc.in,col="blue")
One uses optimized parameters, the other does not. forecast::croston
fits two ETS(A,N,N) models to the non-zero demand series and the times between non-zero demands, with a common smoothing parameter (alpha=0.1
is the default), and initial states set to the first values of each series. tsintermittent::crost
fits the same two models, but optimizes the value of the smoothing parameter and the initial values (using Mean Absolute Rate by default).