Simulate a multivariate Brownian motion

rvBM(times, n = 1, sigma = rep(1, n), B0 = rep(0, n), u = rep(0, n))

Arguments

times

numeric vector of time points where the Brownian motion should be simulated

n

numeric scalar, dimension of Brownian motion

sigma

noise level in the Brownian motion. A vector of length n, one for each dimension, or a scalar, in which case the same level is applied to all dimensions.

B0

initial condition, applicable at time t=0. A vector of length n, one for each dimension, or a scalar, in which case the same initial condition is applied to all dimensions.

u

Drift. An optional numeric n-vector which defaults to a vector of zeros. When supplied, a linear drift (bias) is added to each component.

Value

a numeric array, n*length(times), each column containing a sample path

Examples

times <- 0:10
VB <- rvBM(times,3)
matplot(times,VB,type="b")