张芷铭的个人博客

自回归模型(AR)通过历史数据预测当前值,是时间序列分析的核心方法,广泛应用于视频编码、金融预测等领域。

自回归模型基础

基本假设:当前时刻值 $X_t$ 可表示为前 $p$ 个时刻值的线性组合加白噪声误差:

$$X_t = c + \sum_{i=1}^p \phi_i X_{t-i} + \varepsilon_t$$

其中 $\phi_i$ 为自回归系数,$\varepsilon_t \sim \mathcal{N}(0,\sigma^2)$ 为白噪声。

数学推导

Yule-Walker 方程

基于自协方差函数建立参数与序列统计量的关系:

$$\begin{pmatrix} \gamma(0) & \gamma(1) & \cdots & \gamma(p-1) \ \gamma(1) & \gamma(0) & \cdots & \gamma(p-2) \ \vdots & \vdots & \ddots & \vdots \ \gamma(p-1) & \gamma(p-2) & \cdots & \gamma(0) \end{pmatrix} \begin{pmatrix} \phi_1 \ \phi_2 \ \vdots \ \phi_p \end{pmatrix} = \begin{pmatrix} \gamma(1) \ \gamma(2) \ \vdots \ \gamma(p) \end{pmatrix}$$

Levinson-Durbin 递推算法

时间复杂度 $O(p^2)$,显著优于直接矩阵求逆的 $O(p^3)$:

  1. 初始化:$\phi_{1,1} = \frac{\gamma(1)}{\gamma(0)}$
  2. 迭代:$k=2$ 至 $p$,递推计算 $\kappa_k$、$\phi_{k,j}$、$\sigma_k^2$

平稳性条件

特征方程 $1 - \phi_1 z - \cdots - \phi_p z^p = 0$ 的根全在复平面单位圆外。

参数估计

最小二乘估计

1
2
3
4
5
from sklearn.linear_model import LinearRegression

X_lag = np.column_stack([X[i:-p+i] for i in range(p)])
y = X[p:]
model = LinearRegression().fit(X_lag, y)

极大似然估计

最大化对数似然函数:

$$\mathcal{L}(\phi,\sigma^2) = -\frac{T}{2}\ln(2\pi\sigma^2) - \frac{1}{2\sigma^2}\sum_{t=p+1}^T \varepsilon_t^2$$

阶数选择

准则公式
AIC$2p - 2\ln(L)$
BIC$p\ln(T) - 2\ln(L)$

通过 PACF(偏自相关函数)截尾位置确定 $p$ 值。

应用场景

领域应用
视频编码AV1 中 AR(24) 模拟胶片颗粒噪声
金融预测S&P 500 指数收益率预测
融合语言模型时间序列转文本 + BERT 特征提取

最新进展

  • 非线性扩展:门限自回归(TAR)捕捉状态切换
  • 多模态融合:AR + GAN 实现更逼真的胶片颗粒合成
  • 优化算法:随机梯度下降加速大规模时间序列参数估计

Comments