时间序列分析与应用
第二章 ARIMA过程
一、AR(p)
AR(1)
(
X
t
:
t
∈
T
)
,
X
t
=
ϕ
X
t
−
1
+
W
t
,
W
t
∼
W
N
(
0
,
σ
2
)
(X_t:t\in T) ,X_t=\phi X_{t-1}+W_t,{W_t \sim WN(0,\sigma^2)}
(Xt:t∈T),Xt=ϕXt−1+Wt,Wt∼WN(0,σ2)
AR(p)
(
X
t
:
t
∈
T
)
,
X
t
=
∑
i
=
1
p
ϕ
i
X
t
−
i
+
W
t
,
W
t
∼
W
N
(
0
,
σ
2
)
(X_t:t\in T) ,X_t=\sum\limits _{i=1}^{p}\phi ^iX_{t-i}+W_t,{W_t \sim WN(0,\sigma^2)}
(Xt:t∈T),Xt=i=1∑pϕiXt−i+Wt,Wt∼WN(0,σ2)
二、MA(q)
MA(1)
(
X
t
:
t
∈
T
)
,
X
t
=
W
t
+
θ
W
t
−
1
,
W
t
∼
W
N
(
0
,
σ
2
)
(X_t:t\in T) ,X_t=W_t+\theta W_{t-1},{W_t \sim WN(0,\sigma^2)}
(Xt:t∈T),Xt=Wt+θWt−1,Wt∼WN(0,σ2)
MA(q)
(
X
t
:
t
∈
T
)
,
X
t
=
W
t
+
∑
i
=
1
q
θ
j
W
t
−
j
,
W
t
∼
W
N
(
0
,
σ
2
)
(X_t:t\in T) ,X_t=W_t+\sum\limits _{i=1}^{q}\theta ^jW_{t-j},{W_t \sim WN(0,\sigma^2)}
(Xt:t∈T),Xt=Wt+i=1∑qθjWt−j,Wt∼WN(0,σ2)
E
(
X
t
)
=
0
E(X_t)=0
E(Xt)=0
C
o
v
(
x
t
+
h
,
x
t
)
=
σ
2
(
θ
h
+
θ
1
θ
h
+
1
+
.
.
.
+
θ
q
−
h
θ
q
)
Cov(x_{t+h},x_t)=\sigma^2(\theta_h+\theta_1\theta_{h+1}+...+\theta_{q-h}\theta_q)
Cov(xt+h,xt)=σ2(θh+θ1θh+1+...+θq−hθq)
ρ x ( h ) = { σ 2 ∑ y = 0 p θ y θ y + p 1 + θ 1 2 + . . . + θ q 2 ∣ h ∣ < p 0 ∣ h ∣ > p \rho_x(h)=\begin{cases}\sigma^2\frac{\sum\limits^p_{y=0}\theta_y\theta_{y+p}}{1+{\theta_1}^2+...+{\theta_q}^2}\quad |h|<p\\ 0\qquad \qquad \qquad |h|>p\end{cases} ρx(h)=⎩⎪⎨⎪⎧σ21+θ12+...+θq2y=0∑pθyθy+p∣h∣<p0∣h∣>p
三、R code
n = 500
sigma_w = 1.23
w = rnorm(n)
x = filter(w, filter = rep(1/3, 3))
acf(x, lag.max=20, na.action = na.omit)
par(mfrow=c(1,2))
plot(log(jj), main="plot of data and fitted value") # data
lines(fitted(reg1), col="red") # fitted
plot(log(jj)-fitted(reg1), main="plot of residuals")
线性表示 ==> ARMA转换为MA
ARMAtoMA(ar=c(-1.6,-.64), ma=0, lag=20)
ARMAacf(ar=(-1.6,-.64), ma=0, lag=3)