统计 | 时间序列学习笔记
(所有ppt截图,以及部分代码,来自中财黄白老师的ppt)
一、复习
Lecture 1、2
1、损失函数与最优一步预测
- 一个随机过程: Z t ≡ ( Y t , X t ′ ) ′ Z_{t} \equiv\left(Y_{t}, X_{t}^{\prime}\right)^{\prime} Zt≡(Yt,Xt′)′, X t X_{t} Xt是一个向量, Y t Y_{t} Yt是我们感兴趣的变量
- 我们可以利用T期观测: { Z 1 , … , Z t } \left\{Z_{1}, \ldots, Z_{t}\right\} { Z1,…,Zt},来估计模型参数 β ^ t \hat{\beta}_{t} β^t
- 由此得到一步预测: f ( Z t , β ^ t ) f\left(Z_{t}, \hat{\beta}_{t}\right) f(Zt,β^t)令 f t , 1 ≡ f ( Z t , β ^ t ) f_{t, 1} \equiv f\left(Z_{t}, \hat{\beta}_{t}\right) ft,1≡f(Zt,β^t),用 f t , 1 f_{t, 1} ft,1来估计 Y t + 1 Y_{t+1} Yt+1
- 一步预测误差: e t + 1 ≡ Y t + 1 − f t , 1 e_{t+1} \equiv Y_{t+1}-f_{t, 1} et+1≡Yt+1−ft,1
- 一步预测误差的损失函数: c ( e t + 1 ) c\left(e_{t+1}\right) c(et+1),最优预测 f t , 1 ∗ f_{t, 1}^{*} ft,1∗使得损失函数能够达到最小: f t , 1 ∗ = a r g min f t , 1 ∫ − ∞ ∞ c ( y − f t , 1 ) d F t ( y ) f_{t, 1}^{*}=arg\min _{f_{t, 1}} \int_{-\infty}^{\infty} c\left(y-f_{t, 1}\right) d F_{t}(y) ft,1∗=argft,1min∫−∞∞c(y−ft,1)dFt(y)
则最优预测误差: e t + 1 ∗ = Y t + 1 − f t , 1 ∗ e_{t+1}^{*}=Y_{t+1}-f_{t, 1}^{*} et+1∗=Yt+1−ft,1∗ - 求 f t , 1 ∗ f_{t, 1}^{*} ft,1∗的过程:
令偏导数等于0, ∂ ∂ f t , 1 ∫ − ∞ ∞ c ( y − f t , 1 ∗ ) d F t ( y ) = 0 \frac{\partial}{\partial f_{t, 1}} \int_{-\infty}^{\infty} c\left(y-f_{t, 1}^{*}\right) d F_{t}(y)=0 ∂ft,1∂∫−∞∞c(y−ft,1∗)dFt(y)=0 当积分和求导符号互换时, ∫ − ∞ ∞ ∂ ∂ f t , 1 c ( y − f t , 1 ∗ ) d F t ( y ) ≡ E ( ∂ ∂ f t , 1 c ( Y t + 1 − f t , 1 ∗ ) ∣ I t ) ≡ E ( g t + 1 ∣ I t ) = 0 \begin{aligned} &\int_{-\infty}^{\infty} \frac{\partial}{\partial f_{t, 1}} c\left(y-f_{t, 1}^{*}\right) d F_{t}(y) \equiv E\left(\frac{\partial}{\partial f_{t, 1}} c\left(Y_{t+1}-f_{t, 1}^{*}\right) | I_{t}\right)\\ &\equiv E\left(g_{t+1} | I_{t}\right)=0 \end{aligned} ∫−∞∞∂ft,1∂c(y−ft,1∗)dFt(y)≡E(∂ft,1∂c(Yt+1−ft,1∗)∣It)≡E(gt+1∣It)=0 其中, I t = { Z 1 , … , Z t } I_{t}=\left\{Z_{1}, \ldots, Z_{t}\right\} It={ Z1,…,Zt}, g t + 1 ≡ ∂ ∂ f t , 1 c ( Y t + 1 − f t , 1 ∗ ) g_{t+1} \equiv \frac{\partial}{\partial f_{t, 1}} c\left(Y_{t+1}-f_{t, 1}^{*}\right) gt+1≡∂ft,1∂c(Yt+1−ft,1∗)
2、平方损失函数
- 平方损失函数: c ( Y t + 1 − f t , 1 ) ≡ ( Y t + 1 − f t , 1 ) 2 c\left(Y_{t+1}-f_{t, 1}\right) \equiv\left(Y_{t+1}-f_{t, 1}\right)^{2} c(Yt+1−ft,1)≡(Yt+1−ft,1)2. 所以 g t + 1 ≡ ∂ ∂ f t , 1 c ( Y t + 1 − f t , 1 ∗ ) = − 2 e t + 1 ∗ g_{t+1} \equiv \frac{\partial}{\partial f_{t, 1}} c\left(Y_{t+1}-f_{t, 1}^{*}\right)=-2 e_{t+1}^{*} gt+1≡∂ft,1∂c(Yt+1−ft,1∗)=−2et+1∗,那么 E ( e t + 1 ∗ ∣ I t ) = 0 E\left(e_{t+1}^{*} | I_{t}\right)=0 E(et+1∗∣It)=0所以, E ( Y t + 1 − f t , 1 ∗ ∣ I t ) = 0 E\left(Y_{t+1}-f_{t, 1}^{*} | I_{t}\right)=0 E(Yt+1−ft,1∗∣It)=0,即 f t , 1 ∗ = E ( Y t + 1 ∣ I t ) f_{t, 1}^{*}=E\left(Y_{t+1} | I_{t}\right) ft,1∗=E(Yt+1∣It)
另外,在check loss下, f t , 1 ∗ = q α ( Y t + 1 ∣ I t ) f_{t, 1}^{*}=q_{\alpha}\left(Y_{t+1} | I_{t}\right) ft,1