# Lesson 6a: Hypothesis Testing for One-Sample Proportion

Lesson 6a: Hypothesis Testing for One-Sample Proportion

## Overview

As mentioned before, methods of making inferences about parameters are either estimating the parameter or testing a hypothesis about the value of the parameter. In this lesson, we will introduce the concepts of hypothesis testing. Then we will discuss hypothesis testing for a population proportion. In the next Lesson, we discuss inference for the population mean.

## Objectives

Upon successful completion of this lesson, you should be able to:

• Explain the concepts of hypothesis testing.
• Set up hypotheses.
• Perform hypothesis testing for a population proportion using the p-value approach and the rejection region approach.
• Use a confidence interval to draw a conclusion about a two-sided test.

# 6a.1 - Introduction to Hypothesis Testing

6a.1 - Introduction to Hypothesis Testing

## Basic Terms

The first step in hypothesis testing is to set up two competing hypotheses. The hypotheses are the most important aspect. If the hypotheses are incorrect, your conclusion will also be incorrect.

The two hypotheses are named the null hypothesis and the alternative hypothesis.

Null hypothesis
The null hypothesis is typically denoted as $H_0$. The null hypothesis states the "status quo". This hypothesis is assumed to be true until there is evidence to suggest otherwise.
Alternative hypothesis
The alternative hypothesis is typically denoted as $H_a$ or $H_1$. This is the statement that one wants to conclude. It is also called the research hypothesis.

The goal of hypothesis testing is to see if there is enough evidence against the null hypothesis. In other words, to see if there is enough evidence to reject the null hypothesis. If there is not enough evidence, then we fail to reject the null hypothesis.

Consider the following example where we set up these hypotheses.

## Example 6-1

A man, Mr. Orangejuice, goes to trial and is tried for the murder of his ex-wife. He is either guilty or innocent. Set up the null and alternative hypotheses for this example.

Putting this in a hypothesis testing framework, the hypotheses being tested are:

1. The man is guilty
2. The man is innocent

Let's set up the null and alternative hypotheses.

$H_0\colon$ Mr. Orangejuice is innocent

$H_a\colon$ Mr. Orangejuice is guilty

Remember that we assume the null hypothesis is true and try to see if we have evidence against the null. Therefore, it makes sense in this example to assume the man is innocent and test to see if there is evidence that he is guilty.

## The Logic of Hypothesis Testing

We want to know the answer to a research question. We determine our null and alternative hypotheses. Now it is time to make a decision.

The decision is either going to be...

1. reject the null hypothesis or...
2. fail to reject the null hypothesis.
Note! Why can’t we say we “accept the null”? The reason is that we are assuming the null hypothesis is true and trying to see if there is evidence against it. Therefore, the conclusion should be in terms of rejecting the null.

Consider the following table. The table shows the decision/conclusion of the hypothesis test and the unknown "reality", or truth. We do not know if the null is true or if it is false. If the null is false and we reject it, then we made the correct decision. If the null hypothesis is true and we fail to reject it, then we made the correct decision.

Decision Reality
$H_0$ is true $H_0$ is false
Reject $H_0$, (conclude $H_a$)   Correct decision
Fail to reject $H_0$ Correct decision

So what happens when we do not make the correct decision?

When doing hypothesis testing, two types of mistakes may be made and we call them Type I error and Type II error. If we reject the null hypothesis when it is true, then we made a type I error. If the null hypothesis is false and we failed to reject it, we made another error called a Type II error.

Decision Reality
$H_0$ is true $H_0$ is false
Reject $H_0$, (conclude $H_a$) Type I error Correct decision
Fail to reject $H_0$ Correct decision Type II error

#### Types of errors

Type I error
When we reject the null hypothesis when the null hypothesis is true.
Type II error
When we fail to reject the null hypothesis when the null hypothesis is false.

The “reality”, or truth, about the null hypothesis is unknown and therefore we do not know if we have made the correct decision or if we committed an error. We can, however, define the likelihood of these events.

$\alpha$ ('Alpha')
The probability of committing a Type I error. Also known as the significance level.
$\beta$ ('Beta')
The probability of committing a Type II error.
Power
Power is the probability the null hypothesis is rejected given that it is false (ie. $1-\beta$)

