sde: Solve a one-dimensional SDE for arbitrary coefficient...

Description Usage Arguments Details Value

View source: R/solver.R

Description

Generate sample paths of processes solving one-dimensional SDEs with near arbitrary coefficient functions. Three schemes are available: Euler-Maruyama, RK2 and Milstein's method.

Usage

1
sde(x0, tt, dynamics, n = 1000, method = "milstein", plotG = TRUE)

Arguments

x0

initial point of the process

tt

the time horizon to solve over

dynamics

list of functions defining dynamics of the stochastic process, see details

n

number of time sub-intervals in the partition

method

the numerical integration method to use: "em", "rk2", or "milstein", see details

plotG

whether to plot the sample path in the function body

Details

For method = "milstein" one must pass single-variable coefficient functions and one can optionally pass the derivative of the volatility function if it is known, otherwise use a numeric approximation, as one of the two is required in the Milstein scheme. For method = "em" or "rk2", the coefficient functions ought to be functions of (t, x) but wrappers are made if this is not done.

The dynamics list must be a list of either 2 or 3 functions defining the infinitesimal drift function and the infinitesimal volatility function and optionally its derivative for the Milstein method.

Value

numeric/data.frame


shill1729/sdes documentation built on Aug. 30, 2021, 6:36 p.m.