为R中的auto.arima训练数据集

时间:2015-09-29 14:59:55

标签: r forecasting autoregressive-models

我有大约10000个时间序列。

我想使用auto.arima函数http://www.inside-r.org/packages/cran/forecast/docs/auto.arima

我想测试10000个时间序列的auto.arima模型的准确性。我拿走了20%的数据点(如果你看到40个中的样本我会推迟8)然后让auto.arima预测。 然后我可以将生成的8个值与实际的8个值进行比较 但是有没有正式的方法来测试ARIMA模型的准确性?我的方法是否正确?

y=auto.arima(x)
plot(forecast(y,h=8))

样品 时间序列1

0.0003748,0.0003929,0.0003653,0.0003557,0.0004463,0.000349,0.0003099,0.0003395,0.0003157,0.0002871,0.0002604,0.0002422,0.0001917,0.0002117,0.0002689

时间序列2

0.0003977,0.0003481,0.0002413,0.0002069,0.0002127,0.0002108,0.0002003,0.0002174,0.0002098,0.0002069,0.0001955,0.0001926,0.0002108,0.0002146,0.0002079

1 个答案:

答案 0 :(得分:0)

在我看来,您的Q就是用于比较预测准确度的不同指标,而不是auto.arima()forecast()的具体用途。如果是这样,那么可以使用许多指标。有关概述,请参阅

https://en.wikipedia.org/wiki/Forecasting#Forecasting_accuracy

他们每个人都有其支持者和批评者;例如,见本文:

http://robjhyndman.com/papers/mase.pdf

无论您使用何种准确度指标,您仍需要能够证明为什么要阻止20%的数据进行预测。

但是,如果您对不同的模型表单感兴趣,那么您也有一些选择。例如,正如评论中所建议的那样,

  1. 使用arima()(或某些等价物)为每个时间序列拟合相同的单变量模型(指定先验);
  2. 使用auto.arima()为每个时间序列拟合(可能)不同的单变量模型;或
  3. 将多变量模型拟合到所有时间序列。
  4. 如果您感兴趣的是#3,我建议MARSS pkg:

    https://cran.r-project.org/web/packages/MARSS/index.html

    和用户指南:

    https://cran.r-project.org/web/packages/MARSS/vignettes/UserGuide.pdf