Hi all. I was having some trouble with a for loop and I found the problem is the following. Does anyone have some idea why I got the following R result? Since mone is equal to 3, why mu1 only have 2 components?
library(MASS) > p0 <- seq(0.1, 0.9,by=0.1) > m <- 10 > > > p0 <- p0[7] > > ## data generation > > mzero <- p0*m > mone <- m-mzero > mu1 <- rnorm(mone, 0,1) > mu <- c(rep(0,mzero), mu1) > > var <- diag(m) > zv <- mvrnorm(n, mu, var) Error in mvrnorm(n, mu, var) : incompatible arguments > mone [1] 3 > mu1 [1] -0.08802108 0.77904786 [[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.