[R] [FORGED] Problem running mvrnorm
Rolf Turner
r.turner at auckland.ac.nz
Wed Nov 18 21:56:35 CET 2015
I cobbled together a 190 x 190 positive definite matrix Sigma and ran
your example. I got a result instantaneously, with no error message.
(I'm running Linux; an ancient Fedora 17 system.)
So the problem is peculiar to your particular Sigma.
As the error message tells you, the problem comes from doing an
eigendecomposition of Sigma. So start your investigation by doing
E <- eigen(Sigma,symmetric=TRUE)
Presumably that will lead to the same error. How to get around this
error is beyond the scope of my capabilities.
You *might* get somewhere by using the singular value decomposition
(equivalent for a positive definite matrix) rather than the
eigendecomposition. I have the vague notion that the svd is more
numerically robust than eigendecomposition. However I might well have
that wrong.
Doing anything in 190 dimensions is bound to be fraught with numeric
peril.
cheers,
Rolf Turner
--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
On 19/11/15 08:28, Gang Chen wrote:
> I’m running R 3.2.2 on a Linux server (Redhat 4.4.7-16), and having the
> following problem.
>
> It works fine with the following:
>
> require('MASS’)
> var(mvrnorm(n = 1000, rep(0, 2), Sigma=matrix(c(10,3,3,2),2,2)))
>
> However, when running the following in a loop with simulated data (Sigma):
>
> # Sigma defined somewhere else
> mvrnorm(n=1000, rep(0, 190), Sigma)
>
> I get this opaque message:
>
> *** caught illegal operation ***
> address 0x7fe78f8693d2, cause 'illegal operand'
>
> Traceback:
> 1: eigen(Sigma, symmetric = TRUE)
> 2: mvrnorm(n = nr, rep(0, NN), Sigma)
>
> Possible actions:
> 1: abort (with core dump, if enabled)
> 2: normal R exit
> 3: exit R without saving workspace
> 4: exit R saving workspace
>
> I tried to do core dump (option 1), but it didn’t go anywhere (hanging
> there forever). I also ran the same code on a Mac, and there was no problem
> at all. What is causing the problem on the Linux server? In case the
> variance-covariance matrix ‘Sigma’ is needed, I can provide its definition
> later.
More information about the R-help
mailing list