[R] Generating uniformly distributed correlated data.

Enrico Schumann enricoschumann at yahoo.de
Sun Feb 20 12:36:43 CET 2011


maybe this helps
http://comisef.wikidot.com/tutorial:correlateduniformvariates

regards
enrico 

> -----Ursprüngliche Nachricht-----
> Von: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] Im Auftrag von Søren Faurby
> Gesendet: Sonntag, 20. Februar 2011 03:18
> An: r-help at r-project.org
> Betreff: [R] Generating uniformly distributed correlated data.
> 
> 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
> 
> Kind regards, Soren
> 
> ______________________________________________
> R-help at r-project.org 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.



More information about the R-help mailing list