[R] deviance in glm
Chong Gu
chong at stat.purdue.edu
Thu Mar 8 22:18:06 CET 2001
Folks,
I am not sure if it's a feature or a "bug". The same is observed in
Splus.
Suppose I have Poisson counts, and I would like to estimate the
parameter using glm. I would assume I can feed it the individual
counts, or I can feed it the distinctive counts with the frequency as
the weights, and I would get the same results. I do, but the deviance
df are returned differently. Here is a short session.
y<-rpois(1000,5)
fr<-as.vector(table(y))
yy<-0:(length(fr)-1)
glm(y~1,poisson)
glm(yy~1,poisson,weight=fr)
I believe the first call to glm gives the correct df, but with real
data, do I have to break up the tabulated data to get it right from R
(or Splus), or I just have to manually calculate the df? Can this be
potentially misleading to practitioners?
Or maybe my thinking was off?
I tried similar things with Bernoulli data and got similar results.
Chong Gu
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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