# Sample size for proportions in repeated measures

I'm trying to help a scientist design a study for the occurrence of salmonella microbes. He would like to compare an experimental antimicrobial formulation against a chlorine (bleach) at poultry farms. Because background rates of salmonella differ over time, he plans to measure % poultry w/salmonella before treatment, and after treatment. So the measurement will be the difference of before/after % salmonella for the experimental vs. chlorine formulas.

Can anyone advise on how to estimate the sample sizes necessary? Let's say the background rate is 50%; after bleach it's 20%; and we want to detect whether the experimental formulation changes the rate by +/- 10%. thank you

EDIT: What I'm struggling with is how to incorporate the background rates. Let's call them p3 and p4, the "before" salmonella rates for bleach and experimental samples, respectively. So the statistic to be estimated is the difference of differences: Experimental(After-Before) - Bleach(After-Before) = (p0-p2) - (p3-p1). To fully account for the sampling variation of "before" rates p2 and p3 in the sample-size calculation --- is it as simple as using p0(1-p0)+p1(1-p1)+p2(1-p2)+p3(1-p3) wherever there's a variation term in the sample-size equation? Let all samples sizes be equal, n1 = n2 = n.

• It's a great question. The optimal solution will depend on some additional things, including (a) the principal elements of the cost, including the cost of including one farm and the cost of measuring one subject; and (b) the experimental design. E.g., will both the treatment and control solutions be applied at each farm (a good choice, but not without its potential problems) or will you be able to apply only one solution at each farm? Will subjects be clustered (physically) within farms or treated and sampled truly at random? – whuber Dec 20 '10 at 22:47
• I have integrated your extension answer into the question. – user88 Dec 22 '10 at 11:05

Let's take a stab at a first-order approximation assuming simple random sampling and a constant proportion of infection for any treatment. Assume the sample size is large enough that a normal approximation can be used in a hypothesis test on proportions so we can calculate a z statistic like so

$z = \frac{p_t - p_0}{\sqrt{p_0(1-p_0)(\frac{1}{n_1}+\frac{1}{n_2})}}$

This is the sample statistic for a two-sample test, new formula vs. bleach, since we expect the effect of bleach to be random as well as the effect of the new formula.

Then let $n = n_1 = n_2$, since balanced experiments have the greatest power, and use your specifications that $|p_t - p_0| \geq 0.1$, $p_0 = 0.2$. To attain a test statistic $|z| \geq 2$ (Type I error of about 5%), this works out to $n \approx 128$. This is a reasonable sample size for the normal approximation to work, but it's definitely a lower bound.

I'd recommend doing a similar calculation based on the desired power for the test to control Type II error, since an underpowered design has a high probability of missing an actual effect.

Once you've done all this basic spadework, start looking at the stuff whuber addresses. In particular, it's not clear from your problem statement whether the samples of poultry measured are different groups of subjects, or the same groups of subjects. If they're the same, you're into paired t test or repeated measures territory, and you need someone smarter than me to help out!

• Good start (+1). The formula needs some fixing. The variance of the difference of the proportions equals p0(1-p0)/n0 + p1(1-p1)/n1. With n0 = n1 = n and p0 = .5, p1 = .2, that equals 0.41/n, implying n = 41 z^2. Note, too, that this is a one-sided test, so z = 1.65 works fine. (Some precision is needed here because the result is sensitive to the squaring of z.) Regardless, these calculations establish that approximately 10^2 independent subjects will need to be tested if this model is correct. (I do not expect the bleach or the new formula to have "random" effects.) – whuber Dec 21 '10 at 14:39
• Mike Anderson and Whuber, thank you for your suggestions. You asked good questions, which I'll try to answer. The poultry experimental units will be random, not from clusters. As of now, cost is not a consideration. – Paul Dec 21 '10 at 14:55