Cambridge 9709 · Mathematics (9709) A2 · Chapter 32 · S2 - Hypothesis Tests

S2 - Hypothesis Tests

Summarized revision notes, free to read. Sit the matching past papers in any Paperverse world when you are done.

The Procedure for Hypothesis Testing6.5

Alright, let's break down hypothesis testing. Think of it as being a detective for data. You have a claim (like a game dev saying a patch doesn't increase lag), and you want to see if there's enough evidence to call them out.<br><br>First up, we have our two competing theories, the hypotheses:<br>1. The Null Hypothesis ($H_0$): This is the boring, 'status quo' or 'no change' idea. It's the default assumption. For the game patch, $H_0$ would be: The lag has not changed. It's what we assume is true until proven otherwise.<br>2. The Alternative Hypothesis ($H_1$): This is the spicy new theory you're investigating. It's what you suspect might be true instead. It could be that the lag has increased (a one-tailed test), or that it has simply changed (increased or decreased, a two-tailed test).<br><br>Next, we set the Significance Level ($\alpha$). This is basically your 'doubt threshold'. It's usually small, like 5% (0.05) or 1% (0.01). If you set $\alpha = 0.05$, you're saying: 'I'm only going to reject the null hypothesis if the result I see is so weird it would only happen by chance less than 5% of the time.' It’s the risk you're willing to take of making the wrong call.<br><br>Now, we collect our data (play some games) and calculate the Test Statistic. This is a single number that summarizes our sample evidence. It's the key piece of data we'll use to make our decision.<br><br>So, how do we decide? We use the significance level to find the Critical Region (or Rejection Region). This is the 'danger zone' of extreme values. If our test statistic falls into this region, it's considered strong evidence against $H_0$. A bell curve diagram showing the tails shaded in. For a one-tailed test, one tail is shaded. For a two-tailed test, both tails are shaded. The shaded area is labelled 'Critical Region' and its size is labelled 'Significance Level, '. If your test statistic lands in the shaded area, you've got drama! You reject $H_0$. If it lands in the main, unshaded part, you don't have enough evidence, so you do not reject $H_0$. Notice we never say 'accept' $H_0$ – we just say we lack the evidence to throw it out. It’s like a jury saying 'not guilty' instead of 'innocent'.

Worked Example: Hypothesis Test for a Binomial Proportion6.5

Problem A marketing agency claims that a new TikTok ad format will have a click-through rate of 25%. The client thinks this is an overestimate. To test the claim, the ad is shown to 40 randomly selected users, and only 5 of them click on it. Test the agency's claim at the 5% significance level.

Step 1 First, we define our hypotheses. The null hypothesis ($H_0$) is the agency's claim. The alternative hypothesis ($H_1$) is the client's suspicion that the rate is lower. Let $p$ be the true click-through rate. $$H_0: p = 0.25$$ $$H_1: p < 0.25$$ $$ \text{Significance Level, } \alpha = 0.05$$

Step 2 We are counting the number of 'successes' (clicks) in a fixed number of trials (users), so this fits a binomial distribution. Our test statistic, $X$, is the number of clicks from 40 users. $$X \sim B(40, 0.25)$$

Step 3 Now we find the critical region. Since $H_1$ is $p < 0.25$, this is a one-tailed test. We're looking for an unusually low number of clicks. We need to find the critical value $c$ such that the probability of getting $c$ or fewer clicks is less than our 5% significance level. $$P(X \le c) < 0.05$$ $$ \text{From tables: } P(X \le 5) = 0.0470$$ $$ \text{and } P(X \le 6) = 0.1117$$ $$ \text{Since } 0.0470 < 0.05\text{, the critical region is } X \le 5.$$

Step 4 We compare our observed result (the test statistic) from the sample to the critical region we just found. $$\text{Observed value from the sample} = 5$$

Step 5 Our observed value of 5 falls inside the critical region ($X \le 5$). This means our result is statistically significant and gives us enough evidence to reject the null hypothesis. $$\text{Since } 5 \le 5\text{, the result is in the critical region. We reject } H_0.$$

Step 6 Finally, we state our conclusion in the context of the original problem about the TikTok ad. There is sufficient evidence at the 5% significance level to reject the agency's claim and conclude that the click-through rate is lower than 25%.

Hypothesis Tests for a Population Mean with Known Variance6.5

