[R] error with princomp

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sun May 21 11:59:22 CEST 2000


Faheem Mitha <faheem at email.unc.edu> writes:

> Yup. I'm guessing the relevant part is 
> 
> if (symmetric) {
>         if (complex.x) {
>             xr <- Re(x)
>             xi <- Im(x)
>             z <- .Fortran("ch", n, n, xr, xi, values = dbl.n, 
>                 !only.values, vectors = xr, ivectors = xi, dbl.n, 
>                 dbl.n, double(2 * n), ierr = integer(1), PACKAGE = "base")
>             if (z$ierr) 
>                 stop(paste("ch returned code ", z$ierr, " in eigen"))
>             if (!only.values) 
>                 z$vectors <- matrix(complex(re = z$vectors, im =
> z$ivectors), 
>                   nc = n)
>         }
> 
> But this does not enlighten me. It seems to involve a call to some Fortran
> code, and I don't know Fortran.  And I am still freaked that it worked in
> Splus and not in R (same data set, same code).

The error message said that the problem was in "if (symmetric) {..."
so I'd suspect that it is because symmetric is not a logical - you're
not getting to the Fortran at all. Now, since eigen is not explicitly
being passed a "symmetric" argument, that must come from missing
values in the covariance matrix itself. So where do they come from?

One more hint: debug(princomp) and have a look at the generation of
"cv". It looks like it should be protected from missings, but there
might be a bug somewhere.


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list