$\alpha$ and $\beta$ are probabilities of committing an error so we want these values to be low. However, we cannot decrease both. As $\alpha$ decreases, $\beta$ increases.

Note! Type I error is also thought of as the event that we reject the null hypothesis GIVEN the null is true. In other words, Type I error is a conditional event and $\alpha$ is a conditional probability. The same idea applies to Type II error and $\beta$.

## Example 6-1 Cont'd...

A man, Mr. Orangejuice, goes to trial and is tried for the murder of his ex-wife. He is either guilty or not guilty. We found before that...

• $H_0\colon$ Mr. Orangejuice is innocent
• $H_a\colon$ Mr. Orangejuice is guilty

Interpret Type I error, $\alpha$, Type II error, $\beta$.

Type I Error:
Type I error is committed if we reject $H_0$ when it is true. In other words, when the man is innocent but found guilty.

$\alpha$:
$\alpha$ is the probability of a Type I error, or in other words, it is the probability that Mr. Orangejuice is innocent but found guilty.

Type II Error:
Type II error is committed if we fail to reject $H_0$ when it is false. In other words, when the man is guilty but found not guilty.

$\beta$:
$\beta$ is the probability of a Type II error, or in other words, it is the probability that Mr. Orangejuice is guilty but found not guilty.

As you can see here, the Type I error (putting an innocent man in jail) is the more serious error. Ethically, it is more serious to put an innocent man in jail than to let a guilty man go free. So to minimize the probability of a type I error we would choose a smaller significance level.

## Try it!

An inspector has to choose between certifying a building as safe or saying that the building is not safe. There are two hypotheses:

1. Building is safe
2. Building is not safe

Set up the null and alternative hypotheses. Interpret Type I and Type II error.

$H_0\colon$ Building is not safe vs $H_a\colon$ Building is safe

Decision Reality
$H_0$ is true $H_0$ is false
Reject $H_0$, (conclude  $H_a$) Reject "building is not safe" when it is not safe (Type I Error) Correct decision
Fail to reject  $H_0$ Correct decision Failing to reject 'building not is safe' when it is safe (Type II Error)

Power and $\beta$ are complements of each other. Therefore, they have an inverse relationship, i.e. as one increases, the other decreases.

It makes sense for us to set up the $H_0$ and $H_a$ as above (that is, assume building is not safe until proven otherwise), because if we switch $H_0$ and $H_a$ (that is, if $H_0$ was building is safe and $H_a$ is building is not safe) and if we fail to reject $H_0$, we cannot quite conclude that building is safe (we can only fail to reject $H_0$, we cannot accept $H_0$).

# 6a.2 - Steps for Hypothesis Tests

6a.2 - Steps for Hypothesis Tests

## The Logic of Hypothesis Testing

A hypothesis, in statistics, is a statement about a population parameter, where this statement typically is represented by some specific numerical value. In testing a hypothesis, we use a method where we gather data in an effort to gather evidence about the hypothesis.

How do we decide whether to reject the null hypothesis?

• If the sample data are consistent with the null hypothesis, then we do not reject it.
• If the sample data are inconsistent with the null hypothesis, but consistent with the alternative, then we reject the null hypothesis and conclude that the alternative hypothesis is true.

## Six Steps for Hypothesis Tests

In hypothesis testing, there are certain steps one must follow. Below these are summarized into six such steps to conducting a test of a hypothesis.

