Hi every one, I'm new to R. I read about R and search all the packages but I couldn't find the package that I want. I want to generate 2D (matrices) random numbers that have correlation between them. One of my friends said that R has a function in geor like rand...(spherical (correlation coefficient=0.5)), but I read all packages with geo,like geor,geoRlgm,georob and etc, but I didn't find this! Can you help me? Thanks. [[alternative HTML version deleted]]
Hi, This generate matrix: matrix( rnorm(5*4,mean=0,sd=1), 5, 4) for correlated matrix please see this link: http://stackoverflow.com/questions/10680658/how-can-i-create-a-correlation-matrix-in-r Karim On Wed, Nov 11, 2015 at 9:38 AM, leila zamani via R-help < r-help at r-project.org> wrote:> Hi every one, > I'm new to R. I read about R and search all the packages but I couldn't > find the package that I want. I want to generate 2D (matrices) random > numbers that have correlation between them. One of my friends said that R > has a function in geor like rand...(spherical (correlation > coefficient=0.5)), but I read all packages with geo,like > geor,geoRlgm,georob and etc, but I didn't find this! Can you help me? > Thanks. > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >[[alternative HTML version deleted]]
Dear Leila Does the function mvrnorm in package MASS do what you want? On 11/11/2015 08:38, leila zamani via R-help wrote:> Hi every one, > I'm new to R. I read about R and search all the packages but I couldn't find the package that I want. I want to generate 2D (matrices) random numbers that have correlation between them. One of my friends said that R has a function in geor like rand...(spherical (correlation coefficient=0.5)), but I read all packages with geo,like geor,geoRlgm,georob and etc, but I didn't find this! Can you help me? Thanks. > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >-- Michael http://www.dewey.myzen.co.uk/home.html