[R] rexp question

From: Spencer Jones <ssj1364_at_gmail.com>
Date: Wed 16 Aug 2006 - 04:14:58 EST


I am using rexp to generate several exponential distributions. I am passing rexp a vector of rates , r. I am wanting to simulate a sample of size 200 for each rate so the code looks like: rexp(n=200*length(r),rate=r) this gives me a vector of the random exponential variables, but they are all disjointed b/c rexp goes through and simulates an exponential variable for each rate and it does that 200 times, is there any way to get it to do it the oppisite way,i.e., 200 times in a row for each rate. I have already tried using a for loop but it is slow.

thanks,

Spencer

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed Aug 16 04:22:04 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 16 Aug 2006 - 06:21:33 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.