Course 6.3Lesson 2 of 3
A teacher tries a new revision method on one group and the old method on another. The new group scores higher. A shuffling test asks how often a random split of the same scores gives a difference as large. This lesson runs the test by simulation and by counting every split.
Try the code and the simulations beside the lesson.
A teacher wants to know whether a new way of revising helps. She takes students and splits them at random into two groups of . One group uses the new method, the other the old one. Then all take the same quiz, marked out of . These are made-up scores.
The new group's mean is marks higher. Is that the method, or just the luck of which students landed in which group?
Take the null idea: the method makes no difference. Then each student would have scored the same in either group. The labels "new" and "old" would be like name tags handed out at random.
So we can imitate the null idea. Pool the scores, shuffle them, and deal them into two new groups of . Work out the difference in means. Do it thousands of times. This builds the pattern of differences that luck alone makes. If the real difference of marks is rare in that pattern, luck is a poor explanation.
This test is called a shuffling test, or a randomisation test. It works because the groups were formed at random in the first place.
The program shuffles the scores times and counts the shuffles with a difference of marks or more.
There are ways to split the scores into two groups of . A computer can try every one. Exactly of them give a difference of marks or more. So the exact p-value is . The simulation's was close.
The picture shows all differences. They pile up in a mound centred at zero, because a random split usually mixes the scores evenly. The real difference sits far out in the right tail.
The smooth curve is only a picture of the mound, so its p-value, about , is close to the exact but not equal to it.
The p-value is small, so luck alone is a poor explanation. Because the teacher assigned the students at random, the most likely cause of the difference is the method itself. You met random assignment in the chapter on study design.
Two cautions remain. The study used only students, so the size of the effect is uncertain. And the students all came from one class, so the result may not hold for other students.
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
Every lesson is open to read. Enrolling also lets you:
Log in to join the discussion.
Loading…
This lesson is free to read. Enroll free to keep your place and take the tests.