[R] question about R

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue May 11 18:56:23 CEST 2010


On Tue, May 11, 2010 at 12:36 PM,  <khazaei at ceremade.dauphine.fr> wrote:
> Hi,
> At each iteration in my program,I need to generate  tree vectors,X1,X2,X3,
> from exponential distribution with parameters a1,a2,a3. Can you help me
> please how can I do it such that it take a little time?

So, at each iteration you're sampling from three different exponential
distributions, each with rate parameters a1, a2, a3 respectively?

Say you have 100 iterations, you can create vectors of length 100
having samples from each distro like so:

R> dist1 <- rexp(100, rate=a1)
R> dist2 <- rexp(100, rate=a2)
R> dist3 <- rexp(100, rate=a3)

... and use them as you would expect where you need them.


Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

More information about the R-help mailing list