# How to generate bivariate exponential distribution? Classic List Threaded 4 messages Open this post in threaded view
|

## How to generate bivariate exponential distribution?

 Any one know is there any package or function to generate bivariate exponential distribution? I gusee there should be three parameters, two rate parameters and one correlation parameter. I just did not find any function available on R.  Any suggestion is appreciated.
Open this post in threaded view
|

## Re: How to generate bivariate exponential distribution?

 On Tue, Jun 14, 2011 at 08:40:00AM -0700, xuyongdeng wrote: >  Any one know is there any package or function to generate bivariate > exponential distribution? I gusee there should be three parameters, two rate > parameters and one correlation parameter. I just did not find any function > available on R.  Any suggestion is appreciated. Do you have a specific bivariate exponential distribution in mind? If not, then try the following   n <- 1000   lambda1 <- 2   lambda2 <- 3   common <- 1   x1 <- rexp(n, rate=lambda1-common)   x2 <- rexp(n, rate=lambda2-common)   z <- rexp(n, rate=common)   y1 <- pmin(x1, z)   y2 <- pmin(x2, z) The variables y1, y2 have exponential distribution with rates lambda1, lambda2 and they are positively correlated, if   0 < common < min(lambda1, lambda2) The correlation increases with increasing "common". Petr Savicky. ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.