Re: [R] rexp question

From: Greg Snow <Greg.Snow_at_intermountainmail.org>
Date: Wed 16 Aug 2006 - 04:30:47 EST


Try:

> rexp(n=200*length(r), rate=rep(r, each=200) )

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow@intermountainmail.org
(801) 408-8111
 

-----Original Message-----
From: r-help-bounces@stat.math.ethz.ch
[mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Spencer Jones
Sent: Tuesday, August 15, 2006 12:15 PM
To: R-Help
Subject: [R] rexp question

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.

______________________________________________
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:38:38 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:34 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.