如何从R语言中获取预测数据集?

How to get forecast dataset from R language?

我正在跟进这个 guide 以预测 ARIMA 数据中的数据。

我的问题是如何从预测数据中提取数据点?

我想要这些点,这样我就可以在 excel 中画出完全相同的东西。这可能吗?

谢谢。

假设你使用类似

的东西
library(forecast)
m_aa <- auto.arima(AirPassengers)
f_aa <- forecast(m_aa, h=24)

然后您可以显示预测值,例如

f_aa

这给出了

         Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
Jan 1961       446.7582 431.7435 461.7729 423.7953 469.7211
Feb 1961       420.7582 402.5878 438.9286 392.9690 448.5474
Mar 1961       448.7582 427.9043 469.6121 416.8649 480.6515
Apr 1961       490.7582 467.5287 513.9877 455.2318 526.2846
May 1961       501.7582 476.3745 527.1419 462.9372 540.5792
Jun 1961       564.7582 537.3894 592.1270 522.9012 606.6152
Jul 1961       651.7582 622.5388 680.9776 607.0709 696.4455
Aug 1961       635.7582 604.7986 666.7178 588.4096 683.1069
Sep 1961       537.7582 505.1511 570.3653 487.8900 587.6264
Oct 1961       490.7582 456.5830 524.9334 438.4918 543.0246
Nov 1961       419.7582 384.0838 455.4326 365.1989 474.3176
Dec 1961       461.7582 424.6450 498.8714 404.9985 518.5179
Jan 1962       476.5164 431.6293 521.4035 407.8675 545.1653
Feb 1962       450.5164 401.1834 499.8494 375.0681 525.9647
Mar 1962       478.5164 425.1064 531.9265 396.8328 560.2000
Apr 1962       520.5164 463.3192 577.7137 433.0408 607.9920
May 1962       531.5164 470.7676 592.2652 438.6092 624.4237
Jun 1962       594.5164 530.4126 658.6203 496.4780 692.5548
Jul 1962       681.5164 614.2245 748.8083 578.6024 784.4304
Aug 1962       665.5164 595.1809 735.8519 557.9475 773.0853
Sep 1962       567.5164 494.2636 640.7692 455.4859 679.5469
Oct 1962       520.5164 444.4581 596.5747 404.1953 636.8376
Nov 1962       449.5164 370.7525 528.2803 329.0574 569.9754
Dec 1962       491.5164 410.1368 572.8961 367.0570 615.9758

你可以用

之类的东西保存这些值
write.csv(f_aa, file="location_and_filename.csv")