An Ornstein-Uhlenbeck (OU) process represents a continuous time Markov chain parameterized by an initial state \(x_0\), selection strength \(\alpha>0\), long-term mean \(\theta\), and time-unit variance \(\sigma^2\). Given \(x_0\), at time \(t\), the state of the process is characterized by a normal distribution with mean \(x_0 exp(-\alpha t) + \theta (1 - exp(-\alpha t))\) and variance \(\sigma^2 (1-exp(-2 \alpha t)) / (2 \alpha)\). In the limit \(\alpha -> 0\), the OU process converges to a Brownian motion process with initial state \(x_0\) and time-unit variance \(\sigma^2\) (at time \(t\), this process is characterized by a normal distribution with mean \(x_0\) and variance \(t \sigma^2\).

dOU(z, z0, t, alpha, theta, sigma, log = TRUE)

rOU(n, z0, t, alpha, theta, sigma)

meanOU(z0, t, alpha, theta)

varOU(t, alpha, sigma)

sdOU(t, alpha, sigma)

Arguments

z

Numeric value or vector of size n.

z0

Numeric value or vector of size n, initial value(s) to condition on.

t

Numeric value or vector of size n, denoting the time-step.

alpha, theta, sigma

Numeric values or n-vectors, parameters of the OU process; alpha and sigma must be non-negative. A zero alpha is interpreted as the Brownian motion process in the limit alpha -> 0.

log

Logical indicating whether the returned density should is on the logarithmic scale.

n

Integer, the number of values to sample.

Value

dOU returns the conditional probability density(ies) of the elements in z, given the initial state(s) z0, time-step(s) t and OU-parameters by alpha, theta and sigma.

rOU returns a numeric vector of length n, a random sample from the conditional distribution(s) of one or n OU process(es) given initial value(s) and time-step(s).

meanOU returns the expected value of the OU-process at time t.

varOU returns the expected variance of the OU-process at time t.

sdOU returns the standard deviation of the OU-process at time t.

Details

Similar to dnorm and rnorm, the functions described in this help-page support single values as well as vectors for the parameters z, z0, t, alpha, theta and sigma.

Functions

  • dOU: probability density

  • rOU: random generator

  • meanOU: mean value

  • varOU: variance

  • sdOU: standard deviation

Examples

z0 <- 8 t <- 10 n <- 100000 sample <- rOU(n, z0, t, 2, 3, 1) dens <- dOU(sample, z0, t, 2, 3, 1) var(sample) # around 1/4
#> [1] 0.2492913
varOU(t, 2, 1)
#> [1] 0.25