# 自迴歸模型

## 定義

${\displaystyle X_{t}=c+\sum _{i=1}^{p}\varphi _{i}X_{t-i}+\varepsilon _{t}}$

${\displaystyle X_{t}=c+\sum _{i=1}^{p}\varphi _{i}B^{i}X_{t}+\varepsilon _{t}}$

${\displaystyle \phi [B]X_{t}=c+\varepsilon _{t}\,.}$

${\displaystyle P(X_{t}|X_{t-1}\ldots X_{p})\sim N\left(c+\sum _{i=1}^{p}\varphi _{i}X_{t-i},\sigma \right)}$

### 性質

${\displaystyle AR}$模型個平均值函數、自協方差（autocovariance）係：

{\displaystyle {\begin{aligned}\mu \left(t\right)&=E\left[X_{t}\right]\\\gamma \left(t,i\right)&=Cov\left(X_{t},X_{t-1}\right)\end{aligned}}}

${\displaystyle \rho (t,i)={\dfrac {Cov(X_{t},X_{t-i})}{{\sqrt {Var(X_{t})}}{\sqrt {Var(X_{t-i})}}}}}$

### 平穩性

${\displaystyle E[X_{t}]=E[X_{t-i}]=\mu }$ ，表示平均函數係常數；
${\displaystyle Cov(X_{t},X_{t-i})=\gamma _{i}}$，表示自協方差取決於距離間隔而嘸係取決於 ${\displaystyle t}$
${\displaystyle E[|X_{t}|^{2}]<\infty }$，表示前面兩者都係求得到嘅。

${\displaystyle E[X_{t}]=\mu ={\dfrac {c}{1-\sum _{i=1}^{p}\varphi _{i}}}}$ ，表示平均函數係常數；
${\displaystyle Var(X_{t})=\gamma _{0}=\sum _{j=1}^{p}\varphi _{j}\gamma _{-j}+\sigma ^{2}}$
${\displaystyle Cov(X_{t},X_{t-i})=\gamma _{i}=\sum _{j=1}^{p}\varphi _{j}\gamma _{i-j}}$，表示自方差取決於距離而嘸取決於 ${\displaystyle t}$
${\displaystyle \rho _{i}={\dfrac {\gamma _{i}}{\gamma _{0}}}}$

## 參數估計

### Yule-Walker 方程

Yule-Walker 方程命名自Udny Yule同Gilbert Walker[2][3]，係以下方程組[4]

${\displaystyle \gamma _{m}=\sum _{k=1}^{p}\varphi _{k}\gamma _{m-k}+\sigma _{\varepsilon }^{2}\delta _{m,0}}$

${\displaystyle {\displaystyle {\begin{bmatrix}\gamma _{1}\\\gamma _{2}\\\gamma _{3}\\\vdots \\\gamma _{p}\\\end{bmatrix}}={\begin{bmatrix}\gamma _{0}&\gamma _{-1}&\gamma _{-2}&\cdots \\\gamma _{1}&\gamma _{0}&\gamma _{-1}&\cdots \\\gamma _{2}&\gamma _{1}&\gamma _{0}&\cdots \\\vdots &\vdots &\vdots &\ddots \\\gamma _{p-1}&\gamma _{p-2}&\gamma _{p-3}&\cdots \\\end{bmatrix}}{\begin{bmatrix}\varphi _{1}\\\varphi _{2}\\\varphi _{3}\\\vdots \\\varphi _{p}\\\end{bmatrix}}}}$

m = 0 嗰陣，剩餘方程係：

${\displaystyle \gamma _{0}=\sum _{k=1}^{p}\varphi _{k}\gamma _{-k}+\sigma _{\varepsilon }^{2}}$

## 考

1. Shumway, Robert; Stoffer, David (2010). Time series analysis and its applications : with R examples (第3版). Springer. ISBN 144197864X.
2. Yule, G. Udny (1927) "On a Method of Investigating Periodicities in Disturbed Series, with Special Reference to Wolfer's Sunspot Numbers", Philosophical Transactions of the Royal Society of London, Ser. A, Vol. 226, 267–298.]
3. Walker, Gilbert (1931) "On Periodicity in Series of Related Terms", Proceedings of the Royal Society of London, Ser. A, Vol. 131, 518–532.
4. Theodoridis, Sergios (2015-04-10). "Chapter 1. Probability and Stochastic Processes". Machine Learning: A Bayesian and Optimization Perspective. Academic Press, 2015. pp. 9–51. ISBN 978-0-12-801522-3.