[R] sum(rnorm(n)), calculate more efficiently

Deepayan Sarkar deepayan at stat.wisc.edu
Wed Nov 20 19:12:24 CET 2002


On Wednesday 20 November 2002 09:58 am, Karsten D Bjerre wrote:
> I want to simulate the end point of a one-dimensional brownian motion going
> on for many timesteps (n very large). Can this be done more efficiently
> than (effect of drift excluded): endpoint <- sum(rnorm(n))

Do you really mean a one-dimensional random walk ?

The sum of n independent N(0,1) variables is N(0, n), so if you are interested 
in only the endpoint, you might as well use that fact.

Deepayan


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list