adjusted wald intervall I m trying to derive the adjusted-wald-CI (agresti coull intervall) which is quite similar to the standardwald intervall only for the estimator where we add 2 success and 2 failure
$$\hat{p}=\frac{\sum X_i  + 2}{n+4}$$
anyone has idea why it performs so much better than the original one and how does one prove , using $\tilde{p}$ as point estimate, that it is still an asymptotic CI
 A: Let $Y = \sum X_i$ be the number of successes observed in $n$ Bernoulli trials, the unknown probability of success is $p$, where $0 < p < 1$.
Consider the test of the null hypothesis $H_0: p = p_0$ against 
the two-sided alternative $H_a: p \ne p_0.$
Assuming that $n$ is sufficiently large and $p$ is sufficiently
near $1/2$ that the normal approximation is suitable, a test
statistic 
$$ Z = \frac{\hat p - p_0}{\sqrt{p_0(1-p_0)/n}},$$
where $\hat p = Y/n$ and we reject at the 5% level if $|Z| \ge 1.96.$
Often one can get a good two-sided confidence interval (CI) by 'inverting'
such a two-sided test. Here a 95% CI is the interval of values
$p_0$ that would $not$ lead to rejection of $H_0.$ Sometimes
one says the CI consists of 'acceptable' values $p = p_0.$
A naive attempt to invert the test (perhaps following the
procedure to get a t interval) would lead to the nonsense
interval.
$$ \hat p \pm 1.96 \sqrt{p(1-p)/n}.$$
This is a useless interval because the factor $\sqrt{p(1-p)/n}$
contains the unknown value $p.$ Essentially, the Wald interval
replaces unknown $p$ by the observed $\hat p$.
A more productive inversion is to solve the inequality $-1.96 < Z < 1.96$ for $p = p_0$ by squaring and using the quadratic formula. 
This gives rise to the well-known 'Wilson score CI' for $p$. (Search Google for many references.) This interval has been widely used in
advanced applications, but many elementary and intermediate
texts have preferred the Wald interval because it is considerably
simpler. 
However, the Wald interval involves two approximations: (a) normal to binomial and (b) substitution of $p$ by $\hat p$. It has been
shown by computational studies that the actual coverage probability of
Wald intervals is unsatisfactorily smaller than the intended 95% for many
values of $p$--especially for $n$ smaller than several hundred.
The Wald interval is 'asymptotically' correct. This means it
becomes more accurate as $n \rightarrow \infty.$ But infinity is
'a long way out there' and the Wald interval is not satisfactory
for small or moderate $n$.
The Agresti-Coull interval is a simplified version of the Wilson
interval, valid $only$ for 95% confidence intervals. The formula for the Wilson interval
contains a $2$ and a $4$ and several instances of $z^* = 1.96$.
If we approximate $z^* \approx 2$, then some simplifications
occur, and a further simplification is to ignore a term that
is very small even for moderately large $n$. With these 'tricks'
the simplified Wilson interval becomes the Agresti-Coull interval.
The difference in coverage behavior between the Wilson and Agresti-Coull intervals is mainly quite small, and the simpler interval
has recently become very popular in statistics texts at the 
elementary and intermediate levels. A comprehensive review
article by Brown, Cai, and DasGupta (2001) illustrates coverage
probabilities for these and other styles of confidence intervals.
Here is a simple numerical example in R, illustrating the three styles
of confidence intervals discussed above. 
 n = 50;  y = 43;  pm = c(-1,1);  c = 1.96
 p.hat = y/n
 round(p.hat + pm*c*sqrt(p.hat*(1-p.hat)/n), 3)      # Wald
 ## 0.764 0.956
 p.adj = (y+2)/(n+4)
 round(p.adj + pm*c*sqrt(p.adj*(1-p.adj)/(n+4)), 3)  # A-C
 ## 0.734 0.933
 pp = seq(0, 1, by=.0001);  z = (p.hat-pp)/sqrt(pp*(1-pp)/n)
 inv = pp[abs(z)<=1.96]
 round(c(min(inv), max(inv)), 3)                     # Wilson
 ## 0.738 0.930

