Solved – Compute a confidence interval for Bernoulli distribution

bernoulli-distributionconfidence interval

Given a Bernoulli distribution with a success probability of p = 0.02. Let's say we have N=3000 samples. How can I compute a confidence intervals for the expected number of successes (e.g., with 5% significance level)?

Best Answer

Your expected value is $3000\times0.02=60$, the variance is $3000\times 0.02\times(1-0.02)=58.8$. Simulating 100,000 trials and plotting a histogram, I would say you can use the normal approximation unless you have very strong requirements on accuracy (in which case the R help page says that "qbinom() uses the Cornish-Fisher Expansion to include a skewness correction to a normal approximation, followed by a search", which may help).

nn <- 3000
n.sim <- 100000
foo <- rbinom(n=n.sim,size=nn,prob=.02)
hist(foo,breaks=seq(min(foo)-.5,max(foo)+.5,by=1))

enter image description here

Related Question