1. Set up the hypotheses and check conditions: Each hypothesis test includes two hypotheses about the population. One is the null hypothesis, notated as $H_0$, which is a statement of a particular parameter value. This hypothesis is assumed to be true until there is evidence to suggest otherwise. The second hypothesis is called the alternative, or research hypothesis, notated as $H_a$. The alternative hypothesis is a statement of a range of alternative values in which the parameter may fall. One must also check that any conditions (assumptions) needed to run the test have been satisfied e.g. normality of data, independence, and number of success and failure outcomes.
1. Decide on the significance level, $\alpha$: This value is used as a probability cutoff for making decisions about the null hypothesis. This alpha value represents the probability we are willing to place on our test for making an incorrect decision in regards to rejecting the null hypothesis. The most common $\alpha$ value is 0.05 or 5%. Other popular choices are 0.01 (1%) and 0.1 (10%).
1. Calculate the test statistic: Gather sample data and calculate a test statistic where the sample statistic is compared to the parameter value. The test statistic is calculated under the assumption the null hypothesis is true and incorporates a measure of standard error and assumptions (conditions) related to the sampling distribution.
1. Calculate probability value (p-value), or find the rejection region: A p-value is found by using the test statistic to calculate the probability of the sample data producing such a test statistic or one more extreme. The rejection region is found by using alpha to find a critical value; the rejection region is the area that is more extreme than the critical value. We discuss the p-value and rejection region in more detail in the next section.
1. Make a decision about the null hypothesis: In this step, we decide to either reject the null hypothesis or decide to fail to reject the null hypothesis. Notice we do not make a decision where we will accept the null hypothesis.
1. State an overall conclusion: Once we have found the p-value or rejection region, and made a statistical decision about the null hypothesis (i.e. we will reject the null or fail to reject the null), we then want to summarize our results into an overall conclusion for our test.

We will follow these six steps for the remainder of this Lesson. In the future Lessons, the steps will be followed but may not be explained explicitly.

Step 1 is a very important step to set up correctly. If your hypotheses are incorrect, your conclusion will be incorrect. In this next section, we practice with Step 1 for the one sample situations.

# 6a.3 - Set-Up for One-Sample Hypotheses

6a.3 - Set-Up for One-Sample Hypotheses

We will continue our discussion by considering two specific hypothesis tests: a test of one proportion, and a test of one mean. We will provide the general set up of the hypothesis and the test statistics for both tests. From there, we will branch off into specific discussions on each of these tests.

In order to make a judgment about the value of a parameter, the problem can be set up as a hypothesis testing problem. We usually set the hypothesis that one wants to conclude as the alternative hypothesis, also called the research hypothesis.

Since hypothesis tests are about a parameter value, the hypotheses use parameter notation - $p$ for proportion or $\mu$ for mean - in their arrangement. For tests of a proportion or a test of a mean, we would choose the appropriate alternative based on our research question.

Below are the possible hypotheses from which we would select only one of them based on the research question. The symbols $p_0$ and $\mu_0$ are used in these general statements and in practice, get replaced by the parameter value, or constant, being tested.

One Sample Proportion
Research Question Is the population proportion different from $p_0$? Is the population proportion greater than $p_0$? Is the population proportion less than $p_0$?
Null Hypothesis, $H_{0}$ $p=p_0$ $p= p_0$ $p= p_0$
Alternative Hypothesis, $H_{a}$ $p\neq p_0$ $p> p_0$ $p< p_0$
Type of Hypothesis Test Two-tailed, non-directional Right-tailed, directional Left-tailed, directional
*$p_{0}$ is the hypothesized population proportion

One Sample Mean
Research Question Is the population mean different from $\mu_{0}$? Is the population mean greater than $\mu_{0}$? Is the population mean less than $\mu_{0}$?
Null Hypothesis, $H_{0}$ $\mu=\mu_{0}$ $\mu=\mu_{0}$ $\mu=\mu_{0}$
Alternative Hypothesis, $H_{a}$ $\mu\neq \mu_{0}$ $\mu> \mu_{0}$ $\mu<\mu_{0}$
Type of Hypothesis Test Two-tailed, non-directional Right-tailed, directional Left-tailed, directional
*$\mu_{0}$ is the hypothesized population mean

The most important step in hypothesis testing is choosing the correct parameter of interest and correctly setting up the alternative hypothesis.

## Example 6-3 Null and Alternative Hypotheses

In each of the following scenarios, determine the parameter of interest and the null and alternative hypotheses.

1. When debating the State Appropriation for Penn State, the following question is asked: "Are the majority of students at Penn State from Pennsylvania?"
The response variable is 'State' and is a qualitative variable. Therefore, the parameter of interest would be $p$ the population proportion of students from PA. The hypotheses should be in terms of $p$. The value we are testing is the “majority” (50%) or $p_0=0.5$. The majority also implies greater than 50%. Thus, the hypothesis set up would be a right-tailed test.

