# What is the connection between SEM and confidence interval

I have a results of sessions where for each $$i\in\mathbb N$$ the $$i$$'s session contains $$n_i$$ Bernoulli trials.
I want to analyze the narrowness of my sample distribution.
From online reading I see some alternative ways to do that.

One is finding the "confidence interval" at , say, 95%.

I calculated this one using the Binomial CDF. i.e.

confidence interval $$= (\frac{k_1}{n},\frac{k_2}{n})$$

where:

$$n$$ is the number of trials in the session

$$k_1$$ is the first $$k$$ s.t. the probability to be below $$k$$ successes is below 0.05 and

$$k_2$$ is the first $$k$$ s.t. the probability to be below $$k$$ successes is above 0.95 and what

Another alternative is calculating the standard error of the mean by: $$SEM = \frac{\sigma}{\sqrt n} = \frac{\sqrt{ p(1-p)}}{\sqrt n}$$

So here:

confidence interval $$= (mean + SEM , mean - SEM)$$

My questions are:

1. What are the advantages and disadvantages of one method over the other?

2. Which one of the two would you recommend to use to get a more exact estimation of "how good is my sample mean?"

3. Are there any other good ways to estimate my sample mean that have advantages over the two methods mentioned above?

4. Is there a chance that the two methods will give the same interval up to the third after-decimal digit (I didn't check more digits)?
Because this is what I got using two Matlab functions for the two methods I mentioned. Somehow it seems unreasonable to me that SEM behaves exactly like 95% confidence interval.

Thanks!

a note: as probably shown, I don't have any real background in statistics so any corrections to what I wrote above (if needed) are welcome

I think your mean + sem actually needs a mean +/- z sem because I think this is the so-called Normal approximation method. $$\hat{p} \pm z \sqrt{\frac{\hat{p}(1 - \hat{p})}{n}}$$ where for a 95% confidence interval you would use a z value of $$1.96$$. There are many alternatives to this, such as the Wilson Score interval, the Agresti Coull interval. You can even use an arcsin transformation which fixes the problem of the Normal approximation occasionally giving you intervals which are smaller than $$0$$ or bigger than $$1$$.