[R] Odd error from mvrnorm?
John Hodgson
john at formby.plus.com
Thu Oct 9 18:43:35 CEST 2014
I have tried to generate multivariate normal samples with the following
means and co-variances
> mu
[1] 1.4696642 6.3169666 -3.8702044 0.8411024 -2.6525455 6.1894152
> Sigma
[,1] [,2] [,3] [,4]
[,5] [,6]
[1,] 0.00015768570 0.002258112 -0.0007021312 0.007184825
-0.00009748966 -0.2297289
[2,] 0.00225811184 0.456999600 -0.5582839996 -1.296776834
0.97284350454 -5.1210395
[3,] -0.00070213121 -0.558284000 1.2288752207 -0.333759058
-2.54049486833 4.5709810
[4,] 0.00718482510 -1.296776834 -0.3337590577 3443.775312311
0.25065256727 -11.5361060
[5,] -0.00009748966 0.972843505 -2.5404948683 0.250652567
6.42422097236 -15.2357478
[6,] -0.22972890073 -5.121039455 4.5709810480 -11.536106031
-15.23574783025 422.4494214
>
But get the following error message
> mvrnorm(n=1,mu=mu,Sigma=Sigma)
Error in drop(mu) + eS$vectors %*% diag(sqrt(pmax(ev, 0)), p) %*% t(X) :
non-conformable arrays
I can see that the values in Sigma are extremely variable in magnitude,
but the matrix is not singular,
and the error message does not seem to point in this direction.
Can anyone see what I'm missing, or suggest a line of attack?
Thanks
John Hodgson
More information about the R-help
mailing list