Last chance! 50% off unlimited learning
Sale ends in
Tests the null hypothesis of equidispersion in Poisson GLMs against the alternative of overdispersion and/or underdispersion.
dispersiontest(object, trafo = NULL, alternative = c("greater", "two.sided", "less"))
An object of class "htest"
.
a fitted Poisson GLM of class "glm"
as fitted
by glm
with family poisson
.
a specification of the alternative (see also details),
can be numeric or a (positive) function or NULL
(the default).
a character string specifying the alternative hypothesis:
"greater"
corresponds to overdispersion, "less"
to
underdispersion and "two.sided"
to either one.
The standard Poisson GLM models the (conditional) mean
dispersiontest
assesses the hypothesis that this assumption holds (equidispersion) against
the alternative that the variance is of the form:
Common specifications of the transformation function trafo = NULL
, the latter dispersion formulation is used in
dispersiontest
. Otherwise, if trafo
is specified, the test is formulated
in terms of the parameter trafo
can either
be specified as a function or an integer corresponding to the function function(x) x^trafo
,
such that trafo = 1
and trafo = 2
yield the linear and quadratic formulations
respectively.
Cameron, A.C. and Trivedi, P.K. (1990). Regression-based Tests for Overdispersion in the Poisson Model. Journal of Econometrics, 46, 347--364.
Cameron, A.C. and Trivedi, P.K. (1998). Regression Analysis of Count Data. Cambridge: Cambridge University Press.
Cameron, A.C. and Trivedi, P.K. (2005). Microeconometrics: Methods and Applications. Cambridge: Cambridge University Press.
data("RecreationDemand")
rd <- glm(trips ~ ., data = RecreationDemand, family = poisson)
## linear specification (in terms of dispersion)
dispersiontest(rd)
## linear specification (in terms of alpha)
dispersiontest(rd, trafo = 1)
## quadratic specification (in terms of alpha)
dispersiontest(rd, trafo = 2)
dispersiontest(rd, trafo = function(x) x^2)
## further examples
data("DoctorVisits")
dv <- glm(visits ~ . + I(age^2), data = DoctorVisits, family = poisson)
dispersiontest(dv)
data("NMES1988")
nmes <- glm(visits ~ health + age + gender + married + income + insurance,
data = NMES1988, family = poisson)
dispersiontest(nmes)
Run the code above in your browser using DataLab