Hypothesis Testing
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$).
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" → $>$.
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:
- a) Clearly define the null hypothesis ($H_0$) and the alternative hypothesis ($H_1$).
- b) State whether it is a one-tailed or two-tailed test.
Type I and Type II Errors
A test uses a sample, so it can be wrong even when we do everything correctly.
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.
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).
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?
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$.
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.
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?
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.
- a) Define the appropriate hypothesis test for the counselor's belief.
- b) Calculate the p-value of the sample obtained.
- c) If a significance level of $1\%$ is used, what conclusion should the counselor draw? What if the significance level were $5\%$?
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}$.
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:
- a) Set up the hypotheses $H_0$ and $H_1$.
- b) If we set a significance level of $\alpha = 0,05$, calculate the critical values $z_{\alpha/2}$ that delimit the acceptance zone.
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$.
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?
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.
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.
- a) Calculate the test statistic (sample proportion) $\hat{p}$.
- 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.
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.
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.
- a) Formulate the hypotheses for a right-tailed test.
- b) Calculate the value of the test statistic.
- 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.
Tests and Confidence Intervals
A confidence interval and a two-tailed test are two views of the same information.
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.
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.
- a) Carry out a one-tailed hypothesis test for a significance level of $\alpha = 0,05$.
- 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.
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$.
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.
- 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$.
- b) Explain, in the context of the problem, what committing a Type II error would consist of.
- c) What should the minimum sample size be so that, with a mean of $23,4$, the result is significant at $1\%$?
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.
- a) Set up the hypothesis test to check if the true proportion is lower than claimed.
- b) Is the initial claim acceptable for a significance level of $10\%$?
- 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.
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$.
- a) Test the school's hypothesis against the union's suspicion that the salary is lower, using $\alpha = 0,01$.
- 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$.
- c) How would an increase in the population standard deviation affect the acceptance region?
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.