Back to homeMathematics · AP Statistics · Change subject
Start for free
AP Stats · Mathematics
Statistics · Inference

Hypothesis Testing

Before you start, make sure you know: The normal distribution (Algebra 2)
Before you start, make sure you know: Normal dist. with mean 0 and std dev 1 N(0,1) (Algebra 2)

Tony's Pizza in Chicago promises that the mean delivery time is $30$ minutes. Jayden is tired of cold pizza, so he tracks $64$ random deliveries and finds a mean of $32.5$ minutes. From years of company data, delivery times are known to have a standard deviation of $8$ minutes. Is the $2.5$-minute gap just bad luck, or is the promise really false? A hypothesis test (also called a significance test) is the formal way to decide whether a sample contradicts a claim, or whether it is the kind of difference random chance produces all the time.

Stating the Hypotheses

Every test starts with two competing statements about a population parameter ($\mu$ or $p$).

Three normal curves showing the shaded rejection regions for a two-tailed test, a left-tailed test, and a right-tailed test. μ₀ μ₀ μ₀ Hₐ: μ ≠ μ₀ Hₐ: μ < μ₀ Hₐ: μ > μ₀ two-tailed left-tailed right-tailed

The words in the question tell you which one to use. "Different from," "changed" → $\neq$. "Lower," "decreased," "less than promised" → $<$. "Higher," "slower than advertised," "more than" → $>$.

Practice★☆☆Not started
A streaming platform claims that the mean time its users spend watching series is $120$ minutes a day. A group of students suspects that, due to exams, this time has…

A streaming platform claims that the mean time its users spend watching series is $120$ minutes a day. A group of students suspects that, due to exams, this time has decreased. To carry out a hypothesis test on this claim:

  1. a) Clearly define the null hypothesis ($H_0$) and the alternative hypothesis ($H_1$).
  1. b) State whether it is a one-tailed or two-tailed test.
μ = 120 H₀: μ = 120 H₁: μ < 120 One-tailed test
Solve

Type I and Type II Errors

A test uses a sample, so it can be wrong even when we do everything correctly.

Decision table for a hypothesis test showing correct decisions and Type I and Type II errors depending on whether the null hypothesis is true. H₀ is true H₀ is false Correct Type II error (β) Type I error (α) Correct (power) Fail to reject H₀ Reject H₀

There is a trade-off: making $\alpha$ smaller (being harder to convince) makes $\beta$ larger. The only way to shrink both is a larger sample.

