rStatWn2D: Simulation from the stationary density of a WN diffusion in...

View source: R/RcppExports.R

rStatWn2DR Documentation

Simulation from the stationary density of a WN diffusion in 2D

Description

Simulates from the stationary density of the WN diffusion in 2D.

Usage

rStatWn2D(n, mu, alpha, sigma, rho = 0)

Arguments

n

sample size.

mu

a vector of length 2 giving the mean.

alpha

vector of length 3 parametrizing the A matrix as in alphaToA.

sigma

vector of length 2 containing the square root of the diagonal of \Sigma, the diffusion matrix.

rho

correlation coefficient of \Sigma.

Value

A matrix of dimension c(n, 2) containing the samples from the stationary distribution.

Examples

set.seed(345567)
alpha <- c(2, 1, -1)
sigma <- c(1.5, 2)
Sigma <- diag(sigma^2)
A <- alphaToA(alpha = alpha, sigma = sigma)
mu <- c(pi, pi)
plot(rStatWn2D(n = 1000, mu = mu, alpha = alpha, sigma = sigma))
points(toPiInt(mvtnorm::rmvnorm(n = 1000, mean = mu,
                                sigma = solve(A) %*% Sigma / 2,
                                method = "chol")), col = 2)

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