In this blog the author suggests using Tarone’s Z-statistic to test for overdispersion in a binomial model to determine whether or not it is necessary to use a beta-binomial model instead. In their example they generate some synthetic data from binomial and beta-binomial distributions and then calculate the Z-statistic’s for each and plot them, along with a theoretical curve of the null distribution to demonstrate that this metric works.
How do I actually calculate/use this to test for overdispersion? I found the author code difficult to follow and I don’t quite understand how I could use this to formally test for over-dispersion.
I have searched around but all I can turn up about Tarone’s Z-statistic are the two links I have included.
I am working in
R using the
glmmTMB packages and I would greatly appreciate an answer in this form. I know this question kind of straddles the bounds of CV and stackoverflow, but I considered this a “non-trivial problem” – If the community disagrees I am happy to migrate it!