$H_0\colon p=0.5$ vs. $H_a\colon p>0.5$

2. A consumer test agency wants to see the whether the mean lifetime of a brand of tires is less than 42,000 miles. The tire manufacturer advertises that the average lifetime is at least 42,000 miles.
The response variable here is 'lifetime' and is a quantitative variable. Therefore, set up the hypotheses in terms of $\mu$. Here the value of $\mu_0$ is 42,000. With the consumer test agency wanting to research that the mean lifetime is below 42,000, we would set up the hypotheses as a left-tailed test:

$H_0\colon \mu=42000$ vs. $H_a\colon \mu<42000$

3. The length of a certain lumber from a national home building store is supposed to be 8.5 feet. A builder wants to check whether the shipment of lumber she receives has a mean length different from 8.5 feet.
The response variable is the 'length of lumber' and is quantitative. Therefore, we set up the hypotheses in terms of $\mu$. Here the value of $\mu_0$ is 8.5. With the builder wanting to check if the mean length is different from 8.5, she would set up the hypotheses as a two-tailed test:

$H_0\colon \mu=8.5$ vs $H_a\colon \mu\ne 8.5$

4. A political news company believes the national approval rating for the current president has fallen below 40%.
The response variable here is 'approval rating' and is a qualitative variable. Therefore, we will set up the hypothesis in terms of $p$. In this case, the $p_0$ value is 0.4 and the hypotheses would be set up as a left-tailed test:

$H_0\colon p=0.4$ vs. $H_a\colon p<0.4$

# 6a.4 - Hypothesis Test for One-Sample Proportion

6a.4 - Hypothesis Test for One-Sample Proportion

## Overview

In this section, we will demonstrate how we use the sampling distribution of the sample proportion to perform the hypothesis test for one proportion.

Recall that if $np$ and $n(1-p)$ are both greater than five, then the sample proportion, $\hat{p}$, will have an approximate normal distribution with mean $p$, standard error $\sqrt{\frac{p(1-p)}{n}}$, and the estimated standard error $\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}$.

In hypothesis testing, we assume the null hypothesis is true. Remember, we set up the null hypothesis as $H_0\colon p=p_0$. This is very important! This statement says that we are assuming the unknown population proportion, $p$, is equal to the value $p_0$.

Since this is true, then we can follow the same logic above. Therefore, if $np_0$ and $n(1-p_0)$ are both greater than five, then the sampling distribution of the sample proportion will be approximately normal with mean $p_0$ and standard error $\sqrt{\frac{p_0(1-p_0)}{n}}$.

We can find probabilities associated with values of $\hat{p}$ by using:

$z^*=\dfrac{\hat{p}-p_0}{\sqrt{\dfrac{p_0(1-p_0)}{n}}}$

## Example 6-4

Referring back to a previous example, say we take a random sample of 500 Penn State students and find that 278 are from Pennsylvania. Can we conclude that the proportion is larger than 0.5?

Is 0.556(=278/500) much bigger than 0.5? What is much bigger?

This depends on the standard deviation of $\hat{p}$ under the null hypothesis.

$\hat{p}-p_0=0.556-0.5=0.056$

The standard deviation of $\hat{p}$, if the null hypothesis is true (e.g. when $p_0=0.5$) is:

$\sqrt{\dfrac{p_0(1-p_0)}{n}}=\sqrt{\dfrac{0.5(1-0.5)}{500}}=0.0224$

We can compare them by taking the ratio.

$z^*=\dfrac{\hat{p}-p_0}{\sqrt{\frac{p_0(1-p_0)}{n}}}=\dfrac{0.556-0.5}{\sqrt{\frac{0.5(1-0.5)}{500}}}=2.504$

Therefore, assuming the true population proportion is 0.5, a sample proportion of 0.556 is 2.504 standard deviations above the mean.

The $z^*$ value we found in the above example is referred to as the test statistic.

Test statistic
The sample statistic one uses to either reject $H_0$ (and conclude $H_a$ ) or fail to reject $H_0$.

