Skip to content
Prev 45227 / 63424 Next

nobs() with glm(family="poisson")

I cannot believes nobody cares about this -- or I'm completely wrong and
in that case everybody should rush to put the shame on me... :-p

In the meantime, I have come up with an alternative way of fixing this:
when modeling count data, glm() could allow users to pass a table as the
data argument, and convert it to a data frame using
as.data.frame.table() instead of requiring the user to do it
beforehand[1]. This would become the recommended way of fitting models
for count data, and the fact that a table is passed could be used as the
sign that nobs() should return the sum of cell counts instead of the
number of rows in the data.frame.


Regards


1: gnm already supports this pattern, with the additional advantage that
e.g. fitted(), predict(), residuals() and weights() return an object of
the same dimensions and dimnames as the original table.


Le lundi 18 f?vrier 2013 ? 12:22 +0100, Milan Bouchet-Valat a ?crit :