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

## 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

 ```1 2 3``` ```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)=μ_i(1+τ μ_i), where E(Y_i)=μ_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.

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```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)) ```