[R] diagnostic information in glm. How about N of missing observations?
Barry Rowlingson
B.Rowlingson at lancaster.ac.uk
Fri Dec 19 13:53:09 CET 2003
Frank E Harrell Jr wrote:
> Fitting functions in the Design package tell you how many observations
> were deleted due to each variable in the model. They generalize the
> na.action component stored in the fit object.
Surely accessing components of an object is generally a bad idea on
O-O design, and there ought to be a _method_ that returns which
observations have been omitted. Perhaps an 'omitted' function?
Currently the $na.action component of lm (and glm) objects is an
object of class "omit" (or possibly 'exclude', or even something else),
which doesn't even have a print method of its own.
Bizarrely it has an 'naprint' method:
> naprint(fit$na.action)
[1] "2 observations deleted due to missing"
But that returns a string which you'd have to cut up to get the number
2 out of it. And why isn't that the 'print' method?
naprint.lm remains to be written, so this reverts to na.default:
> naprint(fit)
[1] ""
Which at the very least is misleading...
And relying on the $na.action object to store the omitted rows is
asking for trouble - this element is already being used for different
classes of object, so who knows what might be in it in the future...
Is all this due for a rewrite for R 2.0.0?
Baz
More information about the R-help
mailing list