odTest: likelihood ratio test for over-dispersion in count data

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/odTest.R

Description

Compares the log-likelihoods of a negative binomial regression model and a Poisson regression model.

Usage

1
odTest(glmobj, alpha=.05, digits = max(3, getOption("digits") - 3))

Arguments

glmobj

an object of class negbin produced by glm.nb

alpha

significance level of over-dispersion test

digits

number of digits in printed output

Details

The negative binomial model relaxes the assumption in the Poisson model that the (conditional) variance equals the (conditional) mean, by estimating one extra parameter. A likelihood ratio (LR) test can be used to test the null hypothesis that the restriction implicit in the Poisson model is true. The LR test-statistic has a non-standard distribution, even asymptotically, since the negative binomial over-dispersion parameter (called theta in glm.nb) is restricted to be positive. The asymptotic distribution of the LR (likelihood ratio) test-statistic has probability mass of one half at zero, and a half chi-square (1) distribution above zero. This means that if testing at the alpha = .05 level, one should not reject the null unless the LR test statistic exceeds the critical value associated with the 2 alpha = .10 level; this LR test involves just one parameter restriction, so the critical value of the test statistic at the p = .05 level is 2.7, instead of the usual 3.8 (i.e., the .90 quantile of the chi-square (1) distribution, versus the .95 quantile).

A Poisson model is run using glm with family set to link{poisson}, using the formula in the negbin model object passed as input. The logLik functions are used to extract the log-likelihood for each model.

Value

None; prints results and returns silently

Author(s)

Simon Jackman simon.jackman@sydney.edu.au. John Fox noted an error in an earlier version.

References

A. Colin Cameron and Pravin K. Trivedi (1998) Regression analysis of count data. New York: Cambridge University Press.

Lawless, J. F. (1987) Negative Binomial and Mixed Poisson Regressions. The Canadian Journal of Statistics. 15:209-225.

See Also

glm.nb, logLik

Examples

1
2
3
4
5
data(bioChemists)
modelnb <- MASS::glm.nb(art ~ .,
                 data=bioChemists,
                 trace=TRUE)
odTest(modelnb)

Example output

Loading required package: MASS
Loading required package: lattice
Classes and Methods for R developed in the

Political Science Computational Laboratory

Department of Political Science

Stanford University

Simon Jackman

hurdle and zeroinfl functions by Achim Zeileis

Theta(1) = 2.268830, 2(Ls - Lm) = 1004.930000
Theta(2) = 2.264410, 2(Ls - Lm) = 1004.280000
Theta(3) = 2.264400, 2(Ls - Lm) = 1004.280000
Theta(4) = 2.264390, 2(Ls - Lm) = 1004.280000
Theta(5) = 2.264390, 2(Ls - Lm) = 1004.280000
Theta(6) = 2.264390, 2(Ls - Lm) = 1004.280000
Theta(7) = 2.264390, 2(Ls - Lm) = 1004.280000
Theta(8) = 2.264390, 2(Ls - Lm) = 1004.280000
Likelihood ratio test of H0: Poisson, as restricted NB model:
n.b., the distribution of the test-statistic under H0 is non-standard
e.g., see help(odTest) for details/references

Critical value of test statistic at the alpha= 0.05 level: 2.7055 
Chi-Square Test Statistic =  180.196 p-value = < 2.2e-16 

pscl documentation built on March 26, 2020, 7:36 p.m.