Skip to content

Error messages

3 messages · Lorenz Gygax, Peter Dalgaard, Brian Ripley

#
Dear all,

The following works with a simple result of lm but gives the error with a
more complicated one (could this be due to singularities that occurr in
the model?).
Error: NAs in foreign function call (arg 6)
[1] "lm"

But, actually, I would like to ask a more general question: Is there a
place (I searched in the CRAN site) where I find information on what the
error means? It seems to tell me pretty exactly where the problem lies
(foreign function call arg6) but I don't understand it. 

Thanks for any hint. Regards,
--			~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lorenz Gygax		 LGygax at amath.unizh.ch;       room: 36-L-40
			 Department of Applied Mathematics
			 University of Zuerich-Irchel
			 Winterthurerstr. 190; CH-8057 Zurich
			 voice: 41-1-635-58-52  fax: 41-1-635-57-05
			~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Lorenz Gygax <lgygax at access.unizh.ch> writes:
Well, one of the things that R does not have is a centralised database
of error messages. *Next* time one invents a statistical programming
language, perhaps this would be something to consider...

Anyways, the error here means that a .Fortran or .C call had missing
values in one of the arguments. Probably in lm.influence's

    .Fortran("lminfl", lm.obj$qr$qr, n, n, k, lm.obj$qr$qraux, 
        lm.obj$coefficients, e, hat = double(n), coefficients = matrix(0, 
            nr = n, nc = k), sigma = double(n), DUP = FALSE)

the 6th arg of "lminfl" would be lm.obj$coefficients, so I suspect
your guess is correct when you say that singularities could be the
problem.

Take a look at help(traceback) and help(debug) to see how to find the
source of error messages.

[I seem to recall that there's a reason why lm.fit sticks in NA
(rather than zero) for undetermined coefficients, but I can't offhand
remember it. I suppose that lm.influence() would make sense even for
singular designs, so the current behaviour is likely a bug, not a
feature]
#
On 4 Jan 1999, Peter Dalgaard BSA wrote:

            
Yes, that's how you determine that the coefficients are not determined!
It is the simplest way to find out exactly how the degrees of freedom are
allocated to terms in models with factors, and also helps in omitting
values in printouts (rather than showing them as zero).

As for the bug, I think putting in zero would be a bug too, as the qr
matrix gets pivoted for singular models, and I see no sign of the pivots
being passed down to the Fortran program. At least lm.influence
should report on singular models (the S version handles them).