# GLM: Modelling proportional data - account for variation in total sample size

When I am sampling the proportion of a sub-group of animals to the total number of animals within a sample, I can feel quite confident (after taking into account environmental factors) that I have a realistic representation of the community whenever my sample is large (a bigger cross section of the community). However, if for some reason I only achieve a small sample, I imagine that the proportion of my sub-group can be quite random, and there would be more variation.

For example, I might be interested in the proportional abundance made up by certain feeding guilds within a bird community. To test this, I might go out and catch birds repeatedly on a given site. On day 1, I might catch 30 birds in total in one site, and 5 of these eat mainly insects, so my proportional abundance of insectivorous birds is 5/30=0.167.

On day 2, I repeat the experiment, but happen to catch only 5 birds, out of which 4 happen to be insectivorous, resulting in a proportional abundance of 4/5=0.8. Further repeated measures might show that the proportions are generally below 0.2, but this one outlier of 0.8 will bias the data towards higher proportions.

A model in R looking at this data might be specified something like this:

model <- lme4::glmer(insectivor_captures/total_captures ~ (1|day) + site,
family = binomial (link = logit),
weights = total_captures,
data=df)


How would you account for those days where total samples were low, and uncertainty was high? Would it make sense to just exclude those cases?

tl;dr in general I think the fact that you're using a binomial model should take care of this automatically.

The binomial model builds in some of the expected decrease in reliability of small samples that you're concerned about. Specifically, the coefficient of variation (CV) of a binomial sample of size $$n$$ is $$np/\sqrt{np(1-p)} = \sqrt{p/(n(1-p))}$$; thus, we expect samples to be more reliable (have lower CV) when they have a large $$n$$.

In general this should capture the basic effects of small sample size; it's conceivable that small samples are even more unreliable than you would expect based on this binomial variation (e.g., maybe you only collected small sample size when some other environmental variation was operating), which you could model if you really wanted to, but in general I wouldn't worry about it.

Overdispersion refers to variability being higher than expected based on the statistical model (in this case binomial) across the board - not necessarily just when sample size is small. For example, the beta-binomial model, for example (Mor, the variance is inflated by a factor $$(\phi+n)/(\phi+1)$$; thus for $$\phi \ll 1$$ (high overdispersion), the CV is approximately constant rather than proportional to $$1/\sqrt{n}$$ -- this occurs because the "extra-binomial" variance in the process dominates the binomial sampling variance.

Another way to account for overdispersion is to add an observation-level random effect, i.e. Gaussian variation (on the log-odds scale) in the probabilities across observations: e.g. see papers by Harrison listed below.

Harrison, Xavier A. “A Comparison of Observation-Level Random Effect and Beta-Binomial Models for Modelling Overdispersion in Binomial Data in Ecology & Evolution.” PeerJ 3 (July 21, 2015): e1114. https://doi.org/10.7717/peerj.1114.

———. “Using Observation-Level Random Effects to Model Overdispersion in Count Data in Ecology and Evolution.” PeerJ 2 (October 9, 2014): e616. https://doi.org/10.7717/peerj.616.

What about over dispersion models? What you described above can also be thought of as a batch effect. So doing a poisson model with an over dispersion parameter could be a measure of the uncertainty within each day.

Another way would be to think of Generalized Least Squares where you weight the covariance matrix of each day by how many you caught. So it'd be like saying if over 10 days, I had 20 samples, and one day I got 4, I would say that $$Var(X) = 20/4 * \sigma^2$$ where as the day I got 20 samples, I'd say the variance is $$Var(X) = 20/20 * \sigma^2$$. Now you would want to put a bit more thought into what kinda weighting you might want to do, but I think this general idea might work.

• Thanks! I don't think that over dispersed count models, such as negative binomial binomial models, would be appropriate for proportion outcomes - correct me if I'm wrong. I'll have a look at batch effects and Generalized Least Squares. Commented May 7, 2019 at 15:30
• It might give a sense of how much extra variance you get from the day to day variations compared to what you expect, but yeah I like the GLS approach more. Commented May 7, 2019 at 15:32
• Unless I'm missing something, I don't like this answer much ... Commented May 7, 2019 at 16:28