# Types of dispersion parameter for binomial data

For a model with a binomial proportion as response variable, which is fitted with according to a binomial distribution, a dispersion parameter $\phi$ can be calculated, which is equal to the sum of the squared Pearson residuals divided by the residual degrees of freedom.

I was following along with an example I found online and found that the $\phi$ computed by hand matches the dispersion parameter that one gets by specifying family=quasibinomial() in the glm command (rather than family=binomial()) and asking R for

summary(fittedModelName)$dispersion For my toy data set,$\phi = 4.904$in both cases. When I fit the same model with a beta-binomial distribution (using betabin in the aod package), I get a dispersion parameter estimate which is very different, sc. Overdispersion coefficients: Estimate Std. Error z value Pr(> z) phi.(Intercept) 1.376e-01 3.145e-02 4.374e+00 6.102e-06  I would like to know how the two types of dispersion parameters differ, and whether there is any way they can be related. These are the parameters I specified for the betabin function: betabin(formula = cbind(Rcnt, total - Rcnt) ~ LANG, random = ~1, data = toyDataSet)  • @MartijnWeterings as for my toy data set, this will require some forensics on my home computer to see what I was working on 5.5 years ago! The online example, luckily, has been crawled by internet archive link – user9437 Nov 17 '17 at 15:28 ## 1 Answer ## The glm dispersion the glm dispersion is an expression based on the normalized residuals. So say you have a model fittedModelName Then you get the same for • manual calculation sum( residuals(fittedModelName, "pearson")^2 ) / fittedModelName$df.residual

• automatic

summary(fittedModelName)$dispersion  note that you can define the quasibinomial model in two ways. You could use: • scaled from 0 to 1 formula = Rcnt/total ~ LANG  • scaled from 0 to n formula = cbind(Rcnt, total - Rcnt) ~ LANG  which gives different results for the calculated dispersion ## The beta-binomial regression by aod's betabin In the betabin case the reported dispersion is a model parameter. This is explained in the documentation of the function. The function uses the parameterization ....$\varphi = 1 / (a1 + a2 + 1)$... and$\varphi$is the overdispersion parameter. You can test this also with the code below: library(aod) #generate data set.seed(1) alpha = 1 beta = 1 n = 40 x <- rbeta(1000, alpha, beta) y <- qbinom(runif(1000), n, x) #modeling mb <- betabin(cbind(y,n-y)~1, random=~1, data=as.data.frame(list(y=y)))  which shows that the used dispersion is the inverse of the sum$1+\alpha+\beta$with$\alpha$and$\beta\$ the coefficients of the beta-distribution.

#comparison of dispersion

> mb@param
phi.(Intercept)
0.340159
> 1/(alpha+beta+1)
 0.3333333


## References

The documentation is here:

https://www.rdocumentation.org/packages/aod/versions/1.3/topics/betabin

but I prefer to get these documentation files by typing the function name into the console betabin or ??betabin