# 6a.4.1 - Making a Decision

6a.4.1 - Making a Decision

In the previous example for Penn State students, we found that assuming the true population proportion is 0.5, a sample proportion of 0.556 is 2.504 standard deviations above the mean, $p$.

Is it far enough away from the 0.5 to suggest that there is evidence against the null? Is there a cutoff for the number of standard deviations that we would find acceptable?

What if instead of a cutoff, we found a probability? Recall the alternative hypothesis for this example was $H_a\colon p>0.5$. So if we found, for example, the probability of a sample proportion being 0.556 or greater, then we get $P(Z>2.504)=0.0061$.

This means that, if the true proportion is 0.5, the probability we would get a sample proportion of 0.556 or greater is 0.0061. Very small! But is it small enough to say there is evidence against the null?

To determine whether the probability is small or how many standard deviations are “acceptable”, we need a preset level of significance, which is the probability of a Type I error. Recall that a Type I error is the event of rejecting the null hypothesis when that null hypothesis is true. Think of finding guilty a person who is actually innocent.

When we specify our hypotheses, we should have some idea of what size of a Type I error we can tolerate. It is denoted as $\alpha$. A conventional choice of $\alpha$ is 0.05. Values ranging from 0.01 to 0.1 are also common and the choice of $\alpha$ depends on the problem one is working on.

Once we have this preset level, we can determine whether or not there is significant evidence against the null. There are two methods to determine if we have enough evidence: the rejection region method and the p-value method.

## Rejection Region Approach

We start the hypothesis test process by determining the null and alternative hypotheses. Then we set our significance level, $\alpha$, which is the probability of making a Type I error. We can determine the appropriate cutoff called the critical value and find a range of values where we should reject, called the rejection region.

Critical values
The values that separate the rejection and non-rejection regions.
Rejection region
The set of values for the test statistic that leads to rejection of $H_0$

The graphs below show us how to find the critical values and the rejection regions for the three different alternative hypotheses and for a set significance level, $\alpha$. The rejection region is based on the alternative hypothesis.

#### Left-Tailed Test

Reject $H_0$ if the test statistics is less than or equal to the critical value ($c_\alpha$)

#### Right-Tailed Test

Reject $H_0$ if the test statistic is greater than or equal to the critical value ($c_{1-\alpha}$)

#### Two-Tailed Test

Reject $H_0$ if the absolute value of the test statistic is greater than or equal to the absolute value of the critical value ($c_{\alpha/2}$).

The rejection region is the region where, if our test statistic falls, then we have enough evidence to reject the null hypothesis. If we consider the right-tailed test, for example, the rejection region is any value greater than $c_{1-\alpha}$, where $c_{1-\alpha}$ is the critical value.

## P-Value Approach

As with the rejection region approach, the P-value approach will need the null and alternative hypotheses, the significance level, and the test statistic. Instead of finding a region, we are going to find a probability called the p-value.

P-value
The p-value (or probability value) is the probability that the test statistic equals the observed value or a more extreme value under the assumption that the null hypothesis is true.

The p-value is a probability statement based on the alternative hypothesis. The p-value is found differently for each of the alternative hypotheses.

• Left-tailed: If $H_a$ is left-tailed, then the p-value is the probability the sample data produces a value equal to or less than the observed test statistic.
• Right-tailed: If $H_a$ is right-tailed, then the p-value is the probability the sample data produces a value equal to or greater than the observed test statistic.
• Two-tailed: If $H_a$ is two-tailed, then the p-value is two times the probability the sample data produces a value equal to or greater than the absolute value of the observed test statistic.

So for one-sample proportions we have...

Left-Tailed

$P(Z \le z^*)$

Right-Tailed

$P(Z \ge z^*)$

Two-Tailed

$2$ x $P(Z \ge |z^*|)$

Once we find the p-value, we compare the p-value to our preset significance level.

• If our p-value is less than or equal to $\alpha$, then there is enough evidence to reject the null hypothesis.
• If our p-value is greater than $\alpha$, there is not enough evidence to reject the null hypothesis.