Alright, let's get into it. Imagine a company like Spotify claims the average listening time for a premium user is 3 hours a day. You and your friends think it's way higher. How do you test that claim? This is where the Z-test for a population mean comes in, and it's our first major tool for hypothesis testing.<br><br>The key condition here is that we know the population variance, $\sigma^2$ (or the standard deviation, $\sigma$). This is a bit of a perfect-world scenario, like a game dev knowing the exact variance in player reaction times from millions of data points. When we know $\sigma^2$ AND the original population is normally distributed, the sample mean, $\bar{X}$, will also be perfectly normally distributed. Its distribution is $\bar{X} \sim N(\mu, \frac{\sigma^2}{n})$.<br><br>But what if the original population isn't normal? Maybe it's skewed. This is where a super-important idea called the Central Limit Theorem (CLT) saves the day. The CLT says that if your sample size ($n$) is large enough (a good rule of thumb is $n > 30$), the distribution of the sample means ($\{\bar{X}\}$) will be approximately normal, no matter what the original population looked like! This is clutch because it means we can still use the Normal distribution for our test. It’s like taking a screenshot of a chaotic Snapchat story; if you take enough screenshots over time, the average 'vibe' starts to look pretty predictable.<br><br>To actually run the test, we calculate a test statistic. For this scenario, it's the Z-statistic. The formula is your new best friend:<br>$$Z = \frac{\bar{X} - \mu}{\frac{\sigma}{\sqrt{n}}}$$<br>Let's break it down: $\bar{X}$ is the mean from your sample (the evidence you collected). $\mu$ is the mean from the null hypothesis $H_0$ (the original claim you're testing). The denominator, $\frac{\sigma}{\sqrt{n}}$, is the standard error, which measures the typical variation we'd expect between sample means. Essentially, the Z-score tells us how many standard errors our sample mean is away from the claimed population mean. A big Z-score (either positive or negative) suggests our sample result is pretty unusual if the original claim is true, which might lead us to reject it. A diagram of the standard normal curve, showing the central region (e.g., 95%) and the two shaded 'critical regions' or 'rejection regions' in the tails where the test statistic would need to fall to reject the null hypothesis.

Worked Example: Z-Test for a Population Mean6.5

Problem A phone manufacturer claims their new model has an average battery life of $\mu = 20$ hours for continuous video playback. The battery life is known to be normally distributed with a standard deviation of $\sigma = 1.5$ hours. A tech reviewer tests a random sample of $n=10$ phones and finds their average battery life is $\bar{x} = 21.1$ hours. Test, at the 5% significance level, whether the average battery life is greater than the manufacturer's claim.

Step 1 First, we set up our null ($H_0$) and alternative ($H_1$) hypotheses. $H_0$ is the original claim (the 'status quo'). $H_1$ is what the reviewer suspects. Since they're testing if the battery life is greater than the claim, it's a one-tailed test. $$H_0: \mu = 20$$ $$H_1: \mu > 20$$

Step 2 Next, we find the critical value for our significance level. We have a 5% significance level ($\alpha = 0.05$) and a one-tailed test. We need to find the Z-score that marks the top 5% of the normal distribution. Using tables or a calculator's inverse normal function (invNorm(0.95)), we find this value. $$\text{Significance Level, } \alpha = 0.05$$ $$\text{Critical Value, } z_{crit} = 1.645$$

Step 3 Now it's time to calculate our test statistic using the Z-formula. We plug in our sample mean ($\bar{x}$), the claimed population mean ($\mu$), the population standard deviation ($\sigma$), and the sample size ($n$). $$Z_{calc} = \frac{\bar{x} - \mu}{\frac{\sigma}{\sqrt{n}}} = \frac{21.1 - 20}{\frac{1.5}{\sqrt{10}}} \approx 2.319$$

Step 4 Let's make a decision. We compare our calculated Z-statistic to our critical value. We can see that $2.319 > 1.645$. This means our result falls into the rejection region. $$\text{Since } 2.319 > 1.645, \text{ we reject } H_0.$$

Step 5 Finally, we write a conclusion in the context of the problem. Don't just say 'reject H0'. What does it actually mean for the phones? It means we found enough evidence to support the reviewer's suspicion. $$\text{There is sufficient evidence at the 5\% significance level to suggest that the mean battery life of the phone is greater than 20 hours.}$$

