[R] simple loop problemo (Geo brownian motion)

2010-11-19 Thread newbster
I would like to plot multiple random walks onto the same graph. My p variable dictates how may random walks there will be. par(mfrow=c(1,1)) p - 100 N - 1000 S0 - 10 mu - 0.03 sigma - 0.2 nu - mu-sigma^2/2 x - matrix(rep(0,(N+1)*p),nrow=(N+1)) y - matrix(rep(0,(N+1)*p),nrow=(N+1)) t-

Re: [R] simple loop problemo (Geo brownian motion)

2010-11-19 Thread Duncan Murdoch
On 19/11/2010 1:09 PM, newbster wrote: I would like to plot multiple random walks onto the same graph. My p variable dictates how may random walks there will be. par(mfrow=c(1,1)) p- 100 N- 1000 S0- 10 mu- 0.03 sigma- 0.2 nu- mu-sigma^2/2 x- matrix(rep(0,(N+1)*p),nrow=(N+1)) y-

Re: [R] simple loop problemo (Geo brownian motion)

2010-11-19 Thread Yihui Xie
Maybe you can consider the brownian.motion() function in the animation package, e.g. library(animation) ani.options(interval = 0.05, nmax = 150) brownian.motion(pch = 21, cex = 5, col = red, bg = yellow, main = Demonstration of Brownian Motion) Or here is another (awkward) example of several