Skip to content
Prev 640 / 7420 Next

testing for distribution

Dear Jacob,

Erika was right, you just have to perform a goodness of fit test. Bit
it is easier
to inspect your residual deviance.
It follows a Chi-sqared distribution, where the expected value should
be close to
the degrees of freedom if the fit is good. To get a P value for an
object of class
"negbin" (inheriting from glm and lm), use (note, H0: the fit is good):

library(MASS)
mod <- glm.nb(...your model...)
1-pchisq(mod$deviance, mod$df.residual)

If you are using other functions (i.e. in package pscl), the structure
of the returned object might change,
in this case simply type the numbers instead.

Cheers,

P?ter

P?ter S?lymos, PhD
Postdoctoral Fellow
Department of Mathematical and Statistical Sciences
University of Alberta
Edmonton, Alberta, T6G 2G1
Canada
email <- paste("solymos", "ualberta.ca", sep = "@")
On Wed, May 13, 2009 at 12:17 PM, Erika Mudrak <mudrak at wisc.edu> wrote: