reuler: Euler Scheme for Stochastic Differential Equations

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/reuleur.R

Description

If the process X_t is the unique strong solution of the process

dX_t = b(X_t)dt + s(X_t)dW_t,

then the Euler Scheme is X[t+h] = X[t] + b(X[t])h + s(X[t])sqrt(h)Z, where Z ~ N(0,1).

Usage

1
reuler(n, m, x0, b, s, t0 = 0, T = 1, all_dates = TRUE, delta = NULL)

Arguments

n

integer, number of paths.

m

integer, number of steps, the step size will be T/m.

x0

numeric, starting point of the process.

b

function, the drift, a function which can take a vector and returns a vector.

s

function, the volatility, a function which can take a vector and returns a vector.

t0

double, the starting date of the process.

T

double, the final date of the process.

all_dates

logical, if TRUE, returns all steps from all paths. If FALSE, only returns the n final value X_T.

delta

double, the step size.

Value

If all_dates = TRUE, it returns a n x m+1 matrix : n paths with m steps (+ the first value). Else, it returns a vector of length n with the simulations of the final dates X_T.

Author(s)

Nicolas Baradel - PGM Solutions

References

https://en.wikipedia.org/wiki/Euler

See Also

https://pgm-solutions.com/packages

Examples

1
2
3
mu <- 0.07
sigma <- 0.20
reuler(5, 10, 1, function(x) return(mu*x), function(x) return(sigma*x))

rpgm documentation built on March 18, 2018, 2:24 p.m.