rTrajWn1D: Simulation of trajectories for the WN diffusion in 1D

Description Usage Arguments Details Value Examples

View source: R/sample-trajectories.R

Description

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

Usage

1
2
rTrajWn1D(x0, alpha, mu, sigma, N = 100, delta = 0.01, NFine = ceiling(N
  * delta/deltaFine), deltaFine = min(delta/100, 0.001))

Arguments

x0

initial point.

alpha

drift parameter.

mu

mean parameter. Must be in [π,π).

sigma

diffusion coefficient.

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 vector of length N + 1 containing x0 in the first entry and the discretized trajectory.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
isRStudio <- identical(.Platform$GUI, "RStudio")
if (isRStudio) {
  manipulate::manipulate({
    x <- seq(0, N * delta, by = delta)
    plot(x, x, ylim = c(-pi, pi), type = "n", ylab = expression(X[t]), xlab = "t")
    linesCirc(x, rTrajWn1D(x0 = 0, alpha = alpha, mu = 0, sigma = sigma, N = N,
                             delta = 0.01))
    }, delta = slider(0.01, 5.01, step = 0.1),
    N = manipulate::slider(10, 500, step = 10, initial = 200),
    alpha = manipulate::slider(0.01, 5, step = 0.1, initial = 1),
    sigma = manipulate::slider(0.01, 5, step = 0.1, initial = 1))
}

sdetorus documentation built on Aug. 19, 2021, 9:06 a.m.

Related to rTrajWn1D in sdetorus...