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. xx is each user's sessions in the week before the test, yy their sessions in the test's first week, and xc=x−xˉx_c = x - \bar{x}.

Userxxyyxcx_cθxc\theta x_cycvy_{cv}
C122-4-3.05.0
C244-2-1.55.5
C36500.05.0
C48721.55.5
T146-2-1.57.5
T26800.08.0
T38721.55.5
T410943.06.0
  1. Means. xˉ=48/8=6\bar{x} = 48/8 = 6 and yˉ=48/8=6\bar{y} = 48/8 = 6.
  2. θ. The distances of yy from 6 are -4, -2, -1, 1, 0, 2, 1, 3. Multiply each by xcx_c and add: Sxy=16+4+0+2+0+0+2+12=36S_{xy} = 16 + 4 + 0 + 2 + 0 + 0 + 2 + 12 = 36. The squares of xcx_c add up to Sxx=48S_{xx} = 48. So θ=36/48=0.75\theta = 36/48 = 0.75.
  3. Adjust. ycv=y−0.75 xcy_{cv} = y - 0.75\,x_c, the last column.
  4. Check. The ycvy_{cv} column still averages 6. Its squared distances from 6 add up to 9, against 36 for yy, so a quarter is left. The squared correlation is 362/(48×36)=0.7536^2/(48 \times 36) = 0.75, and 1−0.75=0.251 - 0.75 = 0.25. In the sample the identity is exact.

By arm: the head start takes 1.5 of the raw 3 sessions

xˉ\bar{x}yˉ\bar{y}yˉcv\bar{y}_{cv}
Control54.55.25
Treatment77.56.75
Difference23.01.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): θ=36/36=1.0\theta = 36/36 = 1.0. 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 36 (1+3×0.75)36\,(1 + 3 \times 0.75).
  • 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: θ=0.857\theta = 0.857, which is 8/78/7 times too big. On 8 users the n/(n−1)n/(n-1) factor is easy to see.

In the editor, write sums(y, x): the worked example's three sums, which give θ and r².