Dear All, I am using the following commands to generate a given dataset: a <-c(0.348,0.007,0.503,0.58,0.21) cov <-c(0.0448,0,0,0,0,0.0001,0.0001,0,0,0,-0.0055,-0.0005,0.0495,0,0,0.0218,0.0009,-0.0253,0.1103,0,-0.0102,-0.0007,0.00631,0.0067,0.0132) b <-matrix(cov,nrow=5, ncol = 5, byrow = TRUE,dimnames = NULL) g <-mvrnorm(10000,a,b) is there a way to place limits on the simulated values so that they all remain positive? I am simulating biological variables that should never be 0. thnaks, Andras [[alternative HTML version deleted]]
On Jun 9, 2012, at 11:00 PM, Andras Farkas wrote:> Dear All, > > I am using the following commands to generate a given dataset: > > a <-c(0.348,0.007,0.503,0.58,0.21) > cov <- > c > (0.0448,0,0,0,0,0.0001,0.0001,0,0,0 > ,-0.0055 > ,-0.0005,0.0495,0,0,0.0218,0.0009 > ,-0.0253,0.1103,0,-0.0102,-0.0007,0.00631,0.0067,0.0132) > b <-matrix(cov,nrow=5, ncol = 5, byrow = TRUE,dimnames = NULL) > g <-mvrnorm(10000,a,b) > > is there a way to place limits on the simulated values so that they > all remain positive? I am simulating biological variables that > should never be 0. >Have you considered choosing a distribution that respects the characteristics of your data? -- David Winsemius, MD West Hartford, CT
Dear Andras, More to the point, the distribution might not be multivariate normal. Ozgur -- View this message in context: http://r.789695.n4.nabble.com/mvrnorm-limits-tp4632913p4632930.html Sent from the R help mailing list archive at Nabble.com.