1. 정의
(1) OU Process 란
- $dX_t = \theta(\mu - X_t) dt + \sigma dW_t$
- Mean-reversion process: 현재 시점의 값이 평균 값에서 떨어진 만큼에 이를 반영하는 정도를 곱한 값이 다음 시점에 반영되어 평균으로 회귀하게 되는 확률 과정이다.
- 예를 들어, 현재 가격이 평균보다 낮다면 $\theta (\mu - X_t) $ 값이 0보다 클 것이고 $X_t$ 가 증가하여 $\mu$ 에 가까워지게 된다.
(2) Parameter 의미
- $\mu$ : long-term mean
- $\sigma$ : volatility
- $\theta$ : speed of reversion to long-term mean
- $\theta$ 값이 클수록 평균으로부터의 deviation을 많이 반영하므로 더 빨리 평균을 회귀할 것이다.
2. Stochastic Differential Equation
(1) SDE 해 구하는 과정
\end{align}
(2) Mean and Variance
- $ E[X_t] = X_0 e^{\theta t} + \mu(1- e^{\theta t})$
- $ Var[X_t] = E[(X_t-E[X_t])^2]=E \left[\left(e^{\theta t} \int_0^t \sigma e^{\theta s}dW_s \right)^2\ \right] \rightarrow Var[X_t] = \frac{\sigma^2}{2 \theta}(1 - e^{-2 \theta t})$
- $Cov[X_t, X_s] = \frac{\sigma^2}{2 \theta} (e^{-\theta|t-s|} - e^{-\theta (s+t)})$
3. Estimation
(1) AR(1)
- $X_{t+\Delta t} = X_t e^{-\theta \Delta t} + \mu (1-e^{-\theta \Delta t}) + \sigma \sqrt{\frac{1-e^{-2 \theta \Delta t}}{2\theta}} N(0,1)$
- $X_{k+1} = c + \phi X_k + \sigma_{\epsilon} W_i$
- OLS and get estimates $, \hat c, \hat{\phi} \text{and} \hat \sigma_{\epsilon} $
- $c = \mu (1-e^{-\theta \Delta t}), \phi = e^{-\theta \Delta t}$
Therefore, $ \theta = - \frac{\ln{\hat \phi}}{\Delta t}, \mu = \frac{\hat c}{1-\hat \phi} $
- $ SE = \sigma \sqrt{\frac{1-e^{-2 \theta \Delta t}}{2\theta}} N(0,1)$
- $SE = \sigma \sqrt{\frac{1-{\hat \phi^2}}{-2\frac{\ln{\hat \phi}}{\Delta t}}}$
Therefore, $ \sigma = \hat\sigma_{\epsilon} \sqrt{\frac{-2\ln \hat \phi}{(1-\hat\phi^2)\Delta t}}$
- $\mu$ 를 알고 있는 경우
\begin{align} \hat{\phi} = \frac{\sum_{i=1}^{N} X_i X_{i-1}}{\sum_{i=1}^{N} X_{i-1}^2} \\ \hat{\theta} = - \frac{\ln(\hat{\phi})}{\Delta t} \end{align}
(2) Maximum-likelihood
- Assume that $\mu=0$ : Pairs trading 에서 선택된 종목 가격 두 개의 spread는 보통 장기적으로 0이다.
\begin{align} & X_t = e^{-\theta \Delta t} X_{t-1} + \sigma \sqrt{\frac{1-e^{-2 \theta \Delta t}}{2\theta}}W \\& f(X_t | X_{t-1} ; \theta, \sigma) = \frac{1}{\theta_w \sqrt{2 \pi}} exp \left[ - \frac{(X_t - X_{t-1} e^{-\theta \Delta t})^2}{2 \sigma^2_w} \right] \\ & L(\theta, \sigma | X_1, ... ,X_N) = - \frac{N \ln(2N)}{2} - N \ln(\sigma_w) - \frac{1}{2 \sigma^2_w} \sum_{t=1}^{N} (X_t - X_{t-1} e^{- \theta \Delta t})^2 \end{align}
- Maximize $L$ : AR(1) 보다 속도는 느리다.
- AR(1) estimation with known $\mu$ 과 같은 결과를 얻는다(단, jump와 noise가 없다는 가정 하에).
(3) $\theta$ 추정에 관하여
- $\theta$ 는 mean reverting speed로 pair trading에 있어 이것을 추정하는 것이 중요하다. 두 종목의 spread의 mean-reverting speed가 빨라야(혹은 half-life가 작아야) 매매할 수 있는 기회가 많으므로 $\theta$ 값 및 Half Life를 최대한 정확하게 추정하여 적당한 pair를 고르는 것이 중요할 수 있다.
- Asymptotic Distribution of $\hat{\theta}$
- $T \to \infty, \; \Delta t \text{fixed}$: \begin{cases}
{\sqrt{T} (\hat{\theta} - \theta) \to^d N(0, \frac{e^{2\theta \Delta t} -1}{\Delta t})}, & \mbox{if }\mu=0 \\
{\sqrt{T} (\hat{\theta} - \theta) \to^d N(0, \frac{e^{2\theta \Delta t} -1}{\Delta t})}, & \mbox{if }\mu \mbox{ is unknown}
\end{cases} - $T \to \infty, \; \Delta t \to 0$: \begin{cases}
{\sqrt{T} (\hat{\theta} - \theta) \to^d N(0, 2\theta)}, & \mbox{if }\mu=0 \\
{\sqrt{T} (\hat{\theta} - \theta) \to^d N(0, 2\theta)}, & \mbox{if }\mu \mbox{ is unknown}
\end{cases} - $T \text{ fixed,} \; \Delta t \to 0$: Biased(예를 들어, half-life가 6개월인 어떤 종목의 한달 짜리 tick data를 분석한다면 구간이 아주 작아도 그 안에 정보가 들어있지 않아 분석이 제대로 되지 않는다.)
- $T \to \infty, \; \Delta t \text{fixed}$: \begin{cases}
(4) Half-Life
- 어떤 time-series가 mean-reverting 될 때까지 얼마나 걸리는지 측정한 것
\begin{align} &dx = \theta (\mu -x) dt + s dz \\&E[dx] = \theta (\mu -x) dt \\& dx/(\mu -x) = \theta dt \\& dt = t_1 - t_0, \; x_0(t_0), \; x_1(t_1) \quad \text{then,} \\& -\ln(m-x) |_{x_0}^{x_1} = \theta \Delta t \\& \ln \left( \frac{x_1 - m}{x_0 - m} \right)= -\theta \Delta t \\& \text{For $dt$ = half-life $H$,} \; (x_1 - m) = 0.5(x_0 - m) \\& H = \frac{ln2}{\theta}
\end{align}
- $\theta$ 값이 클수록, 즉 mean-reverting 속도가 빠를 수록 Half-life는 작아진다.
- 만약 금융시장이 random walk를 따른다고 가정한다면($\theta = 0$) 이면 half-life는 $\infty$ 이다. 직관적으로 생각했을 때도 랜덤워크 하에서는 mean-reverting이 되지 않으므로 수식 해석과 동일하다.
- 금융시장은 보통 Random walk와 같은 양상을 보이기 때문에 Unit root test에서 귀무가설인 "단위근이 존재한다" 를 기각하기가 쉽지 않다. Coefficient가 1이 아니라 1에 아주 가까워도 귀무가설을 채택하게 되기 때문이다. 따라서 False Negative 가능성이 커지는데, 이 때 Half-Life를 통해 파악할 수 있다. 만약 mean reverting이 존재한다면 Half-life 값이 무한대가 아닐 것이기 때문에 near unit root를 갖는다.
- 아래의 시뮬레이션 예시에서도 AR(1) Process 를 통해 파라미터 추정에서 $\hat{\phi}$ 값이 약 0.997로 1에 굉장히 가까웠다.
4. Noise and Jump
(1) OU Process with Noise
- $X_i \leftarrow X_i + E_i, \quad E_i \sim N(0, w^2)$
- $\hat{\theta}, \; \hat{\sigma}$ 가 biased 된다.
- Denosing 방법 필요(참고: [Holý and Tomanová, (2018)])
(2) OU Process with Jump
- $dX_t = \theta(\mu -X_t) dt + \sigma dW_t + \ln(J_t) dN_t$
- $\ln(J_t)$: jump size and normally distributed
- $N_t$: Possion arrival process
- Jump는 fat tail을 만든다
- 만약 위에서 언급한 추정방법을 그대로 적용하면 $\hat{\theta}, \; \hat{\sigma}$ 가 overestimate 된다.
- Jump를 Filtering할 방법 필요(참고: [Mai, (2012)], [Cartea and Figueroa, (2007)], [Cázares and Ivanovs, (2020))
5. Simulation
df = fdr.DataReader('KO', '2017-01-01', '2022-01-01').Close
model = Ornstein_Uhlenbeck(df, period='daily')
model.fit()
paths = []
for i in range(20):
paths.append(model.predict(t=i))
paths = np.array(paths)
plt.plot(paths[:, :20])
plt.show()
pred = model.predict(20)
plt.hist(pred)
plt.show()
print(model.confidence_interval_)
print(model.half_life_)
95% 수준에서의 신뢰구간 / Half-Life(year)
(52.22697586540131, 62.06015575771152)
0.282263697124538
@ Hudson and Thames Research 참고
'Stochastic Process > Stochastic Process' 카테고리의 다른 글
Ch2. Brownian Motion (0) | 2022.02.07 |
---|---|
Ch1. 금융에서의 Stochastic Process (0) | 2022.02.05 |