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)
Numeric value or vector of size n.
Numeric value or vector of size n, initial value(s) to condition on.
Numeric value or vector of size n, denoting the time-step.
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.
Logical indicating whether the returned density should is on the logarithmic scale.
Integer, the number of values to sample.
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.
dOU
: probability density
rOU
: random generator
meanOU
: mean value
varOU
: variance
sdOU
: standard deviation
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.
# NOT RUN {
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
varOU(t, 2, 1)
# }
Run the code above in your browser using DataLab