Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: Ben Bolker [mailto:bolker at ufl.edu]
> Sent: Friday, May 15, 2009 10:19 AM
> To: Greg Snow
> Cc: r-help at r-project.org
> Subject: Re: [R] Simulation
>
> Greg Snow wrote:
> > Another possibility (maybe more readable, gives the option of a list,
> probably not faster):
> >
> > Replicate(1000, rexp(15,1) )
> >
>
> I think that should be "replicate"
>
> The matrix form is quite a bit faster, but don't know if that will
> matter -- times below are for doing this task (1000 x 15 replicates)
> 1000 times ...
>
> > system.time(replicate(1000,replicate(1000,rexp(15,1))))
> user system elapsed
> 12.689 0.220 12.985
> > system.time(replicate(1000,matrix(rexp(15000,1),ncol=15)))
> user system elapsed
> 2.512 0.452 2.976
>
>
> --
> Ben Bolker
> Associate professor, Biology Dep't, Univ. of Florida
> bolker at ufl.edu / www.zoology.ufl.edu/bolker
> GPG key: www.zoology.ufl.edu/bolker/benbolker-publickey.asc