[R] mvrnorm problem

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Feb 3 12:42:57 CET 2004


As Peter Dalgaard has already pointed out, you both need to read the help 
page.

If you supply a matrix where the help page asks for a vector, you are 
likely to get troubles.  I will coerce it for the next version, but I 
would like to point out that in about 12 years of providing mvrnorm (often 
as here without credit), this it the first time anyone has made this error 
in public.  Anticipating what people will try is not easy.

On Mon, 2 Feb 2004 Ted.Harding at nessie.mcc.ac.uk wrote:

> On 02-Feb-04 Stuart V Jordan wrote:
> > I am trying to simulate draws from a multivariate normal using mvrnorm,
> > and
> > am getting the following error message:
> >  
> >     Error in mu + eS$vectors %*% diag(sqrt(pmax(ev, 0)), p) %*% t(X) : 
> >             non-conformable arrays
> [...]
> 
> Hmmm ... using the same B and V as giben by Stuart Jordan, I get:
> 
> > mvrnorm(1,B,V)
>  [1]  -179.8332342     0.9632282     2.5687489    -2.2337125    47.2717626
>  [6] -3745.3844310     0.9632282     0.2839965    -0.1500585     0.5804460
> [11]     5.1919420    -4.7381677    -0.2382119
> > mvrnorm(2,B,V)
> Error in mu + eS$vectors %*% diag(sqrt(pmax(ev, 0)), p) %*% t(X) : 
>         non-conformable arrays
> 
> ?????
> 
> Ted.
> 
> PS By the way, [near] singularity seems to have nothing to do
>    with it here:
>    If I brutally make V non-singular:
> 
>      diag(V) <- diag(V)+10000000
> 
>    it goes the same way.
> 
> 
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
> Fax-to-email: +44 (0)870 167 1972
> Date: 02-Feb-04                                       Time: 22:17:13
> ------------------------------ XFMail ------------------------------
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list