Sub topic 15
Testing Whether a Change Raised Completion
This chapter assumes you can read a funnel and a completion rate, as covered in earlier chapters. You should also be comfortable with percentages and with running short Python scripts. It does not require formal statistics training. The goal is to decide, with evidence, whether a course change raised completion or whether the difference you saw is noise.
Why before-and-after comparisons mislead
A common habit is to ship a change and compare this month's completion rate with last month's. That comparison is weak, because many things change between the two months:
- The mix of learners shifts. A promotion may bring in casual browsers who rarely finish.
- Seasons matter. Completion often drops around holidays and rises in January.
- Cohorts differ. Learners who found you through a friend behave differently from learners who found you through an ad.
- Other changes ship at the same time, such as a new email or a price change.
A controlled experiment (often called an A/B test) removes most of these problems. You split incoming learners at random into two groups. Group A gets the current course (the control). Group B gets the changed version (the variant). Both groups run at the same time, so seasons, promotions, and traffic sources affect them equally. Any remaining gap is more likely to come from your change.
Designing the test
Settle these decisions before you start. Making them after you see the data invites wishful reading.
- State one hypothesis. For example: "Adding a five-minute practice task to Lesson 1 raises the share of learners who finish the course."
- Pick one primary metric. Use the completion definition you chose earlier in this tutorial. If you track many metrics and report whichever looks best, some will look good by chance.
- Choose the unit of randomization. Randomize by learner, not by lesson view or session. A learner who sees both versions contaminates the result.
- Assign at enrollment. Count only learners who enrolled after the test started, and keep each learner in their assigned group for the whole test.
- Decide the sample size and duration in advance. Self-paced courses need enough time for learners to finish. If a typical learner needs four weeks, a one-week test measures almost nothing about completion.
- Change one thing. If the variant has a new onboarding, shorter lessons, and a reminder email, you cannot tell which part worked.
The flow below shows the life of a test.
Comparing two completion rates
Suppose 600 learners saw the control and 180 finished, which is 30%. Another 600 saw the variant and 222 finished, which is 37%. The gap is seven percentage points. The question is whether a gap that size could appear by luck when the two versions are actually equal.
The two-proportion z statistic answers that. It divides the observed gap by an estimate of how much the gap would typically wobble from chance alone. This estimate is called the standard error. A large z means the gap is big compared with the expected wobble.
import math
def two_proportion_z(completed_a, total_a, completed_b, total_b):
p_a = completed_a / total_a
p_b = completed_b / total_b
pooled = (completed_a + completed_b) / (total_a + total_b)
se = math.sqrt(pooled * (1 - pooled) * (1 / total_a + 1 / total_b))
return (p_b - p_a) / se
z = two_proportion_z(180, 600, 222, 600)
print(round(z, 2))The function does the following:
- It computes each group's completion rate.
- It computes a pooled rate, which is the overall completion rate if you ignore the groups. This represents the "no real difference" assumption.
- It uses the pooled rate to compute the standard error.
- It returns the gap divided by the standard error.
For these numbers the result is about 2.5. A common rule is that a magnitude above about 1.96 suggests a difference at the 5% level. That means that if the two versions were truly identical, a gap this large would show up by chance roughly 1 time in 20 or less. Here, 2.5 clears that bar.
What the number does and does not say
- A significant result does not say the effect is large. With thousands of learners, a one-point gain can be significant yet worth little.
- A non-significant result does not prove the change did nothing. It may mean the test was too small to detect a modest real gain.
- The 5% level is a convention, not a law. Choose a stricter threshold when the change is expensive or hard to reverse.
Report the gap itself next to the z value: "37% versus 30%, a difference of 7 points." Decision makers need the size of the effect, not only whether it passed a threshold.
Sample size: how many learners you need
Small samples produce unstable rates. As a rough guide, the standard error shrinks with the square root of the sample size, so halving your uncertainty needs about four times as many learners.
Detecting small gains is expensive. The table gives rough numbers for a baseline completion rate near 30%, using a 5% significance level and 80% power. Power is the chance that the test detects a real effect of that size.
| Real gain you want to detect | Approx. learners per group |
|---|---|
| 10 points (30% to 40%) | about 350 |
| 5 points (30% to 35%) | about 1,400 |
| 2 points (30% to 32%) | about 8,500 |
If your course enrolls 100 learners a month, you can only test large changes. Pick bold interventions, or accept slower learning, rather than running many tiny tests that cannot tell you anything.
Common errors
Peeking and stopping early. Checking the z value daily and stopping as soon as it passes 1.96 inflates false positives well above 5%. Fix the sample size first and look once at the end. If you must monitor, use a method designed for sequential testing.
Counting the wrong learners. If you include learners who enrolled before the test, they carry old behavior into your result. Count only learners assigned during the test.
Dropping learners who never started. Learners who enroll and never open a lesson are part of the completion rate. Removing them from one group but not the other biases the comparison. Include everyone assigned.
Unbalanced groups. If the split is meant to be 50/50 but you see 600 against 540, something in your assignment is broken. Investigate before reading any result.
Testing many variants. If you compare ten variants against the control, one will likely pass at the 5% level by chance. Use a stricter threshold or confirm the winner in a second test.
Ignoring segments you planned to ignore. Earlier chapters showed that learners differ in intent. A variant may help career-driven learners and do nothing for browsers. Look at segments only if you planned to, and treat surprising segment findings as ideas for a new test, not as proof.
Checking guardrails
Completion is not the only outcome that matters. A change can raise completion by making the course easier or by pressuring learners. Track a few guardrail metrics alongside the primary one:
- Quiz or assessment scores, to confirm learners still learn the material.
- Learner satisfaction ratings.
- Unsubscribes or complaints, if the change involves messages.
- Refund requests.
If completion rises while scores and satisfaction fall, the change has probably traded learning for a better number. That connects to the ethical limits covered later in this tutorial.
Using your data to choose what to test
Your funnel and at-risk lists tell you where to test. For example, the following query lists learners in one course who have not finished and have been inactive for more than seven days. It is a natural population for testing a reminder message.
SELECT learner_id, last_active_at
FROM enrollments
WHERE course_id = 42
AND completed_at IS NULL
AND last_active_at < CURRENT_DATE - INTERVAL '7 days'
ORDER BY last_active_at;To test a reminder, randomly split this list in two. Send the message to one half and nothing to the other. Then compare the share who return and finish within a set window. Randomizing within the list matters, because the learners on it are already similar in being inactive. Comparing them to active learners would tell you nothing about the message.
A practical checklist
- Write the hypothesis and the primary metric.
- Randomize by learner at enrollment.
- Compute the sample size you need for the smallest gain worth acting on.
- Run for the full planned time, long enough for learners to finish.
- Check group sizes for balance.
- Compute the z statistic once, and report the gap in percentage points.
- Review guardrail metrics.
- Decide, and record what you learned even when the variant lost.
Exercise
A course creator ships a new onboarding video and sees completion rise from 28% in March to 34% in April. They conclude the video worked. Give two reasons this conclusion is weak, and describe a better design.
Show answer
First, the comparison is before and after, so anything else that changed between March and April could explain the rise, such as seasonality, a different traffic source, or another course update. Second, the two months contain different learners, and the April group may simply be more motivated. A better design randomly assigns each new enrollee to the old or new onboarding at the same time, runs both long enough for learners to finish, and compares completion rates with a statistic such as the two-proportion z, reporting the gap in points.
Exercise
Using the function in this chapter, a test shows 90 of 400 learners completing in the control and 110 of 400 in the variant. Without running code, is the z value likely above 1.96? Explain, then state what you would want to know before shipping.
Show answer
The rates are 22.5% and 27.5%, a gap of 5 points. The pooled rate is 200/800 = 25%, so the standard error is the square root of 0.25 × 0.75 × (1/400 + 1/400), which is about 0.0306. The z value is 0.05 / 0.0306, about 1.63, which is below 1.96. The gap is not clear enough at the 5% level, and the test may be too small, since detecting a 5-point gain needs roughly 1,400 learners per group. Before shipping, you would want a larger test or a longer run, and you would check guardrail metrics such as assessment scores.