# Hypothesis tests and confidence intervals

Suppose we have data set $X$ with $20$ observations. A confidence interval for the mean $\mu$ is always the same no matter what hypothesis we test? So if we test $H_a: \mu < \mu_0$, $H_a: \mu \neq \mu_0$ or $H_a: \mu > \mu_0$, the confidence interval will be the same?

• There's some typo in your question - what's $H_0$ & what's $H_a$? – Scortchi - Reinstate Monica Jan 9 '13 at 20:44
• @Scortchi I believe $H_0:\, \mu=\mu_0$, and the OP is talking about two one-sided and one two-sided alternatives. – chl Jan 9 '13 at 21:27
• I don't understand your question. It is possible to make confidence intervals that don't match hypothesis tests. EG, you can test if $\mu<\mu_0$, but make a standard CI that goes from 2.5% to 97.5%. Alternatively, you could make a CI that goes from $-\infty$ to 95%, & do a 2-sided hypothesis test. So, it's possible to have a mismatch b/t your CI & your hypothesis test, is that what you want to know? – gung - Reinstate Monica Jan 9 '13 at 22:48

Yes it will. Testing hypotheses & calculating confidence intervals are different things. There's a relation between them: if you obtain a 95% confidence interval of $\left(\mu_{\textrm{low}},\mu_{\textrm{high}}\right)$ it means that if you were to carry out a two-sided hypothesis test with a null hypothesis that $\mu=\mu_{\textrm{low}}$ or $\mu=\mu_{\textrm{high}}$ the p-value would be 5%.
• I disagree. I think similarly to @chl that the associated confidence interval is either two-sided, left-sided, or right-sided according to the alternative hypothesis (as with the alternative argument of the binom.test() R function) – Stéphane Laurent Jan 9 '13 at 22:36