R SARIMA公式

时间:2014-02-26 10:21:29

标签: r

我有以下时间序列:

11.17013 
11.01357 
11.07622 
10.94406 
10.85379 
10.85132 
10.98871 
10.90698
10.95082 
11.14337 
11.11942 
11.34594

11.59245 
11.92184 
11.70076 
11.17222 
11.09777 
11.15845 
11.08133 
11.01114
11.20582 
11.26133 
11.20473 
11.31534
11.11619

11.28496 
11.06365 
11.14072 
11.03030 
10.99462 
11.06409 
11.05991 
11.00035
11.14298 
11.08046 
11.34002

11.22166                                                               

我使用的是模型:

out2 = arima(churn2,order=c(1,0,2), seasonal = list(order = c(1, 0, 2), period = 12))
pred2 = predict(out2,24)

预测是:

11.28130 
11.32019 
11.05179 
10.99506 
11.01970 
11.05276 
10.99500
11.08980 
11.20155 
11.17485 
11.29250

11.40660 
11.43805 
11.35878 
11.09576 
11.03837 
11.08544 
11.07170 
11.01067
11.13355 
11.18949 
11.14058 
11.31216

11.28812        

使用:

enter image description here

我尝试了很多不同的公式,但我从未得到预测结果。

预测使用的公式是什么?我们能否从原始时间序列中精确计算预测值?

1 个答案:

答案 0 :(得分:2)

在R中使用包forecast。您可以使用fitted获取预测值,并使用forecast进行预测! 这是一个例子:

> library(forecast)
> fit.1<-Arima(USAccDeaths, order = c(0,1,1), seasonal = list(order = c(0,1,1)))
> prd=fitted(fit.1)
> prd
           Jan       Feb       Mar       Apr       May       Jun       Jul       Aug       Sep
1973  9001.800  8104.372  8926.240  9135.504 10015.010 10823.600 11314.488 10742.342  9712.502
1974  7788.446  6874.955  7793.928  8165.984  9118.551  9695.603 10096.607  9571.399  8677.644
1975  7460.699  7061.438  8154.902  8427.766  8684.042  9865.709 10246.993  9743.396  8604.486
1976  7240.482  6684.761  8012.153  7910.545  8929.076  9248.846  9629.685  9438.031  8098.223
1977  7725.884  7190.321  7680.099  7799.543  8842.792  9285.876 10111.025  9750.123  8325.877
1978  7995.194  7213.350  7718.853  7982.112  8932.428  9449.319 10486.450  9531.172  8612.342
           Oct       Nov       Dec
1973  9937.338  9161.140  8933.014
1974  8959.992  8323.985  8335.390
1975  8735.658  8020.437  7983.257
1976  8316.940  7970.185  7803.336
1977  8662.671  8248.118  8547.140
1978  9325.382  8630.104  9029.801
> f1<-forecast(fit.1,h=10)
> f1
         Point Forecast     Lo 80     Hi 80    Lo 95     Hi 95
Jan 1979       8336.061  7931.798  8740.324 7717.794  8954.328
Feb 1979       7531.829  7066.619  7997.040 6820.351  8243.307
Mar 1979       8314.644  7795.594  8833.694 7520.825  9108.462
Apr 1979       8616.869  8049.062  9184.676 7748.483  9485.255
May 1979       9488.913  8876.216 10101.609 8551.874 10425.951
Jun 1979       9859.757  9205.243 10514.272 8858.764 10860.751
Jul 1979      10907.470 10213.654 11601.287 9846.369 11968.571
Aug 1979      10086.508  9355.500 10817.517 8968.527 11204.490
Sep 1979       9164.959  8398.561  9931.357 7992.855 10337.064
Oct 1979       9384.259  8584.036 10184.483 8160.423 10608.096
> plot(f1)
> points(prd,type="l",col="blue",lwd=2)

enter image description here