TapCub is live — analytics, insights and live chat, free on one platform
Glossary

What is a matched pairs experiment? Design and paired test

A matched pairs experiment pairs similar units and randomizes treatment inside each pair. How it differs from completely randomized and repeated-measures designs, the paired test, and an 8-pair example analysed both ways.

Lucas Hayes Reviewed by Chen Yu Also called matched pairs design Last updated Nov 29, 2026 Glossary

Quick answer

A matched pairs experiment groups units into pairs that are alike on a variable that predicts the outcome, then randomly assigns one unit in each pair to treatment and the other to control. It is analysed with a paired test on the within-pair differences.

Formula: d_i = y_treat,i − y_control,i; t = mean(d) ÷ (s_d ÷ √n), df = n − 1 (n = number of pairs)

What is a matched pairs experiment?

A matched pairs experiment (matched pairs design) is a randomized experiment in which units are first grouped into pairs that are as alike as possible on a variable that predicts the outcome, and then a coin flip inside each pair decides which unit gets the treatment and which stays as the control. The result for each pair is one number: the treated unit's outcome minus the control unit's outcome. Those differences are then analysed with a paired test.

The design is a randomized block design with blocks of size two. The NIST/SEMATECH e-Handbook sums up the logic of blocking as "block what you can, randomize what you cannot": the matching variable is held constant inside each pair, and randomization takes care of everything you could not match on.

