The mvrnorm function in the MASS package has an argument to force the generated data to have the exact mean/variance structure as specified which when used with a diagonal variance matrix will generate data that has a 0 (within round off error) correlation in the data. No post processing by Gramm-Schmidt or other methods needed. The author(s) of the function cleverly hid this feature by placing the information on the help page for the function.
-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Moshe Olshansky > Sent: Tuesday, July 07, 2009 9:10 PM > To: r-help@r-project.org; Luba (AIM SE)Stein > Subject: Re: [R] Uncorrelated random vectors > > > As mentioned by somebody before, there is no problem for the normal > case - use mvrnorm function from MASS package with any mu and make > Sigma be any diagonal matrix (with strictly positive diagonal). Note > that even though all the correlations are 0, the SAMPLE correlations > won't be 0. If you want to create a set of vectors whose SAMPLE > correlations are 0 you will have to use a variant of Gramm-Schmidt. > I do not know whether a variant of mvrnorm exists for logistic > distribution (my guess is that it does not). > > --- On Tue, 7/7/09, Stein, Luba (AIM SE) <luba.st...@allianz.com> > wrote: > > > From: Stein, Luba (AIM SE) <luba.st...@allianz.com> > > Subject: [R] Uncorrelated random vectors > > To: "r-help@r-project.org" <r-help@r-project.org> > > Received: Tuesday, 7 July, 2009, 11:45 PM > > Hello, > > > > is it possible to create two uncorrelated random vectors > > for a given distribution. > > > > In fact, I would like to have something like the function > > "rnorm" or "rlogis" with the extra property that they are > > uncorrelated. > > > > Thanks for your help, > > Luba > > > > > > > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@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. > > > > ______________________________________________ > R-help@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. ______________________________________________ R-help@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.