# Sample size planning with required CI width and guessed propotion, using “Wilson” method

I refer to this link for calculating the sample size needed based on the width confidence interval needed, and the guessed proportion. I realize that it is use the "asymptotic" method when calculating the sample. Having know that the "wilson" method is a better way for estimating the CI for proportion[a]. I wonder if there is any "wilson" method for estimating the sample size? (Preferably a package used in R), thanks.

[a]: A. Agresti and B.A. Coull, Approximate is better than "exact" for interval estimation of binomial proportions, American Statistician, 52:119–126, 1998.

• I don't know much about what exists for this particular case and haven't tried writing out the equations, but for complex methods, calculating power is often easiest to do by simulation. Perhaps that would be an option here. – Aaron left Stack Overflow Feb 16 '12 at 16:27

You could use optimize to get required sample sizes for estimated proportions and given confidence interval width.
The plot shows required sample sizes estimated with Wilson's method and the asymptotic (normal approximation) for given proportion p and three different confidence interval widths. I obtained the thin lines by assuming that the true $p$ is less than p + $\frac{1}{2}$ specified with. This is unrealistically precise: if $p$ were known already with that precision, no study would be required. However, this uncertainty on the true $p$ has a larger effect on the required sample size than the method for determining the confidence interval.