Re: [R] How to create a random matrix with conditions

2013-01-28 Thread Jeff Newmiller
First you must learn to be more specific in your description of what you want. That will allow others to understand what you actually want rather than guessing. Perhaps try creating a small (3 var by 10 values) example, and describe the actual correlations you have created. If your problem is

Re: [R] How to create a random matrix with conditions

2013-01-28 Thread D. Rizopoulos
You didn't say how you want these variables to be distributed, but in case you want a multivariate normal, then have a look at function mvrnorm() from package MASS, and especially at the 'empirical' argument, e.g., library(MASS) # assumed covariance matrix V <- cbind(c(2, 1), c(1, 1.2)) V x1

[R] How to create a random matrix with conditions

2013-01-27 Thread Simon Givoli
Hi! I want to create a random matrix with 15 variables, each variable having 1000 observations. Between each two variables, I want to define a specific (*not *random) correlations between them, but still saving the "randomness" of each variable (mean=zero, s.d=1). How can I do this in R? thanks,

Re: [R] How to create a random matrix

2011-10-17 Thread adpb001
Thanks. bb=replicate(2, rnorm(20)) was very useful for me. -- View this message in context: http://r.789695.n4.nabble.com/How-to-create-a-random-matrix-tp901667p3912806.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.

Re: [R] How to create a random matrix

2009-08-25 Thread milton ruser
Like tris: NCols=5 NRows=7 myMat<-matrix(runif(NCols*NRows), ncol=NCols) myMat bests milton On Mon, Aug 24, 2009 at 6:17 PM, Peng Yu wrote: > Hi, > > I did a search but I was able to find how to generate a random matrix. > Can somebody let me know how to do it? > > Regards, > Peng > >

Re: [R] How to create a random matrix

2009-08-25 Thread Tal Galili
Here is another nice way of doing it: replicate(10, rnorm(20)) # this will give you 10 columns of vectors with 20 random variables taken from the normal distribution. If any one got a faster way of doing this, please let me know. Tal galili On Tue, Aug 25, 2009 at 1:30 AM, Rolf Turner wrot

Re: [R] How to create a random matrix

2009-08-24 Thread Rolf Turner
On 25/08/2009, at 10:17 AM, Peng Yu wrote: Hi, I did a search but I was able to find how to generate a random matrix. Can somebody let me know how to do it? Uhhh, generate some random numbers and then arrange them in a matrix? ?matrix ?runif ?rnorm ?rgamma . . . cheers,

[R] How to create a random matrix

2009-08-24 Thread Peng Yu
Hi, I did a search but I was able to find how to generate a random matrix. Can somebody let me know how to do it? Regards, Peng __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://ww