# [R] Generating correlated data from uniform distribution

From: Ken Knoblauch <knoblauch_at_lyon.inserm.fr>
Date: Sat 02 Jul 2005 - 17:06:48 EST

While you are looking at weird distributions, here is one that  we have used in experiments on noise masking to explore the  bandwidth of visual mechanisms

D'Zmura, M., & Knoblauch, K. (1998). Spectral bandwidths for the detection of color.
Vision Research, 20, 3117-28 and
G. Monaci, G. Menegaz, S. Susstrunk and K. Knoblauch Chromatic Contrast Detection in Spatial
Chromatic Noise Visual Neuroscience, Vol. 21, No 3, pp. 291-294, 2004

```N <- 10000
x <- runif(N, -.5,.5)
y <- runif(N, -abs(x), abs(x))
```

plot(x,y)

y is not uniform but it is conditional on x. The plot reveals why we called this "sectored noise".

HTH ken

"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...

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))

```--
O__  ---- Peter Dalgaard             ุster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen   Denmark          Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX:
(+45) 35327907

____________________
Ken Knoblauch
Inserm U371, Cerveau et Vision
Department of Cognitive Neurosciences
18 avenue du Doyen Lepine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: 06 84 10 64 10
http://www.lyon.inserm.fr/371/

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
```
Received on Sat Jul 02 17:09:00 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:11 EST