Practice★☆☆Not started
Explain in your own words what it means to commit a Type I Error in the context of a study attempting to prove whether a new study method improves math scores (where…

Explain in your own words what it means to commit a Type I Error in the context of a study attempting to prove whether a new study method improves math scores (where $H_0$ is that the method produces no improvements).

Solve
Practice★★☆Not started
A new model of running shoes designed to increase performance is being tested. The manufacturer sets the null hypothesis $H_0$: "The mean performance with the new model…

A new model of running shoes designed to increase performance is being tested. The manufacturer sets the null hypothesis $H_0$: "The mean performance with the new model is equal to that of the previous model" against the alternative $H_1$: "The mean performance is higher".

Explain with reasoning what it would mean to commit a Type I error and a Type II error in this practical context. Which of the two errors do you think would be more damaging to the company's brand image if discovered later?

Solve

The z-Test for a Mean

Suppose $H_0: \mu = \mu_0$ is true. Then the sample mean $\bar{x}$ should land near $\mu_0$. The test asks: how many standard errors is our $\bar{x}$ from $\mu_0$, and how likely is a result at least that far away?

The same decision can be made with a critical value $z^*$: reject $H_0$ when $z$ falls in the rejection region.

$\alpha$ one-tailed $z^*$ two-tailed $\pm z^*$
$0.10$ $1.282$ $\pm 1.645$
$0.05$ $1.645$ $\pm 1.960$
$0.01$ $2.326$ $\pm 2.576$

(Some tables round $2.576$ to $2.575$.) On a TI-84, the p-value for a left tail is normalcdf(-1E99, z), and invNorm(1-α) gives a critical value. The sample mean in each problem is a single value from the sampling distribution, so the picture below is always the curve for $z$.

Standard normal curve with the right-tail rejection region shaded beyond the critical value z-star, and an observed z-value that falls outside it. z* = 1.645 rejection region (area α) zobs
Practice★☆☆Not started
We are carrying out a two-tailed hypothesis test for the mean of a normal population with known $\sigma$. After calculating the test statistic with the data from a…

We are carrying out a two-tailed hypothesis test for the mean of a normal population with known $\sigma$. After calculating the test statistic with the data from a sample, we obtain a value of $z_{exp} = 2,15$.

If the critical values for a significance level of $\alpha = 0,05$ are $-1,96$ and $1,96$, reason whether we should accept or reject the null hypothesis.

Solve
Practice★★☆Not started
An online shopping courier company claims that the mean delivery time for its parcels in large cities is $48$ hours, with a known standard deviation of $\sigma = 6$…

An online shopping courier company claims that the mean delivery time for its parcels in large cities is $48$ hours, with a known standard deviation of $\sigma = 6$ hours. A group of users suspects that the service is slower than advertised. To check this, they record the delivery times of $36$ randomly chosen orders, obtaining a mean of $50,5$ hours.

State the null and alternative hypotheses for this case and carry out a one-tailed (right-tailed) hypothesis test with a confidence level of $99\ \%$. Is there sufficient evidence to claim that the company takes longer than it claims?

Solve
Practice★★★Not started
A study on youth mental health indicates that the mean daily time that high school seniors spend on TikTok is $120$ minutes, with a standard deviation of $30$ minutes. A…

A study on youth mental health indicates that the mean daily time that high school seniors spend on TikTok is $120$ minutes, with a standard deviation of $30$ minutes. A school counselor believes that in their school, due to the pressure of SAT exams, the mean time is significantly lower. They take a random sample of $50$ students and obtain a mean of $112$ minutes.

  1. a) Define the appropriate hypothesis test for the counselor's belief.
  2. b) Calculate the p-value of the sample obtained.
  3. c) If a significance level of $1\%$ is used, what conclusion should the counselor draw? What if the significance level were $5\%$?
Solve

Rejection and Acceptance Regions

Sometimes it is handier to decide before collecting data which values of the sample mean will make you reject. Solve $z = \pm z^*$ for $\bar{x}$.

Standard normal curve for a two-tailed test at alpha 0.05 with both tails beyond minus 1.96 and 1.96 shaded as rejection regions and the middle labeled fail to reject. −1.96 1.96 0 Reject H₀ Reject H₀ Fail to reject H₀ (middle 95%) α/2 α/2
Practice★☆☆Not started
In the quality control of a potato chip factory, we want to check if the mean weight of the bags is really $150$ ounces, as indicated on the packaging. It is known that…

In the quality control of a potato chip factory, we want to check if the mean weight of the bags is really $150$ ounces, as indicated on the packaging. It is known that the population standard deviation is $\sigma = 5$ ounces. If it is suspected that the bags may weigh both more and less than indicated:

  1. a) Set up the hypotheses $H_0$ and $H_1$.
  1. b) If we set a significance level of $\alpha = 0,05$, calculate the critical values $z_{\alpha/2}$ that delimit the acceptance zone.
Solve
Practice★☆☆Not started
Given a normal population with standard deviation $\sigma = 12$, we want to test $H_0: \mu = 50$ against $H_1: \mu > 50$ with a significance level of $\alpha = 0,05$.…

Given a normal population with standard deviation $\sigma = 12$, we want to test $H_0: \mu = 50$ against $H_1: \mu > 50$ with a significance level of $\alpha = 0,05$.

Calculate the critical value of the sample mean $\bar{x}_c$ for a sample of size $n = 36$ using the formula $\bar{x}_c = \mu_0 + z_{\alpha} \cdot \frac{\sigma}{\sqrt{n}}$, knowing that for $\alpha = 0,05$ the value of $z_{\alpha} = 1,645$.

Solve
Practice★★☆Not started
A streaming platform suspects that the mean daily time its users spend watching content has changed compared to last year, which was $120$ minutes. They assume a normal…

A streaming platform suspects that the mean daily time its users spend watching content has changed compared to last year, which was $120$ minutes. They assume a normal distribution with $\sigma = 30$ minutes. They take a random sample of $100$ users and observe a mean of $126$ minutes.

Determine the acceptance region and the critical region for a two-tailed test with a significance level of $10\ \%$. What decision should the platform make regarding its suspicion?

μ₀ = 120 126 c₁ = ? c₂ = ? Acceptance Region 1 - α = 0.90 Critical Region α/2 = 0.05 Critical Region α/2 = 0.05 H₀: μ = 120 H₁: μ ≠ 120 n = 100 σ = 30 x̄ = 126 Decision?
Solve

The z-Test for a Proportion

The acceptance region for $\hat{p}$ is $p_0 \pm z^*\sqrt{p_0(1-p_0)/n}$, just like the mean.

Number line for sample proportions showing the non-rejection region from 0.332 to 0.468 centered at p0 equals 0.40, with the observed value 0.46 inside it. p̂ = 0.46 0.332 p₀ = 0.40 0.468 Non-rejection region for p̂ (α = 0.05)
Practice★☆☆Not started
A sports shoe brand claims that $60\%$ of marathon runners use its products. A sports journalist suspects that the proportion is lower. To carry out the test, $100$…

A sports shoe brand claims that $60\%$ of marathon runners use its products. A sports journalist suspects that the proportion is lower. To carry out the test, $100$ runners are surveyed and it is found that $52$ of them use this brand.

  1. a) Calculate the test statistic (sample proportion) $\hat{p}$.
  1. b) Write the expression for the standardised test statistic $Z = \frac{\hat{p} - p_0}{\sqrt{\frac{p_0 \cdot q_0}{n}}}$ for this case.
Solve
Practice★☆☆Not started
A sociologist claims that $35\%$ of American teenagers prefer physical format to digital for reading books. To test this claim against the suspicion that the proportion…

A sociologist claims that $35\%$ of American teenagers prefer physical format to digital for reading books. To test this claim against the suspicion that the proportion is different, a random sample is chosen. Determine the acceptance region for the sample proportion if a confidence level of $95\%$ is used and the sample size is $n = 400$ people.

p₀ = 0.35 0,3033 0,3967 95% Acceptance Region 2,5% Rejection 2,5% Rejection
Solve
Practice★★★Not started
A manufacturer of electronic components for smartphones guarantees that the percentage of defective parts in its production is, at most, $2\%$. An external quality…

A manufacturer of electronic components for smartphones guarantees that the percentage of defective parts in its production is, at most, $2\%$. An external quality control decides to sample $2500$ components to verify this guarantee. After the analysis, $62$ defective parts are found.

  1. a) Formulate the hypotheses for a right-tailed test.
  2. b) Calculate the value of the test statistic.
  3. c) Determine the critical significance level (p-value). In light of the result, do you think the manufacturer should review its production process? Justify your answer.
Solve

Tests and Confidence Intervals

A confidence interval and a two-tailed test are two views of the same information.

Number line with a 95 percent confidence interval from 24.3 to 29.7 minutes; the value 28 is inside it and 30 is outside it. 22 24 26 32 μ₀ = 28 fail to reject H₀ μ₀ = 30 reject H₀ 95% CI: (24.3, 29.7)
Practice★★☆Not started
A study has been carried out on the monthly leisure expenditure of college students in a city, assuming it follows a normal distribution with standard deviation…

A study has been carried out on the monthly leisure expenditure of college students in a city, assuming it follows a normal distribution with standard deviation $\$\sigma = 20$. A $95\ \%$ confidence interval of $(75,1; 84,9)$ has been obtained for the mean.

Without performing new standardization calculations, use the relationship between confidence intervals and hypothesis testing to answer: Would the null hypothesis $\$H0: \mu = 70$ be rejected against $\$H_1: \mu \neq 70$ with a significance level of $\alpha = 0,05$? What if the null hypothesis were $\$H0: \mu = 80$? Justify your answer.

Solve
Practice★★★Not started
We want to investigate whether a new study method improves performance in math. The historical mean score in a region is $6,4$ with a standard deviation of…

We want to investigate whether a new study method improves performance in math. The historical mean score in a region is $6,4$ with a standard deviation of $\sigma = 1,2$. The new method is applied to an experimental group of $36$ students and a mean score of $6,9$ is obtained.

  1. a) Carry out a one-tailed hypothesis test for a significance level of $\alpha = 0,05$.
  2. b) If the $95\%$ confidence interval for the mean of this group were $(6,508 ; 7,292)$, could you have answered the previous section without calculating the test statistic? Explain the relationship between confidence intervals and hypothesis testing.
6.0 6.2 6.6 6.8 7.0 7.2 6.73 Rejection region α = 0.05 μ₀ = 6.4 95% Confidence Interval 6.508 7.292 x̄ = 6.9
Solve

Error Probabilities, Power, and Sample Size

Now we can put numbers on $\alpha$ and $\beta$.

The interactive below shows the sampling distribution under $H_0$ (centered at $0$) and under a true mean shifted by the slider. The more the curves overlap, the larger $\beta$.

Practice★★★Not started
A brand of wireless headphones claims that the battery of its new "Pro-Z" model lasts, on average, $24$ hours. It is known that the battery lifespan follows a normal…

A brand of wireless headphones claims that the battery of its new "Pro-Z" model lasts, on average, $24$ hours. It is known that the battery lifespan follows a normal distribution with a standard deviation of $\sigma = 2,5$ hours. A group of technical testers analyzes $100$ headphones and finds a mean lifespan of $23,4$ hours.

  1. a) Carry out a one-tailed hypothesis test to check if the battery lasts less than promised with a significance level of $\alpha = 0,05$.
  2. b) Explain, in the context of the problem, what committing a Type II error would consist of.
  3. c) What should the minimum sample size be so that, with a mean of $23,4$, the result is significant at $1\%$?
μ₀ = 24 z = 0 23,59 z = −1.645 x̄ = 23.4 z = −2.4 Reject H₀ α = 0,05 Accept H₀ 1 - α = 0,95 n = 100 σ = 2,5 σ/√n = 0.25
Solve
Practice★★★Not started
In a debate on sustainability, it is claimed that $75\%$ of young people in a city separate plastic packaging from the rest of the trash. To verify this, a sample of…

In a debate on sustainability, it is claimed that $75\%$ of young people in a city separate plastic packaging from the rest of the trash. To verify this, a sample of $150$ young people is selected and it is observed that $105$ of them recycle correctly.

  1. a) Set up the hypothesis test to check if the true proportion is lower than claimed.
  2. b) Is the initial claim acceptable for a significance level of $10\%$?
  3. c) Suppose the true proportion were $65\%$. What decision would most likely be made with this test if the sample were only $20$ people? Reason about the importance of sample size on the power of the test.
Solve
Practice★★★Not started
A trade school claims that the mean starting salary of its graduates is $\$1550…

A trade school claims that the mean starting salary of its graduates is $\$1550$ per month. It is known that salaries follow a normal distribution with standard deviation $\$\sigma = 210$. A trade union selects a sample of $49$ graduates and obtains a mean salary of $\$1480$.

  1. a) Test the school's hypothesis against the union's suspicion that the salary is lower, using $\alpha = 0,01$.
  2. b) Calculate the probability of committing a Type I error if we decide to reject the null hypothesis for any sample mean lower than $\$1500$.
  3. c) How would an increase in the population standard deviation affect the acceptance region?
Solve

Back to the start: Tony's Pizza claims a mean of $30$ minutes ($H_0: \mu = 30$ against $H_a: \mu > 30$). With the known $\sigma = 8$ minutes, $n = 64$, and $\bar{x} = 32.5$, we get $z = \dfrac{32.5 - 30}{8/\sqrt{64}} = 2.5$ and a p-value of $P(Z \ge 2.5) \approx 0.0062$. Since $0.0062 < 0.05$ (and even $< 0.01$), Jayden has convincing evidence that the true mean delivery time is more than $30$ minutes.

Summary

See all the exercises in this section