# 拓端数据(tecdat)：R语言ARIMA，SARIMA预测道路交通流量时间序列:季节性、周期性

，例如道路上的交通流量，

> plot(T,X,type="l")

> reg=lm(X~T)

> abline(reg,col="red")

> Y=residuals(reg)

> acf(Y,lag=36,lwd=3)

，我们尝试找到ARMA模型。考虑时间序列的自相关函数，

> Z=diff(Y,12)

> acf(Z,lag=36,lwd=3)

arima

Coefficients:

ma1  intercept

-0.2367  -583.7761

s.e.  0.0916  254.8805

sigma^2 estimated as 8071255:  log likelihood = -684.1,  aic = 1374.2

arima

Coefficients:

ar1  intercept

-0.3214  -583.0943

s.e.  0.1112  248.8735

sigma^2 estimated as 7842043:  log likelihood = -683.07,  aic = 1372.15

。这表明以下的SARIMA结构

arima

Coefficients:

ar1

-0.2715

s.e.  0.1130

sigma^2 estimated as 8412999:  log likelihood = -685.62,  aic = 1375.25

arima

Coefficients:

ar1    sar1  intercept

-0.1629  0.9741  -684.9455

s.e.  0.1170  0.0115  3064.4040

sigma^2 estimated as 8406080:  log likelihood = -816.11,  aic = 1640.21

> pre(model2,600,b=60000)

> prev(model3,600,b=60000)

> pre(model2,36,b=60000)

> pre(model3,36,b=60000)

Call:

seasonal = list(order = c(1, 0, 0)

Coefficients:

sar1  intercept

0.9662  -696.5661

s.e.  0.0134  3182.3017

sigma^2 estimated as 8918630:  log likelihood = -817.03,  aic = 1640.07

> pre(model,36,b=32000)

，即使其中不重要，我们通常也会保留它们来预测。