[R] Generating correlated data from uniform distribution

Spencer Graves spencer.graves at pdf.com
Sat Jul 2 01:43:11 CEST 2005


	  Peter is absolutely correct:  The "correlation" I used was for a 
hidden normal process, not for the resultant correlated uniforms.  This 
is similar to but different from "tetrachoric corrrelations", about 
which there is a substantial literature (including an R package 
"polycor").

	  Why do you want correlated uniforms?  What do they represent 
physically?  Does it matter if you can match exactly a particular 
correlation coefficient, or is it enough to say that they are uniformily 
distributed random variables such that their normal scores have a 
specified correlation coefficient?  There is so much known about the 
multivariate normal distribution and so little about correlated uniforms 
that it might be more useful to know the correlations of latent normals, 
for which your uniforms are what are measured.

	  spencer graves 	

Peter Dalgaard wrote:

> "Jim Brennan" <jfbrennan at rogers.com> writes:
> 
> 
>>Yes you are right I guess this works only for normal data. Free advice
>>sometimes comes with too little consideration :-)
> 
> 
> Worth every cent...
> 
> 
>>Sorry about that and thanks to Spencer for the correct way.
> 
> 
> Hmm, but is it? Or rather, what is the relation between the
> correlation of the normals  and that of the transformed variables? 
> Looks nontrivial to me.
> 
> Incidentally, here's a way that satisfies the criteria, but in a
> rather weird way:
> 
> N <- 10000
> rho <- .6
> x <- runif(N, -.5,.5)
> y <- x * sample(c(1,-1), N, replace=T, prob=c((1+rho)/2,(1-rho)/2))
> 

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

spencer.graves at pdf.com
www.pdf.com <http://www.pdf.com>
Tel:  408-938-4420
Fax: 408-280-7915




More information about the R-help mailing list