Comparing Groups
via Simulation
Learn to use randomization and simulated distributions to determine whether a difference between two groups is statistically meaningful.
What Does It Mean to Compare Groups?
In statistics, we often collect data from two groups and want to know: is there a real difference between them, or could the difference we see be explained by random chance alone?
Key Terms You Need to Know
Why Use Simulation?
Traditional formulas (like the two-sample \(t\)-test) require assumptions about normality and equal variances. Simulation-based inference works even when those assumptions are shaky.
The Core Idea: Randomization Test
Under the null hypothesis \(H_0\): the group labels don't matter. If that's true, we can randomly reassign labels and recalculate the difference. Repeat this many times to build a null distribution.
Understanding the \(p\)-value
The \(p\)-value is the proportion of simulated differences that are at least as extreme as the observed difference. It answers: "How surprising is my result if there's truly no difference?"
Statistical vs. Practical Significance
| Statistical Significance | Practical Significance | |
|---|---|---|
| Question | Is the difference real (not just chance)? | Is the difference large enough to matter? |
| Measured by | \(p\)-value | Effect size, context |
| Example | \(p = 0.02\): unlikely due to chance | Difference of 0.3 points on a 100-point test |
| Verdict | Statistically significant | Practically meaningless |
Step-by-Step: Randomization Test
Example 1: Sleep Study
A researcher splits 20 students into two groups. Group A sleeps 8 hours; Group B sleeps 6 hours. Test scores are recorded. The observed difference in means is \(\bar{x}_A - \bar{x}_B = 5.2\) points.
Example 1: Running the Simulation
We pool all 20 scores, randomly split them into two groups of 10, and compute the difference. After 1000 reshufflings, we get a null distribution.
Example 2: Fertilizer Experiment
A farmer tests two fertilizers on 30 identical plots (15 per fertilizer). He measures crop yield in kg. The observed difference in mean yield is \(\bar{x}_A - \bar{x}_B = 1.4\) kg.
Example 2: Simulation Result
Example 3: Two-Sided Test
A teacher compares two class sections' quiz scores. Observed difference: \(\bar{x}_1 - \bar{x}_2 = -3.6\). In a two-sided test, we check both tails: differences \(\le -3.6\) or \(\ge 3.6\).
One-Sided vs. Two-Sided Tests
| One-Sided | Two-Sided | |
|---|---|---|
| \(H_a\) | \(\bar{x}_A > \bar{x}_B\) or \(\bar{x}_A < \bar{x}_B\) | \(\bar{x}_A \neq \bar{x}_B\) |
| Counts | One tail only | Both tails combined |
| Easier to reject? | Yes: smaller \(p\) | No: \(p\) is roughly doubled |
| When to use | You have a directional prediction before seeing data | You just want to know if groups differ |
Common Mistakes to Avoid
Summary: Decision Framework
| Scenario | \(p\)-value | Conclusion |
|---|---|---|
| Sleep study | \(0.018\) | Reject \(H_0\): meaningful |
| Fertilizer test | \(0.21\) | Fail to reject \(H_0\): no evidence |
| Quiz sections (two-sided) | \(0.034\) | Reject \(H_0\): meaningful |
Question 1 of 5
In a randomization test, what does the null hypothesis \(H_0\) assume?
Question 2 of 5
A simulation produces 1000 reshuffled differences. Of these, 42 are at least as extreme as the observed difference. What is the \(p\)-value?
Question 3 of 5
A researcher finds \(p = 0.12\). Using a significance level of \(\alpha = 0.05\), what should they conclude?
Question 4 of 5
Why is it important to use at least 1000 simulations rather than just 50?
Question 5 of 5
A study with 10,000 participants finds a difference of 0.2 points on a 100-point scale, with \(p = 0.001\). What is the best interpretation?