arima 函数总结 returns In training accuracy(object, test, d, D) : test elements must be within sample
arima function summary returns In training accuracy(object, test, d, D) : test elements must be within sample
我对季度时间序列使用了 arima 函数并收到此警告。
(一开始效果很好,后来不知道是什么问题造成的)
final 是一个数据框,其值列由数字组成。
ar1 = arima(final$Value,order=c(1,0,0))
summary(ar1)
Call: arima(x = final$Value, order = c(1, 0, 0))
Coefficients:
ar1 intercept
0.9879 7.3593 s.e. 0.0118 0.5308
sigma^2 estimated as 0.01265: log likelihood = 108.45, aic = -212.89
Training set error measures:
ME RMSE MAE MPE MAPE Training set NaN NaN NaN NaN NaN Warning message: In trainingaccuracy(object, test, d, D) : test
elements must be within sample
我尝试建模的每个 arima 函数都会出现这种情况。
有了这个结果,我尝试了预测功能,我得到:
autoplot(forecast(ar1))
Error in ts(x) : 'ts' object must have one or more observations
我认为我的系列有问题,但我不明白出了什么问题,也不知道为什么它最初运行良好。
这是我使用的系列:
6.402755 6.447487 6.440739 6.444629 6.325880 6.213987 6.320138 6.221430 6.113566 6.131823 6.198132 6.280816 6.376518 6.682233 6.860274 6.969989 7.313399 7.299082 7.200292 6.975704 6.987592 7.093687 7.008988 6.878341 6.921279 6.885113 6.669485 6.646369 6.672451 6.683375 6.862668 6.971302 7.066513 6.982558 7.000745 6.947200 6.904141 6.907989 6.931114 6.840149 6.959360 7.010516 6.945923 6.997652 7.089783 7.128890 7.243348 7.185718 7.219598 7.340743 7.195484 7.007752 7.032095 7.112150 7.088555 7.044311 7.022457 7.034391 7.050923 7.005283 7.043774 7.097419 7.081782 6.989133 7.088950 7.173351 7.040893 6.990646 7.051991 7.142320 7.203468 7.277060 7.474889 7.554938 7.605872 7.711254 7.856296 7.919240 8.079298 8.137185 8.287493 8.272564 8.222417 8.325414 8.409447 8.473709 8.440126 8.427812 8.264590 8.335643 8.153812 7.567009 7.389719 7.591073 7.760976 7.851489 7.842401 7.827830 7.800251 7.911325 7.966901 7.934157 7.743143 7.539573 7.661231 7.593415 7.621503 7.713353 7.802358 7.778535 7.790057 7.850082 7.857232 7.826338 7.751009 7.687094 7.764962 7.853477 7.773990 7.785429 7.685640 7.709135 7.727118 7.827995 7.921841 8.023987 8.078377 8.120489 8.159005 8.131687 8.108646 8.037131 8.001428 8.024686 7.994422 8.048138 7.937257 7.696907 7.710174 7.787749 8.016172 8.121493 8.176831 8.238139
您显然已经在使用预测包了。因此,请使用预测包中的 Arima
,而不是统计包中的 arima
。
我对季度时间序列使用了 arima 函数并收到此警告。 (一开始效果很好,后来不知道是什么问题造成的)
final 是一个数据框,其值列由数字组成。
ar1 = arima(final$Value,order=c(1,0,0))
summary(ar1)
Call: arima(x = final$Value, order = c(1, 0, 0))
Coefficients: ar1 intercept 0.9879 7.3593 s.e. 0.0118 0.5308
sigma^2 estimated as 0.01265: log likelihood = 108.45, aic = -212.89
Training set error measures: ME RMSE MAE MPE MAPE Training set NaN NaN NaN NaN NaN Warning message: In trainingaccuracy(object, test, d, D) : test elements must be within sample
我尝试建模的每个 arima 函数都会出现这种情况。 有了这个结果,我尝试了预测功能,我得到:
autoplot(forecast(ar1))
Error in ts(x) : 'ts' object must have one or more observations
我认为我的系列有问题,但我不明白出了什么问题,也不知道为什么它最初运行良好。
这是我使用的系列:
6.402755 6.447487 6.440739 6.444629 6.325880 6.213987 6.320138 6.221430 6.113566 6.131823 6.198132 6.280816 6.376518 6.682233 6.860274 6.969989 7.313399 7.299082 7.200292 6.975704 6.987592 7.093687 7.008988 6.878341 6.921279 6.885113 6.669485 6.646369 6.672451 6.683375 6.862668 6.971302 7.066513 6.982558 7.000745 6.947200 6.904141 6.907989 6.931114 6.840149 6.959360 7.010516 6.945923 6.997652 7.089783 7.128890 7.243348 7.185718 7.219598 7.340743 7.195484 7.007752 7.032095 7.112150 7.088555 7.044311 7.022457 7.034391 7.050923 7.005283 7.043774 7.097419 7.081782 6.989133 7.088950 7.173351 7.040893 6.990646 7.051991 7.142320 7.203468 7.277060 7.474889 7.554938 7.605872 7.711254 7.856296 7.919240 8.079298 8.137185 8.287493 8.272564 8.222417 8.325414 8.409447 8.473709 8.440126 8.427812 8.264590 8.335643 8.153812 7.567009 7.389719 7.591073 7.760976 7.851489 7.842401 7.827830 7.800251 7.911325 7.966901 7.934157 7.743143 7.539573 7.661231 7.593415 7.621503 7.713353 7.802358 7.778535 7.790057 7.850082 7.857232 7.826338 7.751009 7.687094 7.764962 7.853477 7.773990 7.785429 7.685640 7.709135 7.727118 7.827995 7.921841 8.023987 8.078377 8.120489 8.159005 8.131687 8.108646 8.037131 8.001428 8.024686 7.994422 8.048138 7.937257 7.696907 7.710174 7.787749 8.016172 8.121493 8.176831 8.238139
您显然已经在使用预测包了。因此,请使用预测包中的 Arima
,而不是统计包中的 arima
。