Jay, Yes I'm looking for unif(0,1) and your method works just fine. I suppose your method should work for dimensions greater than 2, am I right?
Michael On Sat, Nov 6, 2010 at 8:05 PM, G. Jay Kerns <gke...@ysu.edu> wrote: > Dear Michael, > > On Sat, Nov 6, 2010 at 7:27 PM, michael <tufemich...@gmail.com> wrote: > > Ted, > > > > Thanks for your help, it is right on the money! > > > > for your comments: > > 1. Yes I mean 100 by 2, each variable x1, x2 is 100 by 1. > > 2. The correlation is the only free parameter. > > > > Michael > > > > > > I like Ted's solution. If all you are looking for is unif(0,1), you > could use the Probability Integral Transform; something like this: > > set.seed(1) > > library(MASS) > S <- matrix(c(1, 0.9, 0.9, 1), nrow = 2) > X <- mvrnorm(100, mu = c(0,0), Sigma = S) > Y <- pnorm(X) > > var(Y) > cor(Y) > > You could also use copulas, but those depend on contributed packages > (and you can read more about them on the CRAN Task View for > probability distributions). > > Hope this helps, > Jay > > > __________________________ > G. Jay Kerns, Ph.D. > Youngstown State University > http://people.ysu.edu/~gkerns/ > [[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.