[R] Generating uniformly distributed correlated data.

David Winsemius dwinsemius at comcast.net
Sun Feb 20 06:16:00 CET 2011


On Feb 19, 2011, at 9:17 PM, Søren Faurby wrote:

> I wish to generate a vector of uniformly distributed data with a  
> defined correlation to another vector
>
> The only function I have been able to find doing something similar  
> is corgen from the library ecodist.
>
> The following code generates data with the desired correlation to  
> the vector x but the resulting vector y is normal and not uniform  
> distributed
>
> library(ecodist)
> x <- runif(10^5)
> y <- corgen(x=x, r=.5)$y
>
> Do anyone know a similar function generating uniform distributed  
> data or a way of transforming y to the desired distribution while  
> keeping the correlation between x and y

Package "copula" should support that.

(And.) These citations to the archives identified with an RSiteSearch  
search on terms:
uniform multivariate correlation

http://finzi.psych.upenn.edu/Rhelp10/2010-November/258834.html
http://finzi.psych.upenn.edu/R/Rhelp02/archive/57042.html

(Not technically the Archives.)

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list