Three things make it a matched pairs experiment rather than something else:

  • Pairs are formed before treatment, using data you already have (last month's sessions, baseline conversion rate, age, store size).
  • Assignment is random inside each pair, never chosen by the analyst.
  • The analysis uses the within-pair differences, so the number of observations is the number of pairs, not the number of units.

How to run a matched pairs design step by step

  1. Pick the matching variable. Choose the variable that best predicts the outcome you will measure. For conversion, last period's conversion rate or traffic is usually stronger than geography or company size.
  2. Rank units on that variable and pair neighbours. Sort the 16 units from lowest to highest and pair 1 with 2, 3 with 4, and so on. Units that cannot be paired well are left out rather than forced into a weak pair.
  3. Randomize within each pair. Flip a coin or use a random number per pair. Write the assignment down before the test starts.
  4. Run both units in the same period. The pair only cancels noise if both members experience the same weeks, seasonality and campaigns.
  5. Compute one difference per pair (treatment minus control) and run a paired t-test on the differences, or a sign or Wilcoxon signed-rank test if the differences are badly skewed.

Matched pairs vs completely randomized vs repeated measures

DesignHow units are assignedEach unit getsAnalysisBest when
Completely randomizedRandom split of all units into two groupsOne treatmentTwo-sample t-test or two-proportion testMany units, outcome not strongly predicted by a known variable
Matched pairsPairs of similar units, random coin flip inside each pairOne treatmentPaired t-test on differencesFew units that differ a lot, and a strong predictor is known in advance
Repeated measures (within-subjects)Same unit receives both treatments, in random orderBoth treatmentsPaired t-test on before/after or A/B per unitThe unit can be measured twice without carry-over

A repeated-measures design is the extreme case of matching: each unit is paired with itself. It removes even more noise, but it fails when the first treatment changes how the unit reacts to the second (learning, novelty, a changed price that customers remember). Matched pairs avoids carry-over because every unit only sees one condition. The experimental unit is the thing being paired, such as a store, a landing page or a city, so decide that first.

The paired test formula

For n pairs, let d_i be the outcome of the treated unit minus the outcome of the control unit in pair i.

  • Mean difference: d̄ = Σ d_i ÷ n
  • Standard deviation of the differences: s_d
  • Test statistic: t = d̄ ÷ (s_d ÷ √n), with n − 1 degrees of freedom
  • 95% confidence interval: d̄ ± t₀.₉₇₅,ₙ₋₁ × s_d ÷ √n

The degrees of freedom are the number of pairs minus one, not the number of units minus two. That is the price you pay for pairing, and it matters when n is small. The calculation itself is the same as the paired version of the t-test; this page is about how the pairs are built. For a comparison of one-sample, two-sample and paired tests, see types of t-tests.

Worked example: 8 store pairs and a new checkout

Sample data: a retailer runs 16 storefronts with very different traffic and conversion. It ranks them on last month's checkout conversion rate, pairs neighbours, and flips a coin inside each pair to decide which store gets the new one-page checkout for four weeks.

PairControl conversion (%)Treatment conversion (%)Difference d (pp)
11.82.20.4
22.43.30.9
33.13.0−0.1
42.02.60.6
54.24.50.3
62.73.50.8
73.63.80.2
81.52.00.5

Paired analysis, recomputed in Python:

  • d̄ = (0.4 + 0.9 − 0.1 + 0.6 + 0.3 + 0.8 + 0.2 + 0.5) ÷ 8 = 0.45 pp
  • s_d = 0.325, so the standard error is 0.325 ÷ √8 = 0.115
  • t = 0.45 ÷ 0.115 = 3.92 with 7 degrees of freedom, two-sided p ≈ 0.006
  • 95% interval: 0.45 ± 2.365 × 0.115 = 0.18 to 0.72 pp

The new checkout raised conversion in 7 of 8 pairs, and the interval excludes zero.

The same data analysed as two independent samples

Now ignore the pairing and compare the 8 treatment stores with the 8 control stores as two independent groups, which is the common mistake:

  • Treatment mean 3.11%, control mean 2.66%: the same 0.45 pp difference
  • Standard deviations 0.84 and 0.93, pooled standard error 0.443
  • t = 0.45 ÷ 0.443 = 1.02 with 14 degrees of freedom, p ≈ 0.33

Same data, same effect, opposite conclusion. The two-sample test treats the gap between a 1.5% store and a 4.2% store as noise. The paired test removes it, because each pair shares its baseline. The standard error shrank from 0.443 to 0.115, so the variance of the estimate fell by a factor of about 15. This is why the analysis must follow the design: pairing in the design and then running a two-sample test throws away the precision you built.

When pairing reduces variance and when it does not

With equal spread σ in both arms and a correlation ρ between the two members of a pair, the variance of a difference is 2σ²(1 − ρ). Pairing therefore cuts the variance of the estimated effect by the factor (1 − ρ). In the example the pair members correlate at r = 0.94 across pairs, so the variance shrinks to roughly a fifteenth.

Pairing has a cost: degrees of freedom fall from 2n − 2 to n − 1, which raises the critical t value. With 8 pairs the two-sided 5% critical value is 2.365 at 7 df versus 2.145 at 14 df. The squared ratio (2.145 ÷ 2.365)² = 0.82 gives a simple decision rule:

  • If the matching variable will correlate with the outcome at more than about 0.2 within pairs, pair. The variance reduction outweighs the lost degrees of freedom.
  • If the correlation is near zero, do not pair. You lose degrees of freedom and gain nothing; a completely randomized design is as good or better.
  • With hundreds of units, the df cost disappears, but randomization alone already balances the groups, so pairing mainly helps when units are few and heterogeneous (stores, cities, sales regions, B2B accounts).

Common mistakes with matched pairs

  • Matching on a variable that does not predict the outcome. Pairing stores by region when conversion depends on traffic source adds work and no precision.
  • Choosing who gets the treatment instead of flipping a coin. Giving the new checkout to the "more promising" store in each pair brings selection bias back.
  • Analysing pairs as independent groups. Shown above: p ≈ 0.33 instead of 0.006.
  • Dropping one member of a pair but keeping the other. If a store closes mid-test, drop the whole pair; an orphaned unit has no difference to contribute.
  • Running the two members in different weeks. A holiday in one week and not the other becomes part of d.

Matched pairs with TapCub data

TapCub does not split traffic, assign treatments or run experiments. It only measures. Here is how the checkout example above uses TapCub data, assuming the 16 storefronts are tracked as separate hosts in one project:

  1. Get the matching variable. In All-platform analytics › Behavior › Behavior analysis, run an event analysis on the Table tab for last month with two measurements, visitors and unique people who fired purchase, broken down by host. Export the table as CSV and divide the two columns to get each store's baseline conversion rate.
  2. Pair and randomize outside TapCub. Sort the CSV on baseline conversion, pair neighbours and flip a coin per pair in your spreadsheet. Keep the assignment sheet with the test plan.
  3. Mark the start. Add the launch date in Configuration › Annotations so everyone reading the trend sees when the new checkout went live.
  4. Read the outcome per unit. After four weeks, rerun the same analysis for the test period, export it, compute one difference per pair and run the paired t-test.

Sources

Was this explanation clear?

We use your answers to fix and expand this page.

Lucas Hayes

Data Engineer

Writes about event design, data quality, and collection workflows, with verifiable implementation methods for reliable analytics.

FAQ

Questions people ask

Short answers to the follow-up questions that come up most.

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

What is a matched pairs design in statistics?

It is an experimental design where similar units are paired before the experiment and treatment is assigned at random within each pair. Because both members share the matching variable, each pair's difference removes that source of variation, and the analysis is a paired t-test on n differences with n − 1 degrees of freedom.

What is the difference between matched pairs and repeated measures?

In matched pairs, two different but similar units each receive one treatment. In repeated measures, the same unit receives both treatments in random order. Repeated measures removes more noise but suffers from carry-over effects such as learning; matched pairs avoids carry-over because each unit sees only one condition.

Can I use a two-sample t-test on matched pairs data?

No. A two-sample test ignores the pairing and treats differences between pairs as noise. In the sample store example the same 0.45-point effect gives p ≈ 0.006 with the paired test and p ≈ 0.33 with a two-sample test. The analysis has to follow the design.

When is a matched pairs design not worth it?

When the matching variable barely predicts the outcome. Pairing halves the degrees of freedom, so with 8 pairs it only pays off if the within-pair correlation of outcomes is above about 0.2. With hundreds of units, simple randomization already balances the groups.

See this number on your own site

Add one script tag for web and apps, and the first reports fill in within minutes.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics