Introduction to Hypothesis Testing

Welcome to one of the most powerful chapters in statistics! In previous chapters, you learned how to describe data (like finding the mean) and how to calculate the probability of events. Now, we combine those skills to answer a massive question: Is this result just a coincidence, or is something actually happening?

Hypothesis testing is like a legal trial for data. We start by assuming "nothing special is going on" and only change our minds if the evidence is overwhelming. Whether you are at Standard Level (SL) or Higher Level (HL), mastering this logic is key to success in your IB exams and your Internal Assessment (IA).

1. The Logic of the Test

Before we look at specific tests, we need to understand the "language" of testing.

The Hypotheses

  • Null Hypothesis \(H_0\): The "status quo." It assumes there is no effect, no difference, or no relationship. (Think: "Everything is normal.")
  • Alternative Hypothesis \(H_1\): What we are trying to prove. It suggests there is a change, a difference, or a relationship.

Significance Levels and P-values

In the IB, you will usually be given a significance level (\(\alpha\)), such as \(5\%\) or \(0.05\). This is our "threshold" for doubt.

  • p-value: The probability that we would get our results by pure luck if \(H_0\) were true.
  • The Golden Rule:
    • If \(p < \alpha\): The result is very unlikely to be luck. Reject \(H_0\).
    • If \(p \geq \alpha\): The result could easily be luck. Fail to reject \(H_0\).

Analogy: Imagine a friend claims they can tell the difference between expensive bottled water and tap water. If they get it right once, it might be luck. If they get it right 20 times in a row, the "luck" probability (p-value) is so tiny that you "Reject" the idea that they are just guessing.

2. Chi-Squared (\(\chi^2\)) Tests (SL & HL)

Chi-squared tests are used for categorical data (data you can put into groups, like "Eye Color" or "Favorite Sport").

A. Test for Independence

This asks: "Are these two variables related?" For example, is your favorite subject independent of your gender?

  • Contingency Tables: Data is presented in a grid.
  • Degrees of Freedom (\(df\)): Calculated as \((rows - 1) \times (columns - 1)\).
  • Expected Frequency: The GDC calculates this, but the logic is \(\frac{\text{Row Total} \times \text{Column Total}}{\text{Grand Total}}\).

B. Goodness of Fit Test

This asks: "Does my data fit a specific pattern or distribution?" (e.g., Does a six-sided die actually land on each number \(\frac{1}{6}\) of the time?).

  • Degrees of Freedom: Usually \(n - 1\), where \(n\) is the number of categories.
  • HL Only Tip: If you have to estimate parameters (like the mean) from the data to run the test, the degrees of freedom decrease further.

Quick Review: For all \(\chi^2\) tests, the IB requires you to use your GDC. You will enter the Observed Frequencies into a matrix or list, and the calculator will give you the \(\chi^2\) statistic and the p-value.

3. The t-test (SL & HL)

We use a t-test when we want to compare the means of two different groups to see if they are significantly different.

One-Tailed vs. Two-Tailed

  • Two-Tailed: You just want to know if they are different. (\(H_1: \mu_1 \neq \mu_2\))
  • One-Tailed: You have a specific prediction that one is greater than or less than the other. (\(H_1: \mu_1 > \mu_2\))

Common Mistake: Don't forget to check if the question assumes "Equal Variances" (Pooled) or not. In many IB AI questions, we assume variances are not equal unless stated otherwise.

Key Takeaway: Always state your hypotheses clearly using the symbols \(\mu_1\) and \(\mu_2\) for t-tests!


4. Further Distributions: The Poisson Distribution (HL Only)

The Poisson distribution models the number of times an event occurs in a fixed interval of time or space. Examples: How many emails do you get per hour? How many chocolate chips are in a cookie?

Key Properties

  • The events must occur independently and at a constant average rate.
  • The parameter is \(\lambda\) (lambda), which is the average (mean).
  • Special Fact: In a Poisson distribution, the Mean = Variance. So, \(E(X) = \text{Var}(X) = \lambda\).
  • Summing Poissons: If \(X\) and \(Y\) are independent Poisson variables, their sum \(X + Y\) is also Poisson with mean \(\lambda_X + \lambda_Y\).

GDC Tip: Use PoissonPdf for the probability of an exact number (e.g., exactly 5 emails) and PoissonCdf for a range (e.g., 5 or fewer emails).


5. Advanced Hypothesis Testing (HL Only)

HL students need to apply hypothesis testing to several other scenarios.

A. Testing a Population Mean (\(\mu\))

Testing if a single group's mean is different from a known value. This can be done for Normal or Poisson distributions.

B. Testing a Proportion (\(p\))

Used for Binomial data (Yes/No outcomes). For example: "Is the proportion of defective lightbulbs really \(3\%\)?"

C. Testing Correlation (\(\rho\))

We test if the population correlation coefficient (\(\rho\)) is zero.

  • \(H_0: \rho = 0\) (No linear correlation)
  • \(H_1: \rho \neq 0\) (There is a correlation)

D. Critical Values and Regions

Instead of just using p-values, we can find a Critical Value. If our test statistic falls in the Critical Region (the "rejection zone"), we reject \(H_0\).

E. Type I and Type II Errors

Statisticians aren't perfect! We can make two types of mistakes:

  1. Type I Error: You reject \(H_0\) when it was actually true. (A "False Alarm").
    The probability of a Type I error is exactly \(\alpha\) (the significance level).
  2. Type II Error: You fail to reject \(H_0\) when it was actually false. (A "Missed Detection").

Mnemonic:
Type I is "I thought there was an effect (but there wasn't)."
Type II is "II (Too) blind to see the effect."


Summary Checklist for Success

  • Identify the test: Are you comparing categories (\(\chi^2\)), means (t-test), or checking a rate (Poisson)?
  • Write \(H_0\) and \(H_1\): Always write these down first!
  • Set \(\alpha\): Usually \(0.05\) or \(0.10\).
  • Use your GDC: Enter data carefully. Most marks come from the correct p-value and the conclusion.
  • Conclusion: Write it in context. Instead of just "Reject \(H_0\)", say "There is sufficient evidence to suggest that the new medicine is more effective."

Don't worry if this seems tricky at first! Hypothesis testing is a process. Once you learn the steps for your calculator, the logic starts to feel like second nature.