Type I and Type II Errors6.5

Okay, so you've run your hypothesis test, you've got your p-value, and you've made a conclusion. But what if... you're wrong? 😱 It happens! Hypothesis testing is all about probability, not certainty. Think of it like a court case. The null hypothesis, $H_0$, is 'the defendant is innocent'. We only reject this if we have strong evidence they're guilty. A Type I Error is like convicting an innocent person. It's when we reject a null hypothesis that was actually TRUE. We found a statistically significant result, but it was just a fluke, a one-in-a-million chance (or, more likely, a one-in-twenty chance!). The probability of making a Type I error is literally the significance level of the test, which we call $\alpha$. So if you set your significance level to 5% ($\alpha = 0.05$), you're accepting there's a 5% chance you'll make this kind of mistake. It's the risk you're willing to take.<br><br>Then there's the Type II Error. This is the opposite: it's like letting a guilty person walk free. It's when we fail to reject a null hypothesis that is actually FALSE. Our test wasn't sensitive enough to pick up on the change. Maybe your friend did get better at that video game, but their scores in your sample weren't quite good enough to prove it. The probability of this error is called $\beta$. Calculating $\beta$ is a bit different because you need to know the true value of the parameter to see how often you'd miss it. For example, 'If the true mean is actually 105, what's the probability our test fails to notice it's not 100?'.<br><br>A 2x2 grid showing the relationship between the reality of H₀ (True/False) and the test decision (Reject/Do Not Reject). The four cells are labelled: Correct Decision, Type I Error (α), Type II Error (β), and Correct Decision (Power).<br><br>Finally, let's talk about the Power of a test. This is the cool one. Power is the probability that you correctly reject a false null hypothesis. It's the test's ability to detect an effect when there really is one. Think of it as your test's 'rizz' – its ability to successfully spot the truth. The Power is calculated as $1 - \beta$. A powerful test has a low chance of making a Type II error. You want a test with high power, just like you want a phone with a good signal!

Worked Example: Calculating Error Probabilities in a Binomial Test6.5

Problem A gamer claims her success rate in a specific level is 20%. Her friend suspects the rate is actually higher. To test this, the friend observes 20 games. The test is conducted at the 5% significance level. The critical region is found to be $X \ge 8$, where $X$ is the number of successes.<br>a) Calculate the actual significance level (the probability of a Type I error).<br>b) Find the probability of a Type II error if the gamer's true success rate is actually 40%.

Step 1 First, let's define our hypotheses and the distribution. The null hypothesis ($H_0$) is the gamer's claim, and the alternative ($H_1$) is the friend's suspicion. Under $H_0$, the number of successes $X$ follows a Binomial distribution with $n=20$ and $p=0.2$. $$ H_0: p = 0.2 \\ H_1: p > 0.2 \\ X \sim B(20, 0.2) $$

Step 2 For part (a), we need to find the probability of a Type I error. This is the probability of rejecting $H_0$ when it's true. We reject $H_0$ if our result falls in the critical region ($X \ge 8$). So, we calculate this probability using the distribution from $H_0$ (where $p=0.2$). This is also called the actual significance level. $$ P(\text{Type I Error}) = P(X \ge 8 | p=0.2) \\ = 1 - P(X \le 7 | p=0.2) \\ = 1 - 0.9679 \\ = 0.0321 $$

Step 3 For part (b), we calculate the probability of a Type II error. This is when we fail to reject $H_0$ when it's actually false. We fail to reject if we are in the 'acceptance region', which is the opposite of the critical region ($X \le 7$). The question tells us to assume the true probability of success is now $p=0.4$. So, we must recalculate our probability using this new value for $p$. $$ \text{Acceptance Region is } X \le 7 \\ \text{New distribution is } X \sim B(20, 0.4) $$

Step 4 Now we find the probability of landing in the acceptance region ($X \le 7$) using the new, true distribution where $p=0.4$. This probability is $\beta$. $$ P(\text{Type II Error}) = P(X \le 7 | p=0.4) \\ = 0.4159 $$

Step 5 Bonus round! Let's find the power of this test (for the alternative $p=0.4$). The power is the probability of correctly rejecting the false $H_0$. It's simply $1 - \beta$. $$ \text{Power} = 1 - P(\text{Type II Error}) \\ = 1 - 0.4159 \\ = 0.5841 $$

