Re: [R] Generating uniformly distributed correlated data.

2011-02-22 Thread Erich Neuwirth
You do not need the regions with the double densities near the center (1/2,1/2), you can use just the parallel 45 degree borders in that region also. > x-x > |/*\\\| > |---/***\\| > |--/*\| > |-/**/

Re: [R] Generating uniformly distributed correlated data.

2011-02-21 Thread Ted Harding
[OOPS! The example I gave before does not correspond to the stated seed. At the end is a revised example where I have checked that it does correspond. Sorry. ] On 21-Feb-11 21:38:11, Ted Harding wrote: > [See at end] > > On 21-Feb-11 17:13:03, Larry Hotchkiss wrote: >> Hi list: >> Here is one

Re: [R] Generating uniformly distributed correlated data.

2011-02-21 Thread Ted Harding
[See at end] On 21-Feb-11 17:13:03, Larry Hotchkiss wrote: > Hi list: > Here is one approach that will generate two uniformly distributed > variables with a correlation of 0.5 -- > [snip] >> > -Urspr?ngliche Nachricht- >> > Von:r-help-boun...@r-project.org >> > [mailto:r-help-boun..

Re: [R] Generating uniformly distributed correlated data.

2011-02-21 Thread David Winsemius
On Feb 21, 2011, at 9:53 AM, Erich Neuwirth wrote: We want to generate a distribution on the unit square with the following properties * It is concentrated on a "reasonable" subset of the square, and the restricted distribution is uniform on this subset. * Both marginal distributions are uni

Re: [R] Generating uniformly distributed correlated data.

2011-02-21 Thread Kjetil Halvorsen
, 2011 at 7:30 PM, Mike Marchywka wrote: > > > > > > > >> Date: Mon, 21 Feb 2011 15:53:26 +0100 >> From: erich.neuwi...@univie.ac.at >> To: marchy...@hotmail.com >> CC: soren.fau...@biology.au.dk; r-help@r-project

Re: [R] Generating uniformly distributed correlated data.

2011-02-21 Thread Mike Marchywka
> Date: Mon, 21 Feb 2011 15:53:26 +0100 > From: erich.neuwi...@univie.ac.at > To: marchy...@hotmail.com > CC: soren.fau...@biology.au.dk; r-help@r-project.org > Subject: Re: [R] Generating uniformly distributed correlated data. > >

Re: [R] Generating uniformly distributed correlated data.

2011-02-21 Thread Erich Neuwirth
We want to generate a distribution on the unit square with the following properties * It is concentrated on a "reasonable" subset of the square, and the restricted distribution is uniform on this subset. * Both marginal distributions are uniform on the unit interval. * All horizontal and all vert

Re: [R] Generating uniformly distributed correlated data.

2011-02-21 Thread Mike Marchywka
> Date: Mon, 21 Feb 2011 13:03:53 +0100 > From: erich.neuwi...@univie.ac.at > To: soren.fau...@biology.au.dk; r-help@r-project.org > Subject: Re: [R] Generating uniformly distributed correlated data. > > hw<-function(r)

Re: [R] Generating uniformly distributed correlated data.

2011-02-21 Thread Erich Neuwirth
hw<-function(r){ (3-sqrt(1+8*r))/4 } x<-runif(1000) y<-(x+runif(1000,-hw(0.5),hw(0.5))) %% 1 x and y will have correlation 0.5 and will be uniformly distributed on the unit interval. Replacing 0.5 by any nonnegative number r between 0 and 1 will create correlated uniformly distributed r

Re: [R] Generating uniformly distributed correlated data.

2011-02-20 Thread Søren Faurby
Thanks to everybody for helpfull answers. In case other people want to generate similar data at one time The one function I have found without any apparant bias ( such as extreme clustering of the datapoints along one or both diagonals in plot(x,y) or a slight bias in the generated correlatio

Re: [R] Generating uniformly distributed correlated data.

2011-02-20 Thread Sarah Goslee
On Sun, Feb 20, 2011 at 12:18 AM, Peter Langfelder wrote: > On Sat, Feb 19, 2011 at 6: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

Re: [R] Generating uniformly distributed correlated data.

2011-02-20 Thread Enrico Schumann
maybe this helps http://comisef.wikidot.com/tutorial:correlateduniformvariates regards enrico > -Ursprüngliche Nachricht- > Von: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] Im Auftrag von Søren Faurby > Gesendet: Sonntag, 20. Februar 2011 03:18 > An: r-help@r-

Re: [R] Generating uniformly distributed correlated data.

2011-02-20 Thread Spencer Graves
You may also be interested in the "psych" package or possibly "mvtBinaryEP". I found these using "sos": library(sos) tc <- findFn('tetrachoric correlation') # 26 matches tcs <- findFn('tetrachoric correlations')#27 matches tc. <- tc|tcs summary(tc.) # 35 links in 5 pkgs tc. All

Re: [R] Generating uniformly distributed correlated data.

2011-02-19 Thread Jorge Ivan Velez
Hi Soren, Take a look at http://tolstoy.newcastle.edu.au/R/help/05/07/7741.html HTH, Jorge On Sat, 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

Re: [R] Generating uniformly distributed correlated data.

2011-02-19 Thread Peter Langfelder
On Sat, Feb 19, 2011 at 6: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 gener

Re: [R] Generating uniformly distributed correlated data.

2011-02-19 Thread David Winsemius
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 dat