rTrajWn2D: Simulation of trajectories for the WN diffusion in 2D

View source: R/sample-trajectories.R

rTrajWn2DR Documentation

Simulation of trajectories for the WN diffusion in 2D

Description

Simulation of the Wrapped Normal (WN) diffusion in 2D by subsampling a fine trajectory obtained by the Euler discretization.

Usage

rTrajWn2D(x0, alpha, mu, sigma, rho = 0, N = 100, delta = 0.01,
  NFine = ceiling(N * delta/deltaFine), deltaFine = min(delta/100, 0.001))

Arguments

x0

vector of length 2 giving the initial point.

alpha

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

mu

a vector of length 2 giving the mean.

sigma

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

rho

correlation coefficient of \Sigma.

N

number of discretization steps in the resulting trajectory.

delta

discretization step.

NFine

number of discretization steps for the fine trajectory. Must be larger than N.

deltaFine

discretization step for the fine trajectory. Must be smaller than delta.

Details

The fine trajectory is subsampled using the indexes seq(1, NFine + 1, by = NFine / N).

Value

A matrix of size c(N + 1, 2) containing x0 in the first entry and the discretized trajectory.

Examples

samp <- rTrajWn2D(x0 = c(0, 0), alpha = c(1, 1, -0.5), mu = c(pi, pi),
                    sigma = c(1, 1), N = 1000, delta = 0.01)
plot(samp, xlim = c(-pi, pi), ylim = c(-pi, pi), pch = 19, cex = 0.25,
     xlab = expression(X[t]), ylab = expression(Y[t]), col = rainbow(1000))
linesTorus(samp[, 1], samp[, 2], col = rainbow(1000))

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