# 6a.5 - Relating the CI to a Two-Tailed Test

The primary purpose of a confidence interval is to estimate some unknown parameter. A secondary use of confidence intervals is to support decisions in hypothesis testing, especially when the test is two-tailed. The essence of this method is to compare the hypothesized value to the confidence interval. If the hypothesized value falls within the interval, we fail to reject the null hypothesis. If the hypothesized value falls outside the interval, we reject the null hypothesis.

For the two-tailed test:

$$H_0 \colon p=p_0$$ vs $$H_a \colon p\ne p_0$$

The null hypothesis will be rejected at level $$\alpha$$ if and only if the value $$p_0$$ does not fall within the $$(1 - \alpha)$$ confidence interval for $$p$$.

Let's look at an example.

## Application

### Approval Rating Section

Consider the example from Lesson 5. A random sample of 1500 U.S. adults is taken. They are asked whether they approve or disapprove of the current president's performance so far (i.e. an approval rating). Of the 1500 surveyed, 660 respond with "approve".

The 95% confidence interval found in Lesson 5 for the population proportion who approve the president’s performance so far is (0.415, 0.465).

Suppose we want to test if the proportion is different than 40%. In other words, we want to test the following hypotheses at significance level 5%.

Step 1: Set up the hypotheses and check conditions.
$$H_0\colon p=0.40$$ vs $$H_a \colon p\ne0.4$$
Step 2: Decide on the significance level, $$\alpha$$.
Since we want to compare the 95% confidence interval, we should use a significance level of 5%
Step 3: Calculate the test statistic.
\begin{align} z^*&=\frac{\hat{p}-p_0}{\sqrt{\frac{p_0(1-p_0)}{n}}}\\&=\frac{\frac{660}{1500}-0.4}{\sqrt{\frac{0.4(1-0.4)}{1500}}}\\&=3.162 \end{align}
Step 4: Compute the appropriate p-value based on our alternative hypothesis. (In this step we can use the rejection region approach or the p-value approach. We will demonstrate the p-value approach.)

For the two-sided test, the p-value is found by:

\begin{align} \text{p-value}&=2P(Z\ge z^*)\\&=2P(Z\ge3.162)\\&=2(0.00078)\\&=0.00156 \end{align}

Step 5: Make a decision
The p-value of 0.00156 is less than our significance level, 5%. Therefore, we reject the null hypothesis.
Step 6: State an overall conclusion
There is enough evidence in the data, at significance level 5%, to reject the null hypothesis and conclude that the true population proportion of people who approve the president’s performance so far is different than 40%.

#### Connecting the CI with the 2-tailed test

The conclusion was to reject the null hypothesis that the true proportion is 40%. If we look at the 95% confidence interval for the test (0.415, 0.465) , we can see that 40% is not inside that interval.

Although we have not yet discussed a hypothesis test for the population mean, this idea applies to all two-sided tests and confidence intervals.

It is possible to use a one-sided confidence bound to draw a conclusion about a one-sided test, but you have to be very careful about obtaining the one-sided confidence bound.