# How to calculate 95% Confidence Interval for binomial data when there are replicates

I would like to calculate the 95% CI for my binomial data. The set up is that I have 20 devices, each measuring the same standard three times. The data are binomial and come out as Found/Not Found (1,0). For the sake of argument lets say that each run comes up with 50% positive. Using the 95% CI formula on some practice data (see below):

$\hat p \pm z*\sqrt{ \hat p*(1- \hat p)/n }$

We would have a 95% CI of 0.5 +/- 0.11 (or spanning 28.1% thru 71.9%) and R1=R2=R3.

I could simply use n=60 and p=.5 and get a 95% CI of 0.5 +/- .12 (37.3%-62.6%).

However since each device is used 3 times measuring the same thing, I seems appropriate to account for my repeated measures? Notice I have made the test data to be widely divergent, I do not think this is the case for my data.

I've used Cochrane's Q Test in the past to test for differences in paired data but in this case I want to find the global CI so I am not sure it is the right way of going.

How does one calculate the CI in this situation?

Test Data

Device  R1 R2 R3
1    1   1   0
2    1   0   0
3    1   1   0
4    1   0   0
5    1   1   0
6    1   0   0
7    1   1   0
8    1   0   0
9    1   1   0
10   1   0   0
11   0   1   1
12   0   0   1
13   0   1   1
14   0   0   1
15   0   1   1
16   0   0   1
17   0   1   1
18   0   0   1
19   0   1   1
20   0   0   1