Caution! One should be aware that $\alpha$ is also called level of significance. This makes for a confusion in terminology. $\alpha$ is the preset level of significance whereas the p-value is the observed level of significance. The p-value, in fact, is a summary statistic which translates the observed test statistic's value to a probability which is easy to interpret.

Important note: We can summarize the data by reporting the p-value and let the users decide to reject $H_0$ or not to reject $H_0$ for their subjectively chosen $\alpha$ values.

This video will further explain the meaning of the p-value.

# 6a.4.2 - More on the P-Value and Rejection Region Approach

6a.4.2 - More on the P-Value and Rejection Region Approach

## Two Methods for Making a Statistical Decision

Of the two methods for making a statistical decision, the p-value approach is more commonly used and provided in published literature. However, understanding the rejection region approach can go a long way in one's understanding of the p-value method. In the video, we show how the two methods are related. Regardless of the method applied, the conclusions from the two approaches are exactly the same.

## Comparing the Two Approaches

Both approaches will ensure the same conclusion and either one will work. However, using the p-value approach has the following advantages:

• Using the rejection region approach, you need to check the table or software for the critical value every time you use a different $\alpha$ value.
• In addition to just using it to reject or not reject $H_0$ by comparing p-value to $\alpha$ value, the p-value also gives us some idea of the strength of the evidence against $H_0$.

# 6a.4.3 - Steps in Conducting a Hypothesis Test for $p$

6a.4.3 - Steps in Conducting a Hypothesis Test for $p$

## Six Steps for One-Sample Proportion Hypothesis Test

### Steps 1-3

Let's apply the general steps for hypothesis testing to the specific case of testing a one-sample proportion.

Step 1: Set up the hypotheses and check conditions.

$np_0\ge 5$ and $n(1−p_0)≥5$

One Proportion Z-test Hypotheses

Left-Tailed
$H_0\colon p=p_0$
$H_a\colon p<p_0$
Right-Tailed
$H_0\colon p=p_0$
$H_a\colon p>p_0$
Two-Tailed
$H_0\colon p=p_0$
$H_a\colon p\ne p_0$

Step 2: Decide on the level of significance $\boldsymbol{(\alpha)}$.

Step 3: Calculate the test statistic.

One Proportion Z-test: $z^*=\dfrac{\hat{p}-p_0}{\sqrt{\frac{p_0(1-p_0)}{n}}}$

The first few steps (Step 1 - Step 3) are exactly the same as the rejection region or p-value approach. The next part will discuss steps 4 - 6 for both approaches.

## Rejection Region Approach

### Steps 4-6

Step 4: Find the appropriate critical values for the tests. Write down clearly the rejection region for the problem.

#### Two-Tailed Test

View the critical values and regions with an $\alpha=.05$.

Step 5: Make a decision about the null hypothesis.
Check to see if the value of the test statistic falls in the rejection region. If it does, then reject $H_0$ (and conclude $H_a$). If it does not fall in the rejection region, do not reject $H_0$.
Step 6: State an overall conclusion.

## P-Value Approach

### Steps 4-6

Step 4: Compute the appropriate p-value based on our alternative hypothesis.
Left-Tailed
$P(Z \le z^*)$
Right-Tailed
$P(Z\ge z^*)$
Two-Tailed
$2$ x $P(Z \ge |z^*|)$
Step 5: Make a decision about the null hypotheses.
If the p-value is less than the significance level, then reject the null hypothesis. If the p-value is greater than the significance level, fail to reject the null hypothesis.
Step 6: State an overall conclusion.
Note! Recall that the P-value is a probability of obtaining a value of the test statistic or a more extreme value of the test statistic assuming that the null hypothesis is true.

## Example 6-5: Penn State Students from Pennsylvania

Referring back to example 6-4. Say we take a random sample of 500 Penn State students and find that 278 are from Pennsylvania. Can we conclude that the proportion is larger than 0.5 at a 5% level of significance?

Conduct the test using both the rejection region and p-value approach.

Step 1: Set up the hypotheses and check conditions.

Set up the hypotheses. Since the research hypothesis is to check whether the proportion is greater than 0.5 we set it up as a one (right)-tailed test:

