Hive inspection sampling: how many bees and hives to count (2D)

Draw a sample of bees from each hive, count the mites, and see how sample size, number of hives, hive-to-hive variation and shortcut sampling change the error and the treat-or-leave decision.

Switch to 3D

Presets

Playback

Sampling plan

The apiary

Actions

Layers

Model check

The science

The question

A beekeeper cannot count every mite, so one inspection counts the mites on a sample of bees (an alcohol wash or sugar roll of about 300 bees) and decides whether to treat. How much can that estimate be trusted, and what do extra bees or extra hives buy? This is a statistics model with typical textbook magnitudes; it contains no rules or certification requirements, and the threshold is a value you set.

Model

p_h ~ Beta(a, b), mean mu, coefficient of variation cv     true infestation of hive h
k_h | p_h ~ Binomial(n, q_h),  q_h = p_h (protocol) or beta p_h (shortcut)
estimate = mean over the sampled hives of k_h / n

The protocol is followed with probability f in each hive; otherwise the shortcut (for example sampling an outer frame, where fewer mites are seen) multiplies the true rate by beta. The factor beta is a made-up illustration, because real values depend on where in the hive the bees are taken.

Errors

Var(k/n)  = q(1-q)/n                       binomial counting noise, one hive
SE(apiary) = sqrt( sum_h Var_h ) / m       for the m hives of this page
n = z^2 p (1-p) / e^2                      bees for a margin of +/- e (z = 1.96)

Counting noise falls as 1/sqrt(n), so four times the bees halve it, but the spread between hives and any bias of the method do not shrink with n: only more hives or a better protocol help. The treat-or-leave call is right when the estimate falls on the same side of the threshold as the truth, which is hard when the true level sits near the threshold.

Honest simplifications

  • Hives are independent draws from one Beta distribution; the real distribution of mite loads is skewed and changes with the season and the brood cycle.
  • Bees in a sample are treated as independent, equal-chance draws; clumped bees would add variance.
  • The checks prove the code matches the formulas (variance, mean, 1/sqrt(n), the sample-size rule, an exact binomial tail); they do not prove a real apiary behaves like the Beta model.

It replaces an earlier page that only logged sensor readings.

Standard error of the apiary estimate against bees per sample
Chance that the treat or leave call is right
Bees needed per hive for a chosen margin of error
Apiary estimate round by round