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?
 A: 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%.
A: There are different types of confidence intervals.  Intro stats classes tend to teach the simplest which just puts half of alpha on each side and usually creates a symmetric interval (at least for the simple cases in intro stat classes).
In theory you can even create a confidence interval that does not include the estimate from the sample (though there are not many cases where that would be useful).
Some statistical software packages will compute a one-sided confidence interval when you use a one sided alternative hypothesis for the test.  I have also seen cases where if a one-sided test is done for a test of hypothesis then the confidence interval computed uses twice the alpha, i.e. a 5% level of the test and follow-up with a 90% (rather than 95%) confidence interval so that the test and interval match (at least on the interesting side).
