The noise processes of DiffEqNoiseProcess.jl, for the noise argument of
SDEProblem() and RODEProblem(), or on their own with
NoiseProblem(). A process is a function: W(t) returns its value at
t, bridged between saved points (the bridged point is then saved) or
simulated past the last one; W$t and W$W hold the saved path.
Usage
RSWM(
discard_length = 1e-15,
adaptivealg = c("RSwM3", "RSwM2", "RSwM1", "RSwM0")
)
NoiseProcess(
t0,
W0,
Z0 = NULL,
dist,
bridge = NULL,
rswm = RSWM(),
save_everystep = TRUE,
covariance = NULL,
reset = TRUE,
reseed = TRUE,
continuous = TRUE
)
SimpleNoiseProcess(
t0,
W0,
Z0 = NULL,
dist,
bridge = NULL,
save_everystep = TRUE,
covariance = NULL,
reset = TRUE,
reseed = TRUE
)
WienerProcess(t0, W0, Z0 = NULL, ...)
RealWienerProcess(t0, W0, Z0 = NULL, ...)
SimpleWienerProcess(t0, W0, Z0 = NULL, ...)
CorrelatedWienerProcess(Gamma, t0, W0, Z0 = NULL, ...)
GeometricBrownianMotionProcess(mu, sigma, t0, W0, Z0 = NULL, ...)
OrnsteinUhlenbeckProcess(Theta, mu, sigma, t0, W0, Z0 = NULL, ...)
CompoundPoissonProcess(
rate,
t0,
W0,
computerates = TRUE,
rswm = RSWM(adaptivealg = "RSwM0"),
...
)
BrownianBridge(t0, tend, W0, Wend, Z0 = NULL, Zend = NULL, ...)
GeometricBrownianBridge(
mu,
sigma,
t0,
tend,
W0,
Wend,
Z0 = NULL,
Zend = NULL,
...
)
OrnsteinUhlenbeckBridge(Theta, mu, sigma, t0, tend, W0, Wend, Z0 = NULL, ...)
CompoundPoissonBridge(rate, t0, tend, W0, Wend, rswm = RSWM(), ...)
calculate_step(W, dt, u = NULL, p = NULL)
setup_next_step(W, u = NULL, p = NULL)
accept_step(W, dt, u = NULL, p = NULL, setup_next = TRUE)
reject_step(W, dtnew, u = NULL, p = NULL)
save_noise(W)
resize_noise(W, n)
addat_noise(W, i)
deleteat_noise(W, i)
fill_new_noise_caches(W, i)
NoiseGrid(t, W, Z = NULL, reset = TRUE)
NoiseFunction(t0, W, Z = NULL, reset = TRUE)
NoiseTransport(t0, W, RV, rv = NULL, Z = NULL, reset = TRUE, reseed = TRUE)
NoiseWrapper(source, reset = TRUE, reverse = FALSE, indx = NULL)
NoiseApproximation(source1, source2 = NULL, reset = TRUE)
VirtualBrownianTree(
t0,
W0,
Z0 = NULL,
dist = .white_dist,
bridge = NULL,
tend = NULL,
Wend = NULL,
Zend = NULL,
atol = 1e-10,
tree_depth = 4L,
search_depth = NULL,
seed = NULL,
reset = TRUE
)
BoxWedgeTail(
t0,
W0,
Z0 = NULL,
dist = .white_dist,
bridge = .white_bridge,
rtol = 1e-08,
nr = 4L,
na = 4L,
nz = 10L,
box_grouping = c("MinEntropy", "Columns", "none"),
sqeezing = TRUE,
save_everystep = TRUE,
reset = TRUE,
reseed = TRUE
)
pCN(source, rho, reset = TRUE, reverse = FALSE, indx = NULL)
NoiseProblem(noise, tspan, seed = 0L, ...)Arguments
- discard_length
Shortest stored future increment.
- adaptivealg
"RSwM3","RSwM2","RSwM1"or"RSwM0".- t0, tend
Initial and final times.
- W0, Z0, Wend, Zend
Initial and final values.
- dist, bridge
Increment distribution and bridge, see Details.
- rswm
Rejection sampling with memory, from
RSWM().- save_everystep
Save every step of the path.
- covariance
Covariance of a correlated process.
- reset, reseed
Restart from
t0(and draw a new path) when a solve uses the process.- continuous
Whether the path is continuous (for interpolation).
- ...
Options.
- Gamma
Covariance matrix per unit time.
- mu, sigma, Theta
Process parameters.
- rate
Event intensity: a function
rate(u, p, t)or a number.- computerates
Recompute the rate at every step.
- dt, dtnew
Step sizes.
- u, p
State and parameters for state dependent noise.
- setup_next
Draw the next increment after accepting.
- i, n
Components to add or delete; new number of components.
- t, W, Z, RV, rv
Path data, see Details.
- source, source1, source2
Noise sources, see Details.
- reverse, indx
Reverse time; components of the source to use.
- tree_depth, search_depth, atol
Virtual Brownian tree resolution.
- seed
Seed of the random number generator.
- rtol, nr, na, nz, box_grouping, sqeezing
Box wedge tail sampler settings; R samples the area by inverting its conditional distribution to
rtol.- rho
Correlation of the pCN proposal.
- noise
A noise process.
- tspan
Time span.
Details
WienerProcess(t0, W0, Z0) is Brownian motion started at W0 (a vector
gives independent components); Z0 adds a second, independent process
(W$Z), used by solvers that need two Wiener processes. RealWienerProcess(),
SimpleWienerProcess() (no rejection memory: adaptive rejections are an
error) and CorrelatedWienerProcess(Gamma, t0, W0) (covariance Gamma per
unit time) are variants. GeometricBrownianMotionProcess(mu, sigma, t0, W0) and OrnsteinUhlenbeckProcess(Theta, mu, sigma, t0, W0) are exact
samples of those processes; CompoundPoissonProcess(rate, t0, W0) counts
Poisson events with intensity rate(u, p, t) (with computerates = FALSE
the rate is fixed at rate). BrownianBridge(t0, tend, W0, Wend),
GeometricBrownianBridge(), OrnsteinUhlenbeckBridge() and
CompoundPoissonBridge() are the same processes conditioned to reach
Wend at tend.
NoiseProcess(t0, W0, Z0, dist, bridge) builds a process from its
increment distribution dist(dW, W, dt, u, p, t, rng) and its bridge
bridge(dW, W, W0, Wh, q, h, u, p, t, rng) (both return increments; rng
is NULL as R uses its own generator). rswm = RSWM() chooses the
rejection sampling with memory (adaptivealg = "RSwM3" keeps the rejected
future increments, "RSwM0" discards them, for state dependent noise).
SimpleNoiseProcess() has no rejection memory.
NoiseGrid(t, W, Z) is a fixed path interpolated linearly;
NoiseFunction(t0, W, Z) a path given by W(u, p, t);
NoiseWrapper(source) replays a saved process (a noise process, the
Brownian path sol$W of an SDE solution, or the solution itself), bridged
between its points, optionally reversed in time or restricted to the
components indx; NoiseApproximation(source1, source2) takes the path
from the solution of a differential equation integrator (see init());
NoiseTransport(t0, W, RV, rv) is W(u, p, t, rv) with a random variable
rv drawn from RV() at every reset; VirtualBrownianTree(t0, W0, tend = , Wend = ) is Brownian motion evaluated by bisection from stored seeds, so
any value can be recomputed without storing the path; BoxWedgeTail(t0, W0) is two dimensional Brownian motion whose steps also sample the Levy
area W$A from its exact joint density with the increment (Gaines and
Lyons). pCN(source, rho) is the preconditioned Crank-Nicolson proposal
rho W + sqrt(1 - rho^2) W' with an independent Brownian path W'.
accept_step(), reject_step(), calculate_step(), setup_next_step()
and save_noise() step a process by hand, as an SDE integrator does:
calculate_step(W, dt) draws the pending increment W$dW over dt,
accept_step(W, dt) adds it and draws the next one, reject_step(W, dtnew) replaces it by a bridged increment over dtnew, keeping the rest
for later steps. resize_noise(), addat_noise() and deleteat_noise()
change the number of components (as callbacks that resize the state do).
Examples
W <- WienerProcess(0, 0)
prob <- NoiseProblem(W, c(0, 1))
sol <- solve(prob, dt = 0.1, seed = 1)
sol(0.55)
#> [1] -0.1057251
ou <- OrnsteinUhlenbeckProcess(1, 0, 0.3, 0, 1)
f <- function(u, p, t) -u
g <- function(u, p, t) 0.1
s <- solve(SDEProblem(f, g, 1, c(0, 1), noise = ou), EM(), dt = 0.01, seed = 2)
s$retcode
#> [1] "Success"