- 使用的时间序列参数如下
data<-c(20.94,-22.76,4.33,-4.6,21.75,-24.86,4.87,-5.4,21.48,-23.46,4.22,-4.57,21.92,-22.97,4.26,-4.53,21.79,-26.0,4.54,-5.02)
- 开始预测
data.arima<-auto.arima(data)
输出:
Series: data
ARIMA(1,0,1) with zero mean
Coefficients:
ar1 ma1
-0.4605 -0.8257
s.e. 0.2021 0.1301
sigma^2 estimated as 96.22: log likelihood=-74.01
AIC=154.01 AICc=155.51 BIC=157
预测命令
data.forecast<-forecast(data.arima,5)
输出:
Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
21 -2.9580835 -15.53001 9.613843 -22.18519 16.26902
22 1.3622049 -19.11904 21.843454 -29.96116 32.68557
23 -0.6272988 -22.41997 21.165376 -33.95632 32.70172
24 0.2888727 -21.77189 22.349635 -33.45015 34.02790
25 -0.1330266 -22.25022 21.984170 -33.95836 33.69231
-
残差正态性
qqnorm(data.arima$residuals) qqline(data.arima$residuals)
无关性检验
Box.test(data.arima$residuals, type = "Ljung-Box")
Box-Ljung test
data: data.arima$residuals
X-squared = 0.28894, df = 1, p-value = 0.5909
- 是否平稳 adf.test ,平稳性检验0.01,为平稳性数据
library(tseries)
adf.test(data)
Augmented Dickey-Fuller Test
data: data
Dickey-Fuller = -59.373, Lag order = 2, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In adf.test(data) : p-value smaller than printed p-value