alphaToA: Valid drift matrices for the Ornstein-Uhlenbeck diffusion in...

View source: R/OU.R

alphaToAR Documentation

Valid drift matrices for the Ornstein–Uhlenbeck diffusion in 2D

Description

Constructs drift matrices A such that solve(A) %*% Sigma is symmetric.

Usage

alphaToA(alpha, sigma = NULL, rho = 0, Sigma = NULL)

aToAlpha(A, sigma = NULL, rho = 0, Sigma = NULL)

Arguments

alpha

vector of length 3 containing the A matrix. The first two elements are the diagonal.

sigma

vector of length 2 containing the square root of the diagonal of Sigma.

rho

correlation of Sigma.

Sigma

the diffusion matrix of size c(2, 2).

A

matrix of size c(2, 2).

Details

The parametrization enforces that solve(A) %*% Sigma is symmetric. Positive definiteness is guaranteed if alpha[3]^2 < rho^2 * (alpha[1] - alpha[2])^2 / 4 + alpha[1] * alpha[2].

Value

The drift matrix A or the alpha vector.

Examples

# Parameters
alpha <- 3:1
Sigma <- rbind(c(1, 0.5), c(0.5, 4))

# Covariance matrix
A <- alphaToA(alpha = alpha, Sigma = Sigma)
S <- 0.5 * solve(A) %*% Sigma
det(S)

# Check
aToAlpha(A = alphaToA(alpha = alpha, Sigma = Sigma), Sigma = Sigma)
alphaToA(alpha = aToAlpha(A = A, Sigma = Sigma), Sigma = Sigma)

egarpor/sdetorus documentation built on March 4, 2024, 1:23 a.m.