14/25
Part 4 of 5 · The worked exampleLearn and do
A worked example
Eight users: θ = 0.75, and a quarter of the variance left
Eight users: C1 to C4 in control and T1 to T4 in treatment. is each user's sessions in the week before the test, their sessions in the test's first week, and .
| User | |||||
|---|---|---|---|---|---|
| C1 | 2 | 2 | -4 | -3.0 | 5.0 |
| C2 | 4 | 4 | -2 | -1.5 | 5.5 |
| C3 | 6 | 5 | 0 | 0.0 | 5.0 |
| C4 | 8 | 7 | 2 | 1.5 | 5.5 |
| T1 | 4 | 6 | -2 | -1.5 | 7.5 |
| T2 | 6 | 8 | 0 | 0.0 | 8.0 |
| T3 | 8 | 7 | 2 | 1.5 | 5.5 |
| T4 | 10 | 9 | 4 | 3.0 | 6.0 |
- Means. and .
- θ. The distances of from 6 are -4, -2, -1, 1, 0, 2, 1, 3. Multiply each by and add: . The squares of add up to . So .
- Adjust. , the last column.
- Check. The column still averages 6. Its squared distances from 6 add up to 9, against 36 for , so a quarter is left. The squared correlation is , and . In the sample the identity is exact.
By arm: the head start takes 1.5 of the raw 3 sessions
| Control | 5 | 4.5 | 5.25 |
| Treatment | 7 | 7.5 | 6.75 |
| Difference | 2 | 3.0 | 1.5 |
This is the head start from the chapter on the unbiased estimate, worth 1.5 of the raw 3 sessions. Eight users are far too few for a real test. The point here is the arithmetic.
Each bug shows up in these eight users
Run the broken versions on the same eight users:
- Dividing by var(y): . The difference comes out 1.0, and 12 of the 36 is left instead of 9.
- Flipped sign: the difference comes out 4.5, the head start added instead of removed. The squares add up to 117, which is .
- No centering: the difference stays 1.5, but the arm means become 0.75 and 2.25, a lift of +200% where the centered means give +28.6%.
- Mixed ddof: , which is times too big. On 8 users the factor is easy to see.
In the editor, write sums(y, x): the worked example's three sums, which give θ and r².