stepAheadWn1D {sdetorus}R Documentation

Multiple simulation of trajectory ends of the WN or vM diffusion in 1D

Description

Simulates M trajectories starting from different initial values x0 of the WN or vM diffusion in 1D, by the Euler method, and returns their ends.

Usage

stepAheadWn1D(x0, alpha, mu, sigma, M, N = 100L, delta = 0.01, type = 1L,
  maxK = 2L, expTrc = 30)

Arguments

x0

vector of length nx0 giving the initial points.

alpha

drift parameter.

mu

mean parameter. Must be in [\pi,\pi).

sigma

diffusion coefficient.

M

number of Monte Carlo replicates.

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

A matrix of size c(nx0, M) containing the M trajectory ends for each starting value x0.

Examples

N <- 100
nx0 <- 20
x0 <- seq(-pi, pi, l = nx0 + 1)[-(nx0 + 1)]
set.seed(12345678)
samp1 <- euler1D(x0 = x0, mu = 0, alpha = 3, sigma = 1, N = N,
                 delta = 0.01, type = 2)
tt <- seq(0, 1, l = N + 1)
plot(rep(0, nx0), x0, pch = 16, col = rainbow(nx0), xlim = c(0, 1))
for (i in 1:nx0) linesCirc(tt, samp1[i, ], col = rainbow(nx0)[i])
set.seed(12345678)
samp2 <- stepAheadWn1D(x0 = x0, mu = 0, alpha = 3, sigma = 1, M = 1,
                       N = N, delta = 0.01, type = 2)
points(rep(1, nx0), samp2[, 1], pch = 16, col = rainbow(nx0))
samp1[, N + 1]
samp2[, 1]

[Package sdetorus version 0.1.10 Index]