$H_0\colon p=0.5$ vs $H_a\colon p>0.5$

Can we use the z-test statistic? The answer is yes since the hypothesized value $p_0$ is $0.5$ and we can check that: $np_0=500(0.5)=250 \ge 5$ and $n(1-p_0)=500(1-0.5)=250 \ge 5$

Step 2: Decide on the significance level, $\alpha$.

According to the question, $\alpha= 0.05$.

Step 3: Calculate the test statistic:

\begin{align} z^*&= \dfrac{0.556-0.5}{\sqrt{\frac{0.5(1-0.5)}{500}}}\\z^*&=2.504 \end{align}

#### Rejection Region Approach

Step 4: Find the appropriate critical values for the test using the z-table. Write down clearly the rejection region for the problem.

We can use the standard normal table to find the value of $Z_{0.05}$. From the table, $Z_{0.05}$ is found to be $1.645$ and thus the critical value is $1.645$. The rejection region for the right-tailed test is given by:

$z^*>1.645$

Step 5: Make a decision about the null hypothesis.

The test statistic or the observed Z-value is $2.504$. Since $z^*$ falls within the rejection region, we reject $H_0$.

Step 6: State an overall conclusion.

With a test statistic of $2.504$ and critical value of $1.645$ at a 5% level of significance, we have enough statistical evidence to reject the null hypothesis. We conclude that a majority of the students are from Pennsylvania.

#### P-Value Approach

Step 4: Compute the appropriate p-value based on our alternative hypothesis:
$\text{p-value}=P(Z\ge z^*)=P(Z \ge 2.504)=0.0062$

Step 5: Make a decision about the null hypothesis.

Since $\text{p-value} = 0.0062 \le 0.05$ (the $\alpha$ value), we reject the null hypothesis.

Step 6: State an overall conclusion.

With a test statistic of $2.504$ and p-value of $0.0062$, we reject the null hypothesis at a 5% level of significance. We conclude that a majority of the students are from Pennsylvania.

## Try it!

### Online Purchases

An e-commerce research company claims that 60% or more graduate students have bought merchandise online. A consumer group is suspicious of the claim and thinks that the proportion is lower than 60%. A random sample of 80 graduate students shows that only 22 students have ever done so. Is there enough evidence to show that the true proportion is lower than 60%?

Conduct the test at 10% Type I error rate and use the p-value and rejection region approaches.

Step 1: Set up the hypotheses and check conditions.

Set up the hypotheses. Since the research hypothesis is to check whether the proportion is less than 0.6 we set it up as a one (left)-tailed test:

$H_0\colon p=0.6$ vs $H_a\colon p<0.6$

Can we use the z-test statistic? The answer is yes since the hypothesized value $p_0$ is 0.6 and we can check that: $np_0=80(0.6)=48 \ge 5$ and $n(1-p_0)=80(1-0.6)=32 \ge 5$

Step 2: Decide on the significance level, $\alpha$.

According to the question, $\alpha= 0.1$.

Step 3: Calculate the test statistic:

\begin{align} z^* &=\frac{\hat{p}-p_0}{\sqrt{\frac{p_0(1-p_0)}{n}}}\\&=\frac{.275-0.6}{\sqrt{\frac{0.6(1-0.6)}{80}}}\\&=-5.93 \end{align}

#### Rejection Region Approach

Step 4: Find the appropriate critical values for the test using the z-table. Write down clearly the rejection region for the problem.

The critical value is the value of the standard normal where 10% fall below it. Using the standard normal table, we can see that the value is -1.28.

Step 5: Make a decision about the null hypothesis.

The rejection region is any $z^*$ such that $z^*<-1.28$ . Since our test statistic, -5.93, is inside the rejection region, we reject the null hypothesis.

Step 6: State an overall conclusion.

There is enough evidence in the data provided to suggest, at 10% level of significance, that the true proportion of students who made purchases online was less than 60%.

#### P-Value Approach

Step 4: Compute the appropriate p-value based on our alternative hypothesis:
$\text{p-value}=P(Z \le -5.93) = 0.0000000003$
Step 5: Make a decision about the null hypothesis.

