# How to compute the confidence interval if I have 2 samples?

In the field of biology we often have >1 samples. For instance I can conduct two (but not many) experiments (replicates) each on a number of animals (n1, n2). The aim of the experiment is to estimate the proportion of the animals which prefer a certain habitat area. And I could estimate from each sample the proportion of those animals staying in that area: p1 and p2. Therefore, the sample mean of the proportion is: mean(p1,p2). My question is: based on these two samples, how shall I present the confidence intervals of the sample proportions? Shall I present two CIs or is there anyway to compute one CI just based on these two samples?

Animals have correlated intra-group behavior, so I can not simply combine these two samples into one and then use one of the standard method to compute CI. On the other hand, if I have a large number of samples, I could compute the CI directly from these samples.

The method I could think of is to conduct bootstrapping 500 times from sample 1 and 500 times from sample 2, and then compute the CI from these 1000 random samples.

Do you have any nice suggestions? Thanks

-
If the samples are not of the same size, the optimal estimator is not the average of $p_1$ and $p_2$: When you have two binomial experiments, $x_i\sim B(n_i,p)$, it is equivalent to a single binomial experiment $x_1+x_2\sim B(n_1+n_2,p)$. If you do not have binomial experiments, you need to detail the model much more than this. –  Xi'an Oct 21 '12 at 19:31
I am not sure if I can call them binomial experiments. In my experiment, animals (trials) are not behaving independently. Imagine a sample group of n1 animals, it could end up with x1 animals in the target area simply because some of them decided to live there and the rest follows them. So I guess the estimated proportion p is associated with sample size. In the simplest case: n1=n2, may I still combine them into a single binomial experiment? Thanks –  tiantianchen Oct 21 '12 at 21:32