Stuart V Jordan <sjordan at princeton.edu> writes:
Error in mu + eS$vectors %*% diag(sqrt(pmax(ev, 0)), p) %*% t(X) :
non-conformable arrays
Error in mu + eS$vectors %*% diag(sqrt(pmax(ev, 0)), p) %*% t(X) :
non-conformable arrays
You might, for at least two good reasons, have said that this is from
library(MASS). The point is that
mvrnorm(n=10,matrix(c(1,1),1,2),diag(2))
Error in mu + eS$vectors %*% diag(sqrt(pmax(ev, 0)), p) %*% t(X) :
non-conformable arrays
mvrnorm(n=10,matrix(c(1,1),2,1),diag(2))
Error in mu + eS$vectors %*% diag(sqrt(pmax(ev, 0)), p) %*% t(X) :
non-conformable arrays
mvrnorm(n=10,c(1,1),diag(2))
[,1] [,2]
[1,] 0.5005327 1.1919216
[2,] 2.8273925 2.7004788
[3,] 2.6493970 1.1304274
....
and the docs quite clearly say that mu wants to be a vector, not a
matrix.
Curiously enough, this works with rmvnorm from the mvtnorm package by
Genz, Bretz, and Hothorn, the difference being that this version adds
in the means with a sweep() operation, whereas mvrnorm just adds mu
(to the transpose of the ultimate result) and relies on recycling
rules.