[R] How to generate bivariate exponential distribution?
Petr Savicky
savicky at praha1.ff.cuni.cz
Wed Jun 15 09:33:00 CEST 2011
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.
More information about the R-help
mailing list