How to generate bivariate exponential distribution?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to generate bivariate exponential distribution?

xuyongdeng
 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.
Reply | Threaded
Open this post in threaded view
|

Re: How to generate bivariate exponential distribution?

Petr Savicky-2
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-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: How to generate bivariate exponential distribution?

xuyongdeng
Petr Savicky-2, thanks you. It seems the code works very well. I use rate=1, so "common" is between 0 to 1. Thanks again.
Reply | Threaded
Open this post in threaded view
|

Re: How to generate bivariate exponential distribution?

curious_programmer
In reply to this post by Petr Savicky-2
thanks for the code, Petr.  

- what's the PDF of the bivariate exponential behind your code?
- what sampling method are you using to generate these random numbers?  is it rejection sampling?


thanx