# ornstein_uhlenbeck_process function

A process pulled toward mu at rate theta, with noise sigma, started at x0.

## How to write it

### ornstein_uhlenbeck_process(mu, sigma, theta, x0)

Stands for itself; mean, variance, pdf and stationary_distribution read it.

**mu**

The level it is pulled toward: dX = theta (mu - X) dt + sigma dW. Takes an expression.

**sigma**

The noise, above 0. Takes an expression.

**theta**

The rate of the pull, above 0. Takes an expression.

**x0**

The starting value. Takes an expression.

### ornstein_uhlenbeck_process(mu, sigma, theta)

Without a starting value it names the stationary process, which stationary_distribution reads.

**mu**

The level it is pulled toward. Takes an expression.

**sigma**

The noise, above 0. Takes an expression.

**theta**

The rate of the pull, above 0. Takes an expression.

## Examples

- $\displaystyle E[X_{t}],\ X \sim \operatorname{OU}(\mu, \sigma, \theta, x_{0}) = \frac{x_{0}-\mu}{e^{t \theta}}+\mu$

  `mean(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t)`

  In the solver, `mean(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t)` gives `e^(-t*theta)*(x0 - mu) + mu`.

  [Open in the solver](https://hilberon.com/?q=mean%28ornstein_uhlenbeck_process%28mu%2C%20sigma%2C%20theta%2C%20x0%29%2C%20t%29)
- $\displaystyle \operatorname{Var}(X_{t}),\ X \sim \operatorname{OU}(\mu, \sigma, \theta, x_{0}) = \begin{cases} \frac{\sigma^{2} \left(1-\frac{1}{e^{2 t \theta}}\right)}{2 \theta} & \text{if } \theta \neq 0 \end{cases}$

  `variance(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t)`

  In the solver, `variance(ornstein_uhlenbeck_process(mu, sigma, theta, x0), t)` gives `(1/2)sigma^2*(1 - e^(-2t*theta))/theta if theta != 0`.

  [Open in the solver](https://hilberon.com/?q=variance%28ornstein_uhlenbeck_process%28mu%2C%20sigma%2C%20theta%2C%20x0%29%2C%20t%29)
- $\displaystyle \operatorname{OU}(\mu, \sigma, \theta) \Rightarrow X_{\infty} \sim \mathcal{N}\left(\mu, \frac{\sqrt{2} \sigma}{2 \sqrt{\theta}}\right)$

  `stationary_distribution(ornstein_uhlenbeck_process(mu, sigma, theta))`

  In the solver, `stationary_distribution(ornstein_uhlenbeck_process(mu, sigma, theta))` gives `normal_distribution(mu, (1/2)sqrt(2)*sigma/sqrt(theta))`.

  [Open in the solver](https://hilberon.com/?q=stationary_distribution%28ornstein_uhlenbeck_process%28mu%2C%20sigma%2C%20theta%29%29)

## Functions its examples use

- [mean](https://hilberon.com/library/mean)

  The average of a list of numbers, or the expected value of a distribution.
- [variance](https://hilberon.com/library/variance)

  The sample variance of a list of numbers, or the variance of a distribution.
- [stationary_distribution](https://hilberon.com/library/stationary_distribution)

  The law a process settles into over time, when it has one.

## Related functions

- [ito_process](https://hilberon.com/library/ito_process)

  A process given by its drift and diffusion: dX = drift dt + diffusion dW.
- [wiener_process](https://hilberon.com/library/wiener_process)

  Brownian motion with drift mu and noise sigma, started at 0.
- [geometric_brownian_motion_process](https://hilberon.com/library/geometric_brownian_motion_process)

  A process that grows at rate mu with relative noise sigma, started at x0.
- [pdf](https://hilberon.com/library/pdf)

  The density of a distribution at a point, or the probability of a value for a discrete one.
- [normal_distribution](https://hilberon.com/library/normal_distribution)

  The normal distribution with mean mu and standard deviation sigma.
- [poisson_distribution](https://hilberon.com/library/poisson_distribution)

  The number of events in a period when they come at an average rate lambda.

---
Source: https://hilberon.com/library/ornstein_uhlenbeck_process
