Problem solving trick:
practice test 选择:
Q4(AR2 sta):
$X_t = 0.5 + 1.2X_{t-1} - 0.4 X_{t-2} + Z_t + 1.1 Z_{t-1}$
AR2的快速判别: a1 +a2<1, a1-a2>-1, a2>-1:
本题1.2-0.4<1, 1.2-(-0.4)>-1, -0.4>-1, 所以平稳
Q8(var of forecast error) 写成$(1-0.5B+0.2B^2)X_t = Z_t - 0.1Z_{t-1}$, 逆转过去,本题求3-step forecast 泰勒展开到2阶就可以。
$u = 0.5B - 0.2B^2, (1 + u + u^2 + ...) (Z_t - 0.1Z_{t-1})$
Q11 AR(2)的快速判别同Q4,
Garch的部分,从$\sigma^2$ 写到 $Y^2$, ARMA等价形式.
比如
$\sigma^2_t = 0.5 \sigma^2_{t-1} + 0.25 \sigma^2_{t-2} + 0.125Y_{t-1}^2$ 可以补 martingale difference $\eta_t = Y_t^2 - \sigma^2_t$
这样 $Y_t^2 = (0.125+0.5)Y_{t-1}^2 + 0.25Y_{t-2}^2 + \eta_t - 0.5\eta_{t-1} - 0.25\eta_{t-2}$
平稳性判别就是 $0.625+0.25 < 1, 0.625-0.25 > -1, 0.25 > -1$
Problem Set 11-1:
这个AR快速判别本质上是二次方程根norm>1的条件,所以在VAR里能这样用. 比如 P11-1 得到 $0.6B^2 - 1.7B + 1 =0$, 读出系数$a_1, a_2$实际是 1.7, -0.6 立刻知道它不stationary了.
Moreover, 对2阶的VAR是不是能通过矩阵$\Phi$立马读出系数呢? $I-B\Phi$
二阶系数就是-1*($b_{11} b_{22} - b_{12} b_{21}$), 一阶系数是 $b_{11}+b_{22}$
它和特征根也有联系. $det(I-B\Phi)$, B是对角阵, 等同于乘一个数 $det(I-k\Phi)$, 提出k, 解出的特征根实际是1/k, 所以|k|>1 需要|1/k| <1, 所以也可以看二阶矩阵$\Phi$的特征根是不是小于1.
11-3:
如果用上述的AR快速判定 用到MA上时,注意要先把矩阵反号.
$$
\epsilon_t +
(
\begin{matrix}
0.6 & 0.4\\
0.2 & 0.4\\
\end{matrix}
)\epsilon_{t-1}
$$
需要变成.., 稳妥起见可以先写出二次方程再读系数.
---
习题的启示:
Garch(h, k) h是$\sigma^2$的阶数,k是$Y^2$的阶数, 对GARCH(1,1) 如果没有Y的,就是Garch(1,0), 那不会有kurtosis>3.
ARMA的spectrum: $f(\omega) = \frac{\sigma_z^2}{\pi} \frac{|\theta(e^{i\omega})|^2}{|\phi(e^{i\omega})|^2}$
SES 和 ARIMA(0,1,1) 的等价关系, SES 只应用于 stationary series.
----
再补充两个HAC相关的.
$var(\hat \mu)$, 和 encoded 在 spectrum f(0).
strict Stationarity: joint distribution is invariant of shift.
$X_t, Y_t$ stationary, $X_t + Y_t$ 未必 stationary.
$X_t$ stationary, $X_t - X_{t-1}$ 是 stationary.
stationary 和 autocorellation 的关系:
有short-term autocorrelation,甚至有的有周期性\seasonality,还是stationary的.
AR模型的平稳性(2种等价方法):
$\phi(B)X_t = \epsilon_t$, 对应写出Yule-Walker方程
$\rho(k) = \alpha_1 \rho(k-1) + ..$
这是一组差分方程,需要解出他们的auxiliary equation
$y^k - \alpha_1 y^{k-1} - ... = 0$
解有如此形式: $\rho(k) = A_1 y_1^{k} + A_2 y_2^k+...$, 这些A是参数,可以通过Yule-Walker方程确定,如$\rho(0) = A_1 + ...$
对于平稳序列,当$k\to\infty$时,$\rho(k) \to 0$, 所以要求 $|y_k| < 1$. 注意这里是小于,下面是大于。
他还有一种等价形式,就是常见的unit root. $\phi(B) = 0$的根都在单位圆外.(modular > 1)
MA版本的可逆性条件是 $X_t = \theta(B)\epsilon_t$, $\theta(B) = 0$的根在单位圆外.
对于1阶的快速判别: 系数小于1.
对于2阶AR的快速判别:
$X_t = a_1 X_{t-1} + a_2 X_{t-2} + \epsilon_t$
$a_1 + a_2 < 1, a_1 - a_2 > -1, a_2>-1$ 三个条件同时满足.
Wold decomposition: any discrete stationary process can be decomposed into pure deterministic and pure indeterministic components, they're uncorrelated.
平稳序列的acv.f.
$\hat \gamma_k$ 与 $\gamma_k$ 差距bias of order $1/N$.
随机序列iid的相关系数 $r_k=c_k/c_0 \sim N(-\frac{1}{N}, \frac{1}{N})$, 所以 acf 的bound是$1.96/\sqrt{N}$
通过看acf降到0的速度,如果太慢多半不平稳。
AR系数的估计:
LS or MLE or Yule-Walker
Model Selection criteria:
AIC: -2 * log-likelihood + 2 * p
AICC: -2 * log-likelihood + 2 * p * N / (N - p - 1)
BIC: -2 * log-likelihood + log(T) * p + p
越小越好, AIC underpenalize than BIC.
Test 合集:
平稳的好处: forecast error variance remains finite.
Unit roots: ADF: H0: there is a unit root.
Residuals: if a good model, residuals should be white noise, close to 0,
Ljung-Box: $..\sum_k r^2_k..$ 服从chi-2, if model is good.
Durbin-Watson: 等价于检验 $r_1$, 应该在2附近, if model good.
SARIMA:
(p,d,q) x (P,D,Q)s
HAC:heteroscedasticity and autocorrelation consistent
------------------------------------------------------
讲义:
平稳性判别,随机取出一段时间来看不能判断是不是不属于.
波动-方差没有越来越大,没有明显的趋势-均值.
但seasonality不一定是不平稳的. 是因为我们只看到了 $\omega \in \Omega$ 的一个实现.
P61 开始,参数估计
根据correlogram看出AR or MA or ARMA:
ACF: 拖尾 - AR
PACF
April 8.
Forecasting
Exponential Smoothing 有3种形式:
$\hat X_{t+1} = \alpha X_t + (1 - \alpha) \hat X_t = \hat X_t + \alpha (X_t - \hat X_t)$
估计 + 修正
model-based:
conditional mean.
Box-Jenkins 模型参数估计?: Box-Jenkins模型就是ARIMA:
1.difference until stationary - correlogram to zero quickly.
2.model identification(which type, AR or MA)
3.estimation parameters - MLE\LS
4.diagnostic checking - Residual random?
ARMA:
Forecasting 误差计算另类方法
写为 MA infinite, h步就是前h个.
预测方法: 写成无穷阶AR.
April 22
Spectral Analysis
$X_t = Rcos(U + t) + \epsilon_t$, U is uniform (0, $2\pi$) is a stationary process!
我们观察到的他的一条trajectory还表现出了seasonality.
stationary是指背后的机制,观察只是一次样本.
Spectral的理解:
*variation* in time series 可以有低频,中频,高频多条curve的variation叠加而成. 还有低低频,中低频, 高高频... 连续的分解就有了 spectral representation.
Wiener-Khintchine theorem: $\gamma(k) = \int_{0}^{\pi} cos\omega t dF(\omega)$.
$F(0) = 0, F(\pi) = \sigma^2 = \gamma(0)$
auto covariance function and spectral density 的关系
representation theorem
$\gamma(k)$ 和 $f(\omega)$ 的转换, Fourier.
spectral density examples: 带公式.
white noise, MA(1)..
estimate $f(\omega)$ given data, 1.infinite auto covariance 2. smoothed periodogram? $I(\omega)$
$E(I(\omega)) \to f(\omega)$ when $N \to \infty$.
April 29, spectral analysis ii, P100
variance estimation via periodogram
want to estimate var($\hat \mu$)
HAC via periodogram, program.
non-linear model.
TAR model
May 4, ARCH\GARCH, deterministic model.
GARCH的ACF看着像white noise, 但平方以后就不是。
Jarque-Bera 检测正态,看skew和kurto符不符合.
May 13, Impulse response function(IRF),VAR
$\frac{dX_{t}}{d\epsilon_{t-r}}$ 或者 $\frac{dX_{t+r}}{d\epsilon_{t}}$
MA的IRF, AR的IRF, ARMA的IRF
IRF的intuition? 在t时刻epsilon来了一个shock,怎样在后面衰减.
calculate IRF of VAR in matrix form, since there're $\varepsilon_{1,t}, \varepsilon_{2,t}$
4个IRF: $X_1', Y_1', X_2', Y_2'$
先逆转成MA$(\infty)$, 就可以直接方便的读出系数了。
$\mathbf{X_t} = \mathbf{\Phi}\mathbf{X_{t-1}} + \varepsilon$
$(\mathbf I-\mathbf{\Phi}B)\mathbf{X_t} = \varepsilon$
这里B是一个matrix,对角阵. $BX_t = X_{t-1}$
$(I-\Phi B)^{-1} = I + \Phi B + ()^2 + ..$
May 27, structural VAR
contemporaneous on the right hand side.
add structure on shocks.
long-run restrictions
有关SVAR模型:
structure 是指符合一些假设(constraint), 比如 ordered shock, 比如 long-run restriction, 比如 t时刻发生的shock $\epsilon_t$ 对经济没有长期影响.
经济学的出发点: 研究shock的影响.
把stationary的模型 转化为MA的表达,得到impulse response function.
reduced-form VAR 不依赖于 当期 $y_t$.
可以通过转化将 依赖$y_t$ 的模型转为reduced-form. Link by 逆矩阵.
但这时候 reduced 形式下的 "shock" $u_{t,1}, u_{t,2}$ 就不再independent了,还需要估计他们的cov.
### 问题记录
P128 prediction intervals
预测的区间估计. HAC
### 犯错
$\phi(B), \psi(B)$ 注意一个是加一个是减...
# TS的结构
stationarity
Trend, Periodicity, Residuals分解
AR, MA, ARMA, ARIMA, SARIMA (Box-Jenkins)
stationarity, form, fit and predict
Spectral Analysis
Volatility model(ARCH, GARCH)
Impulse response function
structural VAR