如何计算Croston方法

时间:2016-04-11 18:07:03

标签: r forecasting intermittent

我试图了解“crost {tsintermittent}”和“croston {forecast}”如何计算样本内(训练)值的具体细节。他们似乎给出了相似但不同的结果。 (参见下面的示例代码)我不确定这两个计算是否不同,或者我没有比较相同的结果(每个包使用不同的术语)。

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")

1 个答案:

答案 0 :(得分:1)

一个使用优化参数,另一个不使用。 forecast::croston将两个ETS(A,N,N)模型拟合到非零需求序列和非零需求之间的时间,具有共同的平滑参数(alpha=0.1是默认值),并且状态设置为每个系列的第一个值。 tsintermittent::crost适合相同的两个模型,但优化了平滑参数和初始值的值(默认使用平均绝对率)。