rTpdWn2D: Simulation from the approximated transition distribution of a...

View source: R/RcppExports.R

rTpdWn2DR Documentation

Simulation from the approximated transition distribution of a WN diffusion in 2D

Description

Simulates from the approximate transition density of the WN diffusion in 2D.

Usage

rTpdWn2D(n, x0, t, mu, alpha, sigma, rho = 0, maxK = 2L, expTrc = 30)

Arguments

n

sample size.

x0

a matrix of dimension c(nx0, 2) giving the starting values.

t

vector of length nx0 containing the times between observations.

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.

maxK

maximum absolute value of the windings considered in the computation of the WN.

expTrc

truncation for exponential: exp(x) with x <= -expTrc is set to zero. Defaults to 30.

Value

An array of dimension c(n, 2, nx0) containing the n samples of the transition distribution, conditioned on that the process was at x0 at t instants ago. The samples are all in [\pi,\pi).

Examples

alpha <- c(3, 2, -1)
sigma <- c(0.5, 1)
mu <- c(pi, pi)
x <- seq(-pi, pi, l = 100)
t <- 0.5
image(x, x, matrix(dTpdWou2D(x = as.matrix(expand.grid(x, x)),
                            x0 = matrix(rep(0, 100 * 2),
                                        nrow = 100 * 100, ncol = 2),
                            t = t, mu = mu, alpha = alpha, sigma = sigma,
                            maxK = 2, expTrc = 30), nrow = 100, ncol = 100),
      zlim = c(0, 0.5))
points(rTpdWn2D(n = 500, x0 = rbind(c(0, 0)), t = t, mu = mu, alpha = alpha,
                sigma = sigma)[, , 1], col = 3)
points(stepAheadWn2D(x0 = rbind(c(0, 0)), delta = t / 500,
                     A = alphaToA(alpha = alpha, sigma = sigma),
                     mu = mu, sigma = sigma, N = 500, M = 500, maxK = 2,
                     expTrc = 30), col = 4)

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