[R] lm.influence on glm objects
Cipollini Fabrizio
cipollini at ds.unifi.it
Tue Mar 2 10:16:56 CET 2010
Dear R users
Today I discovered that function lm.influence() stops when applied to
glm objects with the following error message
Error in if (NROW(e) != n) stop("non-NA residual length does not match
cases used in fitting") :
argument is of length zero
After inspecting lm.influence.R (both into R-2.10.1.tar.gz and
R-patched.tar.gz) i found (line 53) that n is computed as
n <- as.integer(nrow(model$qr$qr))
However, glm objects (differently from lm objects) do not have a $qr
component. Is this intentional, i.e. it means that we have to use
lm.influence only with glm objects?
It could be, but I remark that the lm.influence{stats} help says:
The influence.measures() and other functions listed in See Also
provide a more user oriented way of computing a variety of regression
diagnostics. These all build on lm.influence. Note that for GLMs
(other than the Gaussian family with identity link) these are based on
one-step approximations which may be inadequate if a case has high
influence.
Moreover, if we have to use such a function only with lm objects, I
would suggest to implement some more explicit check.
Thanks in advance for any help
Fabrizio Cipollini
More information about the R-help
mailing list