Hypothesis Tests for Binomial and Poisson Distributions6.5

Alright, let's dive into hypothesis tests for Binomial and Poisson distributions. Think of it like this: a game developer claims a rare item has a 10% drop rate ($p=0.1$). You grind for hours, defeat 50 enemies ($n=50$), and get the item only twice. Is the drop rate claim legit, or did they nerf it? That's what we're testing! <br><br> We have two main ways to tackle these problems: direct evaluation or using a Normal approximation. <br><br> Direct Evaluation: This is our go-to when the numbers are pretty small (for Binomial, if $np$ or $nq$ is less than 5; for Poisson, if $\lambda$ is less than 15). We calculate the probability of getting our observed result, or something even more extreme. This is the p-value. If this probability is super tiny (smaller than our significance level, $\alpha$, usually 5%), it's like getting a mythic weapon on your first try – so unlikely that we suspect the original claim ($H_0$) is wrong. <br><br> We can also think in terms of a Critical Region. This is the 'rejection zone' of outcomes. For discrete data, it’s a bit quirky. We can't land exactly on a 5% probability. We find the first value where the cumulative probability dips below our significance level. A bar chart of a Binomial distribution with the bars in the right tail (the critical region) shaded in red, showing the area where P(X >= k) < 0.05. Any result in this zone means we reject $H_0$. <br><br> Normal Approximation: When the numbers get big, calculating exact probabilities is a nightmare. So, we 'cheat' and use the Normal distribution. It's like using a high-res texture pack to smooth out a blocky game world. The one HUGE thing to remember is the continuity correction. Since we're using a continuous model for discrete data, we have to adjust by 0.5. So $P(X \le 10)$ becomes $P(Y < 10.5)$ in our Normal model. Forgetting this is the number one way to lose marks! 😬

Worked Example: Hypothesis Test for a Binomial Proportion6.5

Problem A student working at a café is told that the probability of a customer ordering the new 'Cosmic Frappé' is 0.1. After promoting it heavily for a week, they believe the probability has increased. In the next 40 customers, 7 order the drink. Test, at the 5% significance level, whether there is evidence that the promotion was effective.

Step 1 First, we set up our null hypothesis ($H_0$), which is the 'no change' scenario, and our alternative hypothesis ($H_1$), which is what we're trying to prove. We'll define our random variable $X$ and its distribution assuming $H_0$ is true. Since we have a fixed number of trials (40 customers) and a constant probability of success, this is a Binomial distribution. $$H_0: p = 0.1 <br> H_1: p > 0.1 <br> \text{Let } X = \text{number of customers who order the drink.} <br> \text{Under } H_0, X \sim B(40, 0.1)$$

Step 2 Before we dive in, we should check if we can use a Normal approximation. We calculate $np$. If it's less than 5, we must use the exact Binomial distribution. $$np = 40 \times 0.1 = 4 <br> \text{Since } np < 5, \text{ a Normal approximation is not suitable. We must use direct evaluation.}$$

Step 3 We observed 7 successes. Since our alternative hypothesis is $p > 0.1$, this is an upper one-tailed test. We need to find the probability of getting our result (7) or something even more extreme (more than 7). So, we calculate $P(X \ge 7)$. It's easier to calculate this using the complement: $1 - P(X \le 6)$. $$P(X \ge 7) = 1 - P(X \le 6) <br> \text{Using a calculator for } X \sim B(40, 0.1): <br> P(X \le 6) = 0.8884... <br> P(X \ge 7) = 1 - 0.8884 = 0.1116$$

Step 4 Now we compare our calculated p-value with the significance level, $\alpha$, which was given as 5% or 0.05. If the p-value is less than $\alpha$, we reject $H_0$. If it's greater, we don't. $$0.1116 > 0.05$$

Step 5 Our p-value is greater than the significance level. This means our result is not 'surprising' enough to reject the null hypothesis. We conclude by stating what this means in the context of the café problem. $$\text{Since the p-value (0.1116) is greater than the 5\% significance level (0.05), we do not reject } H_0. <br> \text{There is insufficient evidence to suggest that the promotion was effective in increasing the probability of customers ordering the new drink.}$$

Revise this chapter in any of the ten Paperverse worlds