Since our p-value is very small and less than our significance level of 10%, we reject the null hypothesis.

Step 6: State an overall conclusion.

There is enough evidence in the data provided to suggest, at 10% level of significance, that the true proportion of students who made purchases online was less than 60%.

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

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

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.

# 6a.6 - Minitab: One-Sample $p$ Hypothesis Testing

6a.6 - Minitab: One-Sample $p$ Hypothesis Testing

Note about Software and Hypothesis Testing! In general, as we will learn, software usually performs tests using the p-value method. That is, the output from software will provide the test statistic and the p-value, along with some other general information (e.g. a confidence interval). To perform rejection region tests you would need to find the critical values from the tables. However, at the end of this lesson, we do demonstrate how to find the correct critical value from the standard normal distribution.

## Minitab® – Conduct a One-Sample Proportion Z-Test

To conduct the one-sample proportion Z-test in Minitab...

1. Click Stat > Basic Stat > 1 Proportion .
2. In the drop-down box use "One or more samples, each in a column" if you have the raw data, otherwise select "Summarized data" if you only have the sample statistics.
3. If using the raw data enter the column of interest into the blank variable window below the drop down selection. If using summarized data enter the number of successes for Events and the sample size for Trials .
4. Click the check box for "Perform hypothesis test" and enter the null hypothesis value.
5. Click Options .
6. Enter the confidence level associated with alpha (e.g. 95% for alpha of 5%).
7. From the drop down list for "Alternative hypothesis" select the correct alternative.
8. If conditions are satisfied to perform a z-test for one proportion, select from the "Method" field "normal approximation"
9. Click OK and OK .

## Example 6-6: Penn State Students from Pennsylvania

Recall our one-proportion example at the beginning of this lesson on whether the majority of Penn State students are from Pennsylvania. In that example, we took a random sample of 500 Penn State students and found that 278 are from Pennsylvania. Can we conclude that the proportion is larger than 0.5 at a 5% level of significance? Also recall in that example we found by hand a test statistic of $z^* = 2.504$ and p-value of 0.0062.

Our hypotheses were: $H_0\colon p=0.5$ and $H_a \colon p>0.5$

Using Minitab...

1. Select Stat > Basic Stat > 1 Proportion .
2. Choose the summarized data option and enter 278 for "Events" and 500 as the "Trials".
3. Check the box for "Perform Hypothesis Test" and enter the null value of 0.5
4. Click Options . With our stated alpha value of 5% we keep the default confidence level of 95.
5. Select Proportion > hypothesized proportion from the Alternative Hypothesis list. Since we verified the the conditions were satisfied, select Normal Approximation under Method.
6. Click OK and OK again.

The output is:

Sample X N Sample p 95% Lower Bound Z-Value P-Value
1 278 500 0.556000 0.519451 2.50 0.006

As the output indicates, our by-hand calculations were very accurate!

## Minitab® – Finding the Critical Value for a One-Sample Proportion Test

Although we can find values on the standard normal table, it is more accurate to find values using software. Finding values for the standard normal is discussed in more detail in Lesson 3. We present this here as a review. In order to obtain the exact critical value to use in order to conduct the rejection region approach we can use a statistical package such as Minitab.

To find the critical value...

1. Choose Calc > Probability Distributions > Normal distribution
2. Choose the radio button for "Inverse Cumulative Distribution" (this finds the z-value that produces the entered probability to the left of it).
3. Choose the radio button for "Input constant" and enter the alpha value (if one-side alternative) or alpha/2 (if two-sided alternative).
4. Click Ok

# 6a.7 - Lesson 6a Summary

6a.7 - Lesson 6a Summary

In this Lesson, we presented the logic and terminology of hypothesis testing. Then, we presented the six steps of hypothesis testing in statistics.

We developed the hypothesis test for one population proportion. The rejection region and the p-value approach were presented as ways to come to a conclusion.

Finally, we discussed how a two-sided test relates to a confidence interval.

In the next Lesson, we will present the statistical theory for a hypothesis test for a population mean from one sample

 [1] Link ↥ Has Tooltip/Popover Toggleable Visibility