A strange behavior of the mvrnorm() function occured to me as I tried to make some calculation in one of the arguments.
This does do the job:
mvrnorm(
n=200,
mu = c('x'=0,'y'=0),
Sigma = matrix(c(1,0.5,0.5,1),nrow = 2),
empirical = TRUE)
Yet, replacing n = 200 with n = (1-0.8)*1000, does NOT do the job:
mvrnorm(
n=(1-0.8)*1000,
mu = c('x'=0,'y'=0),
Sigma = matrix(c(1,0.5,0.5,1),nrow = 2),
empirical = TRUE)
Error in eS$vectors %*% diag(sqrt(pmax(ev, 0)), p) %*% t(X) :
non-conformable arguments
In addition: Warning message:
In matrix(rnorm(p * n), n) :
data length [399] is not a sub-multiple or multiple of the number of rows [199]
Why is this hapening?