Compare means calculator

Paired samples t-test calculator

Compare pre/post or paired continuous measurements using the paired samples t-test with mean difference, t-statistic, p-value, and Cohen’s d_z.

Run this test live in StatLab npm i @statlab/core

When to use it

Use when each observation in group A directly pairs with an observation in group B (e.g. pre/post test).

Required Inputs

  • Pre / Baseline values
  • Post / Treatment values
  • Confidence level
  • Alternative hypothesis

Mathematical Formula

t = d̄ / (s_d / √n), where d_i = x_{post,i} - x_{pre,i}

Reporting Cautions

  • Requires matched data pairs of equal length.
  • Evaluates difference scores; check that pair differences d_i are approximately normally distributed.

Code Snippets (Python, R, TypeScript)

Python (SciPy / Statsmodels)
from scipy import stats
res = stats.ttest_rel(pre_values, post_values)
print(f"t={res.statistic:.4f}, p={res.pvalue:.4f}")
R Language
t.test(pre_values, post_values, paired = TRUE)
TypeScript (@statlab/core)
import { tPaired } from '@statlab/core';
const result = tPaired(preValues, postValues);

Developer Use Cases & Production Integrations

  • Measuring latency changes on the exact same set of API endpoints before and after a optimization deployment.
  • Tracking user task completion time before and after UI redesign in VoxelPulse telemetry.
  • Evaluating paired LLM response timing across prompt iterations in VoxelAssurance runs.

VoxelPulse Telemetry Control Plane

Continuous A/B testing, statistical telemetry analysis, and automated feedback loops for live backend services.

Explore VoxelPulse →

VoxelAssurance Release Readiness

Fixed-price AI release-readiness sprints, automated regression testing, and reliability statistical benchmarks.

Explore VoxelAssurance →

Related Statistical Test Calculators

Explore static calculators across the StatLab inference engine suite.