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

View source: R/sample-trajectories.R

rTrajWn1DR Documentation

Simulation of trajectories for the WN diffusion in 1D

Description

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

Usage

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 [\pi,\pi).

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

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))
}

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