I have a binary outcome (success \ failure). I have 20 subjects, half of them gave 2 samples, the others just one, so I have 30 data points.

All data points without any exceptions were success (1). So my point estimate of the success rate is clearly 100%. Now I want to calculate a CI for the success rate, mainly to see what the lower limit is, I want to be able to say that with 95% confidence the success rate is higher than....(80%, 85%, whatever comes up).

The problem is, as you can see, is the clustering, I can't use n = 30 because I then ignore the correlation, I feel it is a waste to use n = 20. Is there a way to calculate the variance of a single sample proportion while taking into account the cluster ?

Thanks !

  • $\begingroup$ As I understand, there is no variability at all in your sample. How then do you plan to compute a confidence interval? $\endgroup$
    – ocram
    Jan 11 '14 at 9:47
  • $\begingroup$ Well, you can calculate it, but it's from 100% to 100% if your data are completely invariant. $SD=0\rightarrow SE=\frac{0}{\sqrt{N}}$. Multiply that by 1.96 and add it to 100% or subtract it if you want, but it's still going to be 100%. $\endgroup$ Jan 11 '14 at 10:16
  • $\begingroup$ If it weren't for the clustering, there is a solution for the CI; Agresti & Coull suggest adding two successes and two failures to the data and basing CI on that as a simple solution. Even though in this sample there were no failures, there clearly could be failures in the population. But I don't know how to deal with the sampling. On the other hand, the variance of this sample is 0, clustering or no. $\endgroup$
    – Peter Flom
    Jan 11 '14 at 11:51

For inference with clustered data you need some idea about the within-cluster correlation. Your data currently shows a perfect within-cluster correlation, so you might as well assume that the subjects will always give the same response. So I would go ahead with $n=20$ - that's the conservative approach. Of course, your data are also consistent with no within-cluster correlation and $p=1$, but that would be hard to argue without context.

There are many options for exact confidence intervals, for example:

> binom.test(20,20)

        Exact binomial test

data:  20 and 20 
number of successes = 20, number of trials = 20, p-value = 1.907e-06
alternative hypothesis: true probability of success is not equal to 0.5 
95 percent confidence interval:
 0.8315665 1.0000000 
sample estimates:
probability of success 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.