【发布时间】:2016-04-25 21:19:40
【问题描述】:
我已获得 118 天的数据集。我应该预测未来 28 天的值。我已经尝试了下面的代码。但是我在这 28 天里得到了相同的值。你能帮我找出我的错误吗?谢谢你。
library(forecast)
library(dplyr)
head(product)
ts_product = ts(product$Qty, start=1,frequency=1)
ts_product
plot(ts_product)
#predictions of 28 days
m_ets = ets(ts_product)
f_ets = forecast(m_ets, h=28)
plot(f_ets)
Qty 的数据由下式给出:
数量 = c(53, 40, 37, 45, 69, 105, 62, 101, 104, 46, 92, 157, 133, 173, 139、163、145、154、245、147、85、131、228、192、240、346、267、 267、243、233、233、244、241、136、309、236、310、266、280、321、 349、335、410、226、391、314、250、368、282、203、250、233、233、 277、338、279、279、266、253、178、238、126、279、258、350、277、 226、287、180、268、191、279、214、133、292、212、307、232、165、 107、121、188、198、154、128、85、106、67、63、88、107、56、41、 59、27、58、80、75、93、54、14、36、107、82、83、112、37、57、 9, 51, 47, 57, 68, 97, 25, 45, 69, 89)
这是我得到的预测。
Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
119 69.53429 2.089823 136.9788 -33.61312 172.6817
120 69.53429 -2.569107 141.6377 -40.73834 179.8069
121 69.53429 -6.944751 146.0133 -47.43031 186.4989
122 69.53429 -11.083248 150.1518 -53.75959 192.8282
123 69.53429 -15.019428 154.0880 -59.77946 198.8480
124 69.53429 -18.780346 157.8489 -65.53129 204.5999
125 69.53429 -22.387517 161.4561 -71.04798 210.1166
126 69.53429 -25.858385 164.9270 -76.35622 215.4248
127 69.53429 -29.207323 168.2759 -81.47798 220.5466
128 69.53429 -32.446345 171.5149 -86.43163 225.5002
129 69.53429 -35.585612 174.6542 -91.23273 230.3013
130 69.53429 -38.633808 177.7024 -95.89454 234.9631
131 69.53429 -41.598429 180.6670 -100.42854 239.4971
132 69.53429 -44.485993 183.5546 -104.84468 243.9133
133 69.53429 -47.302214 186.3708 -109.15172 248.2203
134 69.53429 -50.052133 189.1207 -113.35736 252.4259
135 69.53429 -52.740222 191.8088 -117.46844 256.5370
136 69.53429 -55.370474 194.4391 -121.49106 260.5596
137 69.53429 -57.946468 197.0150 -125.43070 264.4993
138 69.53429 -60.471431 199.5400 -129.29230 268.3609
139 69.53429 -62.948280 202.0169 -133.08032 272.1489
140 69.53429 -65.379664 204.4482 -136.79880 275.8674
141 69.53429 -67.768000 206.8366 -140.45144 279.5200
142 69.53429 -70.115495 209.1841 -144.04163 283.1102
143 69.53429 -72.424177 211.4928 -147.57245 286.6410
144 69.53429 -74.695908 213.7645 -151.04676 290.1153
145 69.53429 -76.932409 216.0010 -154.46719 293.5358
146 69.53429 -79.135268 218.2038 -157.83618 296.9048
另外,您认为我们在这里使用的 ets 以外的任何其他模型都可以解决这个问题吗?
【问题讨论】:
-
通过 'dput' 发布一些数据
-
@Coatless 谢谢你的建议。我已按要求添加数据。
标签: r time-series forecasting