Computing p-value vs. constructing confidence interval from sample for proportions Let's say D is a Bernoulli distribution with parameter $\mu = 0.6$ and we want to test whether or not $\mu=0.5$. So,
Null hypothesis: $\mu = 0.5$
Alt hypothesis: $\mu \neq 0.5$.
Suppose we have a sample $X_1,\ldots, X_n \sim D$ for large $n$. Now, my understanding is there are two ways to do the hypothesis test. One approach is to assume the null hypothesis is correct and calculate the probability of seeing $\bar{X}_n$. If the null is correct, then we expect the distribution for the sample mean to be
$$N(0.5, (0.5*0.5)/n)$$
Then we can calculate the p-value. However, equivalently we can construct a confidence interval from our sample and reject the null hypothesis if 0.5 is not in our constructed range.
$$N(\hat{p}, \hat{p}(1-\hat{p})/n)$$
My confusion is, are these two methods really equivalent? Because the variance of the normal distribution would be smaller for the second approach, isn't it possible that you could reject the null hypothesis in the second approach, but fail to reject the null hypothesis in the first approach? Any intuitive explanation for why they are equivalent?
 A: 
My confusion is, are these two methods really equivalent?

No the methods are indeed not equivalent.
Note that there are also many different ways to construct the confidence intervals (and different ways to express hypothesis tests). The use of the parameter estimate $\hat{p}$ in the expression $N(\hat{p}, \hat{p}(1-\hat{p})/n)$ is a simplification and does not give an exact interval. The justification is that $\hat{p}(1-\hat{p})$ and $p(1-p)$ do not differ much when the sample size is large enough.
See more on the Wikipedia page about different ways to construct confidence intervals for the binomial proportion.

*

*The interval based on $N(\hat{p}, \hat{p}(1-\hat{p})/n)$ corresponds to the Wald interval. (the hypothesis test that corresponds to this interval is the Wald test)

*The expression $N(0.5, (0.5*0.5)/n)$ is more related to the Wilson score interval.

See also Confidence interval / p-value duality: don't they use different distributions? in which the examples in the answer by Demetri Pananos and in some of the comments relate to the binomial proportion.
A: A confidence interval based on normal approximation for the Bernoulli where $\hat p(1−\hat p)$ (by the way $\hat p=\bar X_n$) is plugged in for the variance estimator involves two approximations (one by the Central Limit Theorem, the other by variance estimation) and is therefore not equivalent to a test that does not involve variance estimation.
There are confidence intervals for the Bernoulli that don't estimate the variance either though, see https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval.
I believe that the Wilson score interval explained there will, by checking whether 0.5 is in it, give you a test equivalent to the one you discuss, i.e., with normal approximation but without estimating the variance (assuming that the test is two-sided).
