op <- par(mfrow = c(2, 2))
## Brownian motion
X <- BM(N = 1000, M = 50)
plot(X,plot.type="single")
lines(as.vector(time(X)),rowMeans(X),col="red")
## Brownian bridge
X <- BB(N = 1000, M =50)
plot(X,plot.type="single")
lines(as.vector(time(X)),rowMeans(X),col="red")
## Geometric Brownian motion
X <- GBM(N = 1000, M = 50)
plot(X,plot.type="single")
lines(as.vector(time(X)),rowMeans(X),col="red")
## Arithmetic Brownian motion
X <- ABM(N = 1000, M = 50)
plot(X,plot.type="single")
lines(as.vector(time(X)),rowMeans(X),col="red")
par(op)
Run the code above in your browser using DataLab