4
$\begingroup$

I have mean reverting data (Difference of 2 stock prices, that I want to do pairs trading on). I want to simulate my own mean reverting data as similar as possible to the real data that I have.

The approach that I want to take is Least Squares Regression. Maximum Likelihood is too complicated.

Thank you all.

$\endgroup$
6
$\begingroup$

Similar to Juan Gil's answer but a bit differently I would say the following based on this:

The OU process $$dX_t = \kappa(\theta-X_t)dt + \sigma dW_t$$ can be (Euler-Maryuama discretization) discretized at times $n \Delta t,n=1,\ldots,\infty $ which gives with $t = k \Delta t$ $$ X_{k+1} - X_k = \kappa \theta \Delta t -\kappa X_k \Delta t + \sigma (W_{k+1} - W_k), $$ rearranging and setting $\sigma (W_{k+1} - W_k) = \sigma \sqrt{\Delta t} \epsilon_k $ we get: $$ X_{k+1} = \kappa \theta \Delta t - (\kappa \Delta t - 1) X_k + \sigma \sqrt{\Delta t} \epsilon_k. $$ So you can model an AR(1) process and then identify the parameters using the equation above.

Thinking about it again one can probably leave $X_{k+1} - X_k$ on the lhs and then one simply does a regression but I don't know exactly about the error terms in this case.

I have found this with R code, there an MLE approach is used. You find various solutions in this Stack Overflow question.

$\endgroup$
3
$\begingroup$

For a Ornstein-Uhlenbeck process, the maximum likelihood parameters are the ones from least squares regression.

If your process is:

$$ dX=\kappa (\theta-X)dt+\sigma dW $$

you can do a linear regression in the form

$$ \frac{dX}{dt}=a+bX+\epsilon $$

So your parameters will be:

$$ \kappa=-b $$

$$ \theta=-\frac{a}{b} $$

$$ \sigma=std(\epsilon dt) $$

$\endgroup$
  • $\begingroup$ After reading Richard's answer I've done a small edition in mine: each $\epsilon$ has to be multiplied by its $dt$ (especially if not all the $dt$ in your data are equal) to get the right volatility (the result would be in the units you are measuring $dt$) $\endgroup$ – Juan Ignacio Gil Apr 1 '15 at 15:36
  • $\begingroup$ I know this is old, but doesn't Juan mean to divide each $\epsilon$ by $dt$, not times? Since each error is $N(0,\sigma^2 dt)$ we should be correcting for this by division, surely? $\endgroup$ – Patty Jul 24 '17 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.