Paired t-test

The Paired t-test compares two related measurements from the same subjects — typically before-and-after measurements after an intervention. Example: comparing cholesterol levels before and after a 12-week diet program in the same patients.


Step 1 — Provide your paired data

Through the Data Input panel, you provide two columns of measurements — the "before" values in Measurement 1 and the "after" values in Measurement 2. Sources include:

  • Manual entry — paste two columns of paired values
  • Excel import — upload your file
  • Sample data — choose from three built-in scenarios:
    • Blood Pressure Medication Trial (Systolic BP, Diastolic BP, Heart Rate)
    • Cognitive Training Intervention (Memory Score, Reaction Time, Attention Span)
    • Weight Loss Program (Body Weight)

Step 2 — Calculate Results

Click Calculate Results. If your two columns have different lengths, the module applies intelligent pairing automatically (see Statistical methods used below).


Step 3 — Data Pairing Report (when needed)

If pairing was applied, a Data Pairing Report appears at the top of the results showing:

Field What it shows
Original Data Number of observations originally in each measurement
Method The pairing method that was used
Quality A quality score for the pairing as a percentage
Used pairs Number of paired observations the test actually used
Excluded Number of observations that could not be paired

A note clarifies: "The analysis proceeded automatically using the optimally paired data."


Step 4 — Read the results

The Test Results panel shows:

  • Paired sample statistics — mean, SD, n for each measurement, plus the mean difference
  • t-value and degrees of freedom
  • p-value
  • Effect Size (Cohen's d) with interpretation
  • 95% Confidence Interval for the mean difference
  • A single-line significance verdict: "There is a statistically significant difference between the paired samples (p < 0.05)" or "There is no statistically significant difference between the paired samples (p ≥ 0.05)"

Step 5 — Check the assumptions

An AssumptionChecks panel runs whenever raw paired data is available, evaluating five assumptions with a pass / warning / fail status each.


Step 6 — Power analysis

A PowerAnalysis panel reports your achieved statistical power plus a table of recommended sample sizes for 80%, 85%, 90%, and 95% power at your observed effect size, indicating how many additional pairs you would need to reach each target.


Step 7 — Discuss with the chatbot

A UniversalChatBot is available at the bottom for interpretation.


Statistical methods used

Test statistic

The Paired t-test reduces the two columns to a single column of differences and runs a one-sample t-test on those differences:

  • Differences: dᵢ = xᵢ − yᵢ for each paired observation i
  • t-statistic: t = d̄ / (s_d / √n) where is the mean of differences, s_d is the standard deviation of differences, and n is the number of pairs
  • Degrees of freedom: df = n − 1
  • 95% Confidence Interval: d̄ ± t_critical(0.05, df) × (s_d / √n)

Hypothesis statement

  • H₀: μ_d = 0 (no mean difference between paired measurements)
  • H₁: μ_d ≠ 0 (two-tailed test for a non-zero difference)
  • Significance level: α = 0.05

Intelligent data pairing

If the two columns do not have the same length, the module automatically pairs them. It tries four pairing methods:

Method What it does
Sequential Pairs values in the order they appear
Nearest Pairs each value with the closest value in the other column
Quantile Pairs by matching quantile positions
Optimal Tries all of the above and chooses the one with the highest pairing quality score (0–1)

Effect size — Cohen's d

Computed as |d̄| / s_d (mean of differences divided by SD of differences, then taken as absolute value). Interpretation follows the standard Cohen (1988) convention:

| |Cohen's d| | Label | |---|---| | < 0.001 | No effect (identical means) | | 0.001 – 0.20 | Very small effect | | 0.20 – 0.50 | Small effect | | 0.50 – 0.80 | Medium effect | | ≥ 0.80 | Large effect |

Assumption tests

The AssumptionChecks panel runs five checks in parallel:

Assumption Test method How it is judged
Adequate Sample Size Counts paired observations Pass if n ≥ 30, warning if 10 ≤ n < 30, fail if n < 10
Normality of Differences Shapiro-Wilk for n ≤ 50; Anderson-Darling for n > 50 Normal if p > 0.05
Outlier Detection IQR (Tukey) method on the differences Pass if 0 outliers; warning if 1–2; fail if 3+
Independence of Observations Design-based — assumed if data come from paired/repeated measures Informational
Continuous Measurement Scale Design-based Informational

If normality fails, the recommendation suggests considering the Wilcoxon Signed Rank Test.

Power analysis

Post-hoc power is calculated using the non-central t-distribution. The panel calculates the required sample size at four target power levels (80%, 85%, 90%, 95%) using the formula n = ((z_α + z_β) / d)².

Error handling

Condition Error message
n ≤ 1 "At least 2 paired observations are required for t-test calculation"
All differences identical "Standard deviation is zero — all differences are identical. Cannot perform t-test."
Invalid numeric data "All data values must be valid finite numbers"
t-statistic non-finite "Invalid t-statistic calculated. Check your data for extreme values."