Implements the exact discrete-time representation of the continuous Ornstein-Uhlenbeck (OU) process using a matrix formulation \(\mathbf{K}\mathbf{X} = \boldsymbol{\delta}\).
Value
An `ngme_operator` object containing:
`K`: the precision matrix
`h`: integration weights
`theta_K`: log-transformed theta for unconstrained optimization
`mesh`: the mesh object
Details
The OU process is defined by the stochastic differential equation (SDE):
$$dX_t = -\theta X_t dt + \sigma dW_t$$
where \(\theta > 0\) is the mean-reversion rate (stiffness) and \(\sigma\) is the volatility (diffusion coefficient).
## Exact Discretization
Unlike Euler-Maruyama approximations, the OU process has an exact solution between time points \(t_i\) and \(t_{i+1}\) with step size \(\Delta t_i\):
$$X_{i+1} = X_i e^{-\theta \Delta t_i} + \epsilon_i$$
This is an AR(1) form with autoregressive coefficient:
$$\rho_i = e^{-\theta \Delta t_i}$$
and Gaussian noise:
$$\epsilon_i \sim \mathcal{N}\left(0, \frac{\sigma^2}{2\theta}(1 - \rho_i^2)\right)$$
## Matrix Representation
The precision matrix \(\mathbf{K}\) for the linear system \(\mathbf{K}\mathbf{X} = \boldsymbol{\delta}\) is constructed as:
$$\mathbf{K} = \begin{bmatrix} \sqrt{1-\rho_1^2} & 0 & 0 & \cdots & 0 \\ -\rho_1 & 1 & 0 & \cdots & 0 \\ 0 & -\rho_2 & 1 & \cdots & 0 \\ \vdots & \vdots & \ddots & \ddots & \vdots \\ 0 & 0 & \cdots & -\rho_{n-1} & 1 \end{bmatrix}$$
where \(\rho_i = \exp(-\theta \Delta t_i)\) with \(\Delta t_i = t_{i+1} - t_i\).
**Why the \(\sqrt{1-\rho_1^2}\) term?** The first row ensures that \(X_1\) is drawn from the stationary distribution \(\mathcal{N}(0, \sigma^2/(2\theta))\). This scaling factor matches the variance of the first component of \(\boldsymbol{\delta}\) with the transition noise variance in subsequent steps.
## Non-uniform Mesh
For non-uniform meshes, each \(\rho_i\) is computed locally based on the varying time step \(\Delta t_i\), allowing the model to naturally handle irregularly spaced observations.
## The \(h\) vector
The \(h\) vector represents integration weights for the mass matrix. For the OU model, it is set as:
$$h = [\Delta t_1, \Delta t_2, \ldots, \Delta t_{n-1}, \Delta t_{n-1}]$$
where the last element is duplicated. This ensures proper weighting in the finite element formulation.
## The \(\boldsymbol{\delta}\) vector
In the equation \(\mathbf{K}\mathbf{X} = \boldsymbol{\delta}\), the vector \(\boldsymbol{\delta}\) contains independent identically distributed (i.i.d.) random variables with unit variance. The precision matrix \(\mathbf{K}\) is constructed such that the resulting process \(\mathbf{X}\) has the correct OU covariance structure.
References
Uhlenbeck, G. E., & Ornstein, L. S. (1930). On the theory of the Brownian motion. Physical review, 36(5), 823.
Examples
# Uniform mesh
mesh_uniform <- seq(0, 10, by = 0.5)
ou_uniform <- ou(mesh = mesh_uniform, theta = 0.5)
print(ou_uniform)
#> Model type: Ornstein-Uhlenbeck
#> theta = 0.5
# Non-uniform mesh
mesh_nonuniform <- c(0, 1, 2.5, 3.5, 5, 8, 11)
ou_nonunif <- ou(mesh = mesh_nonuniform, theta = 0.8)
print(ou_nonunif)
#> Model type: Ornstein-Uhlenbeck
#> theta = 0.8
