When every participant receives both treatments in random order, the number you need depends on the within-subject SD, not the total SD. Get n per sequence for an AB/BA trial with a continuous outcome, see how it compares with a parallel design, and note where carry-over can break it.
Free sandbox · No credit card · 21 CFR Part 11 aligned
| Assessment | Screening | Period 1 | Washout | Period 2 | End of study |
|---|---|---|---|---|---|
| Sequence AB (n = 22) | A | W | B | ||
| Sequence BA (n = 22) | B | W | A |
A and B are the two treatments; W is the washout between periods.
What this page calculates
The calculation
In an AB/BA design, participants are randomised to receive treatment A then B, or B then A, with a washout in between. For each participant you form the difference between their two measurements, A minus B. If σw is the within-subject SD, the variance of one participant’s difference is 2σw². The treatment effect is estimated by half the difference between the mean differences in the two sequences, which removes the period effect, and with n participants in each sequence its variance is σw²/n. Setting the usual power condition gives n per sequence = σw² (z₁₋α/2 + z₁₋β)² / δ² and a total of 2n. For two-sided alpha 0.05 and 80% power the two z values are 1.960 and 0.842, their sum squared is 7.85, so n = 7.85 σw² / δ² per sequence (Chow, Shao and Wang; Julious).
Suppose you want to detect a 5 mmHg difference in systolic blood pressure between two drugs, and earlier crossover studies suggest a within-subject SD of 8 mmHg. Then n = 7.85 × 64 / 25 = 20.1, which rounds up to 21 per sequence. The formula treats σw as known, whereas the trial will estimate it from 2n − 2 degrees of freedom. A simulation of the actual t-test shows 21 per sequence reaches 79.8% power and 22 reaches 81.5%, so the page plans for 22 per sequence, 44 in total. The usual shortcut is to add z₁₋α/2² / 4 (about 0.96) to the formula result and round up, which gives the same 22. At 90% power the normal formula gives 27 per sequence for the same inputs.
If a paper reports the SD of the paired differences (σd) rather than σw, convert with σw = σd / √2. A paired-difference SD of 11.3 mmHg is the same information as a within-subject SD of 8 mmHg, and the formula in terms of σd is n = σd² (z₁₋α/2 + z₁₋β)² / (2δ²). Mixing the two versions is the usual way to end up with a trial twice or half the size it should be.
Sensitivity
Two-sided alpha 0.05, 80% power, 2x2 design, normal formula plus the t-correction (+ z²/4), rounded up. Multiply by 2 for the total.
| Difference to detect | σw = 6 | σw = 8 | σw = 10 | σw = 12 |
|---|---|---|---|---|
| 3 units | 33 | 57 | 89 | 127 |
| 4 units | 19 | 33 | 51 | 72 |
| 5 units | 13 | 22 | 33 | 47 |
| 6 units | 9 | 15 | 23 | 33 |
| 8 units | 6 | 9 | 14 | 19 |
Illustrative values from the formula. Halving the difference roughly quadruples n; a 50% larger SD multiplies it by about 2.2.
Crossover vs parallel
A parallel-group trial compares different people, so the outcome SD combines within-subject variation (σw) and between-subject variation (σb). The two-means sample size calculator needs that total SD. A crossover compares each person with themselves, so σb drops out of the treatment contrast entirely. That is the whole attraction of the design: when people differ a lot from each other and little from day to day, the saving is large.
Keep the same example, with a 5 mmHg difference and σw = 8 mmHg, and vary the between-subject SD. With σb = 0 the parallel trial needs 41 per group (82 in total) against 42 for the crossover, a saving of about half from using each participant twice. With σb = 10 the total SD is 12.8, a parallel trial needs 103 per group (206 in total) and the crossover still needs 42 by the same normal formula, almost five times fewer. With σb = 15 the parallel total is 364, almost nine times the crossover.
Crossover, total
42
Parallel, σb = 10
206
Ratio
4.9x
42 in total
82 in total
112 in total
206 in total
364 in total
Assumptions
The formula assumes the only systematic difference between the two measurements on a person is the treatment, plus a period effect that cancels between sequences. That holds only if the effect of period 1 has gone before period 2 starts. A washout long enough to remove the first treatment (several half-lives for a drug, or the time for a biomarker to return to baseline) is the design’s main protection against carry-over, and it is a clinical and pharmacological decision for the protocol, not a statistical one.
A crossover is a reasonable choice when the condition is chronic and stable, the treatments act quickly and wear off completely, and the outcome is measured repeatedly without being changed by being measured. It is a poor choice for conditions that are cured or progress, for treatments with long-lasting or irreversible effects, and for outcomes such as death or a first event. Many authors, following Senn and Freeman (1989), also advise against a preliminary test for carry-over followed by a switch to a period-1-only analysis: the test has little power and the procedure inflates error rates. Decide in the protocol that carry-over is excluded by design, and argue it from the washout, rather than hoping to test it away.
Dropout works differently from a parallel trial. A participant who leaves after period 1 provides no within-subject contrast. Convert evaluable pairs into enrolment by dividing by (1 − dropout): with 22 per sequence and 15% expected dropout, enrol 22 / 0.85 = 25.9, so 26 per sequence, 52 in total. The dropout-adjusted sample size calculator explains why dividing is correct and adding 15% is not. Crossovers also lengthen each participant’s time in the study, which raises dropout, so a realistic assumption matters more than usual.
Build the eCRFs, visit schedule and randomization in the free sandbox with every feature. No credit card. You pay only when you go live.
From the number to the protocol
ICH E9 asks the protocol to state the sample size, the method, the primary variable and the assumed values with their sources. A sentence that does this reads: “A total of 44 evaluable participants (22 per sequence) provides 80% power to detect a within-subject difference of 5 mmHg in systolic blood pressure between treatments A and B, assuming a within-subject SD of 8 mmHg, using a paired comparison at the two-sided 5% level in an AB/BA crossover design with a washout of 14 days. Allowing for 15% dropout, 52 participants will be randomised.” The statistician should confirm the SD source and the analysis model (a mixed model with sequence, period and treatment as fixed effects and participant as random is typical). The wider how to write a clinical trial protocol guide places this section in context, and the sample size calculation entry defines the terms.
In Capture, the build follows the design. Randomization allocates each participant to a sequence in the ratio you planned. The visit schedule holds period 1, the washout and period 2, with visit windows so the washout is not shortened by an early visit. The primary measurement is a numeric eCRF field with a unit and a range edit check, so an implausible value raises a query while the participant is still at the site. The field-level audit trail records old value, new value, user, time and reason for every change, and CSV or Excel exports come with a data dictionary for analysis. Other planning pages: the power analysis calculator states what a fixed n can detect, the pilot study sample size calculator helps when the within-subject SD is unknown, and the repeated measures sample size calculator covers several measurements per person within one treatment.
Before you lock it
Stable chronic condition, reversible treatments, outcome that is not changed by earlier periods.
Length tied to half-lives or biomarker recovery, with a source.
σw, or σd / √2 from a paired analysis; not the SD from a parallel-group paper.
Smallest clinically important difference with a source.
Re-run with an SD 20% higher and a difference 20% smaller.
Evaluable pairs / (1 − dropout), rounded up per sequence.
Sequence, period and treatment effects, participant random, carry-over excluded by design.
For an AB/BA design with a continuous outcome, n per sequence = σw² (z₁₋α/2 + z₁₋β)² / δ², where σw is the within-subject SD and δ the treatment difference to detect. The total is 2n. With a 5 mmHg difference, σw of 8 mmHg, alpha 0.05 and 80% power the formula gives 20.1; planning for the t-test gives 22 per sequence, 44 in total.
The within-subject SD (residual SD from a model with participant as a factor), or the SD of the paired differences divided by √2. The SD from a parallel-group trial includes between-subject variation that a crossover removes, so using it overstates the sample size badly.
With a within-subject SD of 8 and a between-subject SD of 10, detecting 5 units at 80% power needs about 206 participants in a parallel trial and 42 to 44 in a crossover. If between-subject variation is zero the ratio falls to about two. The saving depends entirely on how much of the variance is between people.
Carry-over is the effect of the period 1 treatment persisting into period 2. It biases the treatment contrast, and unlike a period effect it does not cancel between sequences. The protection is a washout long enough to remove the first treatment, argued from half-lives or biomarker recovery. A preliminary statistical test for carry-over is not a reliable fix.
Divide the evaluable number per sequence by (1 − expected dropout) and round up. A participant who leaves after period 1 gives no within-subject contrast, so each dropout costs a full pair. With 22 per sequence and 15% dropout, enrol 26 per sequence.
No. The formula is for a continuous outcome analysed on the within-subject difference. Binary crossover outcomes need different methods (such as McNemar-type or conditional logistic approaches), and time-to-event outcomes are rarely suitable for a crossover at all.
Capture lets you build the visit schedule for both periods and the washout, with visit windows, randomize participants, and collect the outcome in numeric eCRF fields with range checks and a field-level audit trail. Build and test it in the free sandbox, and ask in a demo if your design has features you want to confirm.
It is a planning aid, checked against a simulation of the actual t-test. A statistician should confirm the design, the SD, the analysis model and the final sample size before a protocol is submitted.
Keep exploring
Two-means sample size calculator
The parallel-group counterpart for a continuous outcome.
Power analysis calculator
What a fixed number of participants can detect.
Repeated measures sample size calculator
Several measurements per participant within one arm.
Dropout-adjusted sample size calculator
Turn evaluable numbers into enrolment.
Pilot study sample size calculator
When the SD is unknown.
Randomization in Capture
Allocate participants to sequences.
Build the eCRFs, visit schedule and randomization in the free sandbox with every feature. No credit card. You pay only when you go live.