-2

这是遵循增加趋势的数字向量(下图)。如果我想根据这种增长趋势预测接下来的 100 个值怎么办?我想要数字而不是图表上的预测值。

x[,2][1:500]
[1] 409341 409341 409341 409341 409341 409341 409341 411486 422035 422035 422035
[12] 422035 431658 431658 432432 432432 432432 434705 435179 443590 443590 443590
[23] 443590 443590 443590 452983 454948 454948 454948 454948 454948 457306 457306
[34] 458307 458307 458307 458307 458307 458307 458307 458307 458307 458307 458307
[45] 458307 458307 458307 458307 458307 458307 458307 458307 458307 458307 458307
[56] 458307 458307 458307 458307 458307 458307 458307 458307 458307 458307 458307
[67] 458307 458307 458307 458307 458307 458307 458307 458307 458873 458873 462334
[78] 462336 462336 462984 462984 462984 462984 462984 462984 462984 462984 464779
[89] 464779 464953 465905 465905 465905 465905 465905 465905 465905 465905 465905
[100] 465905 465905 465905 465905 465905 465905 465905 465905 465905 465905 465905
[111] 468325 468325 468325 469363 469539 469539 469585 471389 471389 471389 472006
[122] 472006 472431 472431 472431 472431 472431 472431 472431 472431 472431 472431
[133] 472431 472431 472431 472497 472497 472803 472803 473504 473504 473623 473623
[144] 473623 473623 473623 473623 473623 473623 473623 473623 477620 477620 477620
[155] 477620 477620 477620 477620 477620 477620 477620 477620 477620 477620 477620
[166] 479705 480350 482535 482535 482535 482535 482535 482535 482535 482535 482535
[177] 482535 482535 482535 482535 482535 482535 482535 482535 482535 482535 482535
[188] 482535 484568 484568 484568 484568 484568 488477 530816 530816 530816 530816
[199] 530816 530816 531817 531817 531817 531817 531817 531817 531817 531817 531817
[210] 531817 531817 531817 531817 531817 531817 531817 531817 531817 531817 531817
[221] 531817 531817 531817 531817 531817 531817 531817 531817 531817 531817 531817
[232] 531817 531817 531817 531817 531817 531817 531817 531817 531817 531817 531817
[243] 531817 531817 531817 531817 531817 532355 532355 535845 535846 535856 537961
[254] 537961 537961 537961 537961 537961 537961 537961 537961 538907 540396 540396
[265] 540396 540396 540396 541233 541233 541233 541233 541233 541233 541233 541233
[276] 541233 541233 541233 541233 541233 541233 541233 541233 541233 541233 541233
[287] 541233 541233 541233 541233 541233 541233 541233 541233 541233 541233 541233
[298] 541233 541233 541233 541233 541233 541233 541253 541253 541253 541253 541605
[309] 541605 541605 541605 541605 541605 541605 541605 541605 541605 541605 541605
[320] 541605 541745 541745 541745 541745 541745 541745 541745 541745 541745 542430
[331] 542430 542430 542430 542430 542430 542430 542549 542549 542549 542549 542549
[342] 542549 542549 542549 542549 542549 542549 542549 542549 542549 542549 542549
[353] 542549 542549 542549 542549 542549 542549 542549 542549 542549 542549 542549
[364] 542549 542549 542549 542549 542549 542549 542549 542549 542549 542549 542549
[375] 542549 542549 542549 542549 542549 542549 542549 542549 542549 542549 542549
[386] 542549 542549 543678 543678 543678 543678 543846 543846 549949 549949 549949
[397] 549949 549949 549949 549949 549949 549949 551494 551494 552870 552870 552870
[408] 552870 552870 552870 552870 552870 552870 552870 552870 552870 552870 552870
[419] 552870 552870 552870 552870 552870 552870 552870 552870 552870 552870 552870
[430] 552870 552870 552870 552870 552870 552870 552870 552870 552870 552870 552870
[441] 552870 552870 552870 552870 552870 552870 552870 552870 552870 552870 552870
[452] 552870 552870 552870 552870 552870 552870 552870 552870 552870 552870 552870
[463] 552870 552870 552870 555274 555274 555274 555274 555274 555274 555274 555274
[474] 555274 555274 555274 555274 555274 555274 555274 555274 555274 563748 576624
[485] 576624 576624 576624 576624 576624 576624 576624 576624 576624 576624 576624
[496] 576624 576624 576624 590125 590125
4

1 回答 1

0

如果xdata <- x[,2][1:500],并假设您的数据是时间序列数据,您可以使用可以自动拟合模型forecast的库。

library(forecast)
xdata <- ts(xdata)
fit <- auto.arima(xdata)
# or `fit <- ets(xdata)`
pred_xdata <- forecast(fit, 100)

plot(forecast(fit, 100))

Wherepred_xdata包含您所追求的下一个 100 点。

该图将如下所示:

在此处输入图像描述

于 2015-10-12T08:28:21.810 回答