Binomial testing with probability estimated from sample If I have a sample of k successes and n-k failures, there are standard techniques (Agresti-Coull, Clopper, etc.) for finding a confidence interval of the probability of an individual success.  What if I want to find a confidence interval for the probability of getting at least k' out of n' instead?  Obviously it can be approximated by the usual
$$\sum_{j\ge k'}{n'\choose j}(k/n)^j(1-k/n)^{n'-j}$$
but this does not take into account the uncertainty of the initial sample, which may be important (the samples are small).
 A: I believe you are looking for the beta binomial distribution, which reduces the pdf of of interest ($\pi(k\prime)$) to
$\pi(k\prime|n\prime,n,k) = {n\prime \choose k\prime} \frac{B(k\prime+k+1,n\prime-k\prime+n-k+1)}{B(k+1,n-k+1)}$
For motivation, remember that you do not know $p$ of the process, but you need to estimate $p$ as the posterior after making observation of $k$ successes out of $n$ trials. So
$\pi(p|k,n) = \frac{p^k(1-p)^{(n-k)}}{\int x^k(1-x)^{(n-k)} dx}$
A: If you are happy with your confidence interval on the unknown proportion of a single success, then just plug both of those values into the above formula.  Since k and n are known constants (rather than random variables) and the probability of k or more out of n is monotone, you can just transform the ends of your confidence interval to get a confidence interval on the transformed parameter (and your probability above is just a transform of the parameter).
If you want to get fancier you can do a full Bayesian analysis with the Beta-Binomial and get the posterior distribution of the next observation (I think there is a more formal name for it, but that could be what you want).
