Editverse Free Calculator

Crossover Study Calculator (AB/BA Design)

Analyse a two-period, two-treatment crossover trial — treatment effect, period effect, and a carryover check — with the exact R command behind the result. A full interpretation guide follows below. Validated against R 4.3.3.

In Simple Words

In a crossover trial each participant receives both treatments in sequence, so every person acts as their own control. The classic AB/BA design randomises participants to receive treatment A then B, or B then A, usually with a washout period in between to clear the first treatment’s effect.

Because within-person comparisons remove between-person variability, crossover trials can reach the same precision with far fewer participants than a parallel design. The price is added assumptions — chiefly that there is no carryover, where the first treatment’s effect lingers into the second period and contaminates the comparison.

When to Use a Crossover Design

Use a crossover design for stable, chronic conditions where the outcome returns to baseline between periods and the treatment’s effect is reversible — for example, comparing two analgesics for a recurring condition. It is efficient precisely because each participant supplies a paired comparison.

Avoid it when the condition can be cured, when outcomes are irreversible, or when carryover cannot be ruled out by an adequate washout. Always check for period and carryover effects before interpreting the treatment effect, and report the design fully. For independent groups instead, a parallel-group sample size is the alternative. Unsure which design fits? Our Test Selector can help.

Crossover Study Analysis (AB/BA) Treatment, period and carryover effects · validated vs R 4.3.3
User guide

When to use. Analyse a two-period, two-treatment (AB/BA) crossover trial with a continuous outcome: estimate the treatment effect, and test for period and carryover effects (Hills-Armitage / Grizzle).

Assumptions. Participants randomised to the two sequences; adequate washout; approximately normal within-subject differences; no treatment-by-period interaction.

Common mistakes. The carryover test has low power and should not be used as a gatekeeper for the analysis (Senn); decide on washout in the design. Do not use for conditions that resolve or treatments with permanent effects.

Worked example

Click Load example data above, then Run Analysis to see a fully worked result with figure, formula and interpretation for this test.

References
  1. Senn S. Cross-over Trials in Clinical Research. 2nd ed. Wiley; 2002.
  2. Hills M, Armitage P. The two-period cross-over clinical trial. Br J Clin Pharmacol. 1979;8:7-20.
  3. Grizzle JE. The two-period change-over design and its use in clinical trials. Biometrics. 1965;21:467-480.

Worked Examples

Example 1 — A clean crossover

Participants receive A then B or B then A with a washout between. The treatment effect is estimated from each person’s within-subject difference, and tests for period and carryover effects are non-significant. The treatment comparison is trustworthy and far more precise than a parallel trial of the same size.

Example 2 — Carryover detected

If the carryover test is significant, the first treatment’s effect has bled into the second period. The standard within-subject estimate is now biased, and analysts often fall back on just the first period — effectively discarding the crossover advantage.

Assumptions to Check

Reversible condition and effect. The outcome must return to baseline between periods. Crossover is invalid for conditions that resolve or for treatments with permanent effects.

Adequate washout, no carryover. The gap between periods must be long enough to clear the first treatment. Residual carryover biases the within-subject comparison.

No treatment-by-period interaction. The treatment effect should be the same regardless of the order in which it is given; a strong order effect undermines the design.

Common Mistakes

Ignoring carryover

Assuming washout was sufficient without testing for carryover risks a biased treatment estimate. Check it explicitly before interpreting results.

Analysing as if it were a parallel trial

Crossover data are paired within person. Treating the two arms as independent groups throws away the design’s efficiency and gives the wrong standard errors.

Too short a washout

A washout that does not fully clear the first treatment guarantees carryover. The washout length must be justified from the treatment’s pharmacology.

Using crossover for an irreversible outcome

If the outcome cannot return to baseline (for example, a cure or death), participants cannot meaningfully cross over and the design is inappropriate.

Frequently Asked Questions

Why does a crossover trial need fewer participants?

Each participant serves as their own control, removing between-person variability, so the same precision is reached with a smaller sample than a parallel design.

What is carryover?

Carryover is the residual effect of the first-period treatment persisting into the second period, which biases the within-subject treatment comparison.

What is a washout period?

A washout is the gap between treatment periods, long enough for the first treatment’s effect to disappear before the second begins.

Does the result match R and SPSS?

Yes. The calculator uses the standard AB/BA within-subject analysis and shows the R command so you can reproduce the treatment, period, and carryover estimates.

References

  1. Mills EJ, Chan AW, Wu P, Vail A, Guyatt GH, et al. Design, analysis, and presentation of crossover trials. Trials. 2009;10:27. PMID 19405975.
  2. Li T, Yu T, Hawkins BS, Dickersin K. Design, analysis, and reporting of crossover trials for inclusion in a meta-analysis. PLoS One. 2015;10(8):e0133023. PMID 26284684.
  3. Senn S. Cross-over Trials in Clinical Research. 2nd ed. Chichester: Wiley; 2002.

Need This Analysis Done for Your Manuscript?

Our PhD biostatisticians design and analyse crossover trials — period and carryover checks, within-subject estimation, and sample size — with reproducible R output.

Get Expert Statistical Help