I'd like to use Monte Carlo method to estimate a proportion and I'd like to be sure my idea is correct mathematically speaking.

Let a pool full of red and blue balls. I'd like to estimate the proportion of blue balls into the pool.

- One ball is randomly taken into the pool and its color is noted.
- The ball is put back into the pool

This process is repeated N times. let p the proportion of blue balls among the N taken balls. I'd like to have a bound on this error.

If I understand correctly, I have

$$ |e_n| \leq z_{1-\alpha/2}\frac{\sigma_g}{\sqrt{N}} $$

with probability $1-\alpha$. $z_{1-\alpha}$ is the quantile of the normal distribution.

I also have an estimator of $\sigma_g$ : $p(1-p)* N/(N-1)$

Is this all true ? Have I some hypothesis to make sure ? on the size of N or something else ? Is my estimator correct ? On small values of N, that seems incorrect : If the real proportion is near 1. And N is small, we can have an estimator of sigma_g = 0, then whatever is the alpha, the error is zero.

Thanks