Estimating Ornstein–Uhlenbeck Parameters with Linear Regression
Summary
The document explains how to estimate an Ornstein–Uhlenbeck process for mean-reverting data, motivated by simulating a stock-price spread for pairs trading. It discretizes the process over equally spaced observations and relates the resulting equation to an autoregressive model. Alternatively, regressing changes in the series on its current level gives a linear form from which the mean-reversion speed and long-run level can be inferred; residual variation is used to estimate volatility.
The answers describe regression as a least-squares route to parameter estimates and connect it to maximum likelihood under the stated setup. They also caution that the basic regression estimator can be unreliable when mean reversion is weak relative to volatility noise. A robust-statistics alternative is mentioned, but its procedure is not developed here. The discussion leaves practical details such as sampling interval choice and model fit to the practitioner, so estimates should not be treated as automatically faithful simulations of real spreads.
Key ideas
- An Ornstein–Uhlenbeck process can be discretized into a linear autoregressive relationship.
- Regressing series changes on the current level provides estimates of mean-reversion parameters.
- Residual variation can be used to estimate the process volatility.
- The basic regression approach may be less reliable when volatility noise is large relative to mean reversion.
- Robust statistical estimation is mentioned as an alternative, without a full procedure.
Tags
Full text
# How can I estimate the Ornstein-Uhlenbeck paramters of some mean reverting data that I have on R?
# How can I estimate the Ornstein-Uhlenbeck paramters of some mean reverting data that I have on R?
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.
## Answer by Richi Wa (score 10)
https://quant.stackexchange.com/a/17193
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.
## Answer by Juan Ignacio Gil (score 6)
https://quant.stackexchange.com/a/17191
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) $$
## Answer by Gustave Euler (score 0)
https://quant.stackexchange.com/a/78826
The previous estimator relying on regression is effective only when the degree of mean reversion is sufficiently high that the influence of volatility noise on the calculation is minimal. However, an alternative method proposed by Falk, based on robust statistics, is designed to operate effectively even in the presence of real-world data.[Falk, 1997] Falk, M. (1997). On mad and comedians. Annals of the Institute of Statistical Mathematics, 49(4):615–644.Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.