euler2D {sdetorus}R Documentation

Simulation of trajectories of the WN or MvM diffusion in 2D

Description

Simulation of the Wrapped Normal (WN) diffusion or Multivariate von Mises (MvM) diffusion by the Euler method in 2D, for several starting values.

Usage

euler2D(x0, A, mu, sigma, rho = 0, N = 100L, delta = 0.01, type = 1L,
  maxK = 2L, expTrc = 30)

Arguments

x0

matrix of size c(nx0, 2) giving the initial points.

A

drift matrix of size c(2, 2).

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.

delta

discretization step.

type

integer giving the type of diffusion. Currently, only 1 for WN and 2 for vM are supported.

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 size c(nx0, 2, N + 1) containing the nx0 discretized trajectories. The first slice corresponds to the matrix x0.

Examples

N <- 100
nx0 <- 5
x0 <- seq(-pi, pi, l = nx0 + 1)[-(nx0 + 1)]
x0 <- as.matrix(expand.grid(x0, x0))
nx0 <- nx0^2
set.seed(12345678)
samp <- euler2D(x0 = x0, mu = c(0, 0), A = rbind(c(3, 1), 1:2),
                sigma = c(1, 1), N = N, delta = 0.01, type = 2)
plot(x0[, 1], x0[, 2], xlim = c(-pi, pi), ylim = c(-pi, pi), pch = 16,
     col = rainbow(nx0))
for (i in 1:nx0) linesTorus(samp[i, 1, ], samp[i, 2, ],
                           col = rainbow(nx0, alpha = 0.5)[i])

[Package sdetorus version 0.1.10 Index]