rTrajWn2D {sdetorus} | R 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 |
alpha |
vector of length |
mu |
a vector of length |
sigma |
vector of length |
rho |
correlation coefficient of |
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 |
deltaFine |
discretization step for the fine trajectory. Must be
smaller than |
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))