Estimate the proportion and variance in a simple binomial cluster design

I am trying to estimate a binomial proportion p, say, from a sample of binomials. There are k subjects. Associated with each subject is a sample size $n_i$ and a count $x_i$ of items, where $x_i$ is distributed as a binomial $(p, n_i)$. I can assume that the sample sizes are not a function of $p$.

In sampling terms, the sampling unit is the subject, not the number of items $x_i$.

I want to estimate p and provide a confidence interval for it.

Should I take $$\hat{p}=\frac{\sum_i x_i}{\sum_i n_i}$$ or should I take the average of the cluster means? $$\frac{1}{k} \sum_i \frac{x_i}{n_i}$$

And how should I estimate the standard deviation?

• What software do you have access to? If it is any of the big three (R, Stata, SAS), you should be able to utilize their survey features that would take care of producing the correct standard errors (which is what you should be concerned with, rather than the standard deviations). – StasK Sep 19 '12 at 4:54

While the first estimate is the MLE under perfect conditions, I believe there's enough scope for both estimating the proportion and testing the assumption that really all proportions are the same. You can do this as a nested logistic regression with just a common intercept vs. a bunch of fixed effects for each subject. Or a variance component in a GLMM way. The test that all coefficients are equal to zero (or that the variance component is equal to zero) would justify the first approach. If this test fails, you have to admit that your success probabilities vary between subjects; in this case, the overall probability may still be a valid population parameter and a target of inference, but only the second formula is applicable.

The variance estimator is formula (2.3-8) in Korn & Graubard 1999 (which is a great book worth having if you work with surveys to any appreciable extent).

You present a very çlean situation, but the real world is often not really clean. Are the k subjects really fungible? Are the sample sizes a function of the subjects? In any case, the average of the p values for each subject would be less influenced by the subjects with larger n's. That might be a conservative approach. You might calculate the p's both ways and see if they differ. If they differ, you might try to find out why. If the situation is as clean as you describe, the first approach would be best, since it uses all the information. In any case, the SD of p = sqrt (pq/n) if you are sampling from an infinite binomial distribution.

• The k subjects are probably not fungible, which is why one needs to take into account the fact that there is clustering. I believe that the first estimate of the proportion is correct - because it actually auto-corrects for the different sample sizes. The variance estimate has to come from the within-cluster variances, but I am not quite sure which formula to use that this point. There's lots on the Web when the sample sizes are equal. Unequal -- not so much. – Placidia Sep 19 '12 at 1:23
• If they are not fungible then is there really a common p you are estimating? How much variability is there in the p's from the individual subjects? Is it greater than you would expect by chance? Perhaps a meta-analysis approach might be useful. – Joel W. Sep 19 '12 at 12:41

I agree that the first estimate is the best. Each cluster represents an independent set of iid Bernoulli random variables. So pooling them gives you a single binomial with N equal to the sum of the n$_i$s and estimate 1 is the mle for p. The variance estimate for p^ is p^(1-p^)/N where p^= ∑$_i$ x$_i$/ ∑$_i$ n$_i$. N=∑$_i$ n$_i$.

• If you just look at the likelihood, you get the answer you gave. But one must also take the sampling scheme into account. Rather like the MSE in anova. – Placidia Sep 19 '12 at 3:27
• The sampling is just k independent sets of independent identically distributed Bernoulli trials. So it amounts to the same thing as one sample of N independent identically distributed Bernoulli trials. – Michael Chernick Sep 19 '12 at 3:32