Generate a vector from a Gamma distribution correlated with another distribution
rgammacor.RdAllow user to draw from a Gamma distribution correlated with a user specified vector
Value
a vector of the same length as x drawn from a normal distribution correlated with x at the level of rho
Examples
x <- rnorm(1000)
y <- rgammacor(x, 0.2)
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: NaNs produced
cor(x,y) # very close to 0.2
#> [1] 0.2159153
mean(y)
#> [1] 0.5108121
sd(y)
#> [1] 0.3584718