dean_test: Likelihood Ratio Test and Dean's Tests for Overdispertion In DCluster: Functions for the Detection of Spatial Clusters of Diseases

 Tests for Overdispertion R Documentation

Likelihood Ratio Test and Dean's Tests for Overdispertion

Description

When working with count data, the assumption of a Poisson model is common. However, sometimes the variance of the data is significantly higher that their mean which means that the assumption of that data have been drawn from a Poisson distribution is wrong.

In that case is is usually said that data are overdispersed and a better model must be proposed. A good choice is a Negative Binomial distribution (see, for example, negative.binomial.

Tests for overdispersion available in this package are the Likelihood Ratio Test (LRT) and Dean's P_B and P'_B tests.

Usage

test.nb.pois(x.nb, x.glm)
DeanB(x.glm, alternative="greater")
DeanB2(x.glm, alternative="greater")


Arguments

 x.nb Fitted Negative Binomial. x.glm Fitted Poisson model. alternative Alternative hipothesis to be tested. It can be "less", "greater" or "two.sided", although the usual choice will often be "greater".

Details

The LRT is computed to compare a fitted Poisson model against a fitted Negative Binomial model.

Dean's P_B and P'_B tests are score tests. These two tests were proposed for the case in which we look for overdispersion of the form var(Y_i)=\mu_i(1+\tau \mu_i), where E(Y_i)=\mu_i. See Dean (1992) for more details.

Value

An object of type htest with the results (p-value, etc.).

References

Dean, C.B. (1992), Testing for overdispersion in Poisson and binomial regression models, J. Amer. Statist. Assoc. 87, 451-457.

DCluster, achisq.stat, pottwhit.stat, negative.binomial (MASS), glm.nb (MASS)

Examples

library(spdep)
library(MASS)

data(nc.sids)

sids<-data.frame(Observed=nc.sids$SID74) sids<-cbind(sids, Expected=nc.sids$BIR74*sum(nc.sids$SID74)/sum(nc.sids$BIR74))
sids<-cbind(sids, x=nc.sids$x, y=nc.sids$y)

x.glm<-glm(Observed~1+offset(log(sids\$Expected)), data=sids, family=poisson())
x.nb<-glm.nb(Observed~1+offset(log(Expected)), data=sids)

print(test.nb.pois(x.nb, x.glm))
print(DeanB(x.glm))
print(DeanB2(x.glm))



DCluster documentation built on Sept. 3, 2023, 5:07 p.m.