Learn R Programming

animation (version 2.8)

brownian.motion: Demonstration of Brownian motion on the 2D plane

Description

Brownian motion, or random walk, can be regarded as the trace of some cumulative normal random numbers.

Usage

brownian.motion(n = 10, xlim = c(-20, 20), ylim = c(-20, 20), ...)

Value

None (invisible NULL).

Arguments

n

Number of points in the scatterplot

xlim, ylim

Arguments passed to plot.default to control the apperance of the scatterplot (title, points, etc), see points for details.

...

other arguments passed to plot.default

Author

Yihui Xie

Details

The location of the next step is ``current location + random Gaussian numbers'', i.e.,

$$x_{k + 1} = x_{k} + rnorm(1)$$

$$y_{k + 1} = y_{k} + rnorm(1)$$

where (x, y) stands for the location of a point.

References

Examples at https://yihui.org/animation/example/brownian-motion/

See Also