- shuffle = sample(n)
- list("X"=X[shuffle,], "Y"=Y[shuffle,], "class"=class[shuffle])
+ for (i in 1:k)
+ {
+ class <- c(class, rep(i, sizePop[i]))
+ newBlockX <- MASS::mvrnorm(sizePop[i], meanX, covX)
+ X <- rbind(X, newBlockX)
+ Y <- rbind(Y, t(apply(newBlockX, 1, function(row) MASS::mvrnorm(1, row %*%
+ beta[, , i], covY[,]))))
+ }
+
+ shuffle <- sample(n)
+ list(X = X[shuffle, ], Y = Y[shuffle, ], class = class[shuffle])