Compare means calculator

Cohen's d and Hedges' g calculator

Calculate standardized effect sizes Cohen's d, Hedges' g (small-sample correction), and Glass's delta for independent and paired t-tests.

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

When to use it

Use whenever reporting t-test results to express practical significance independent of sample size.

Required Inputs

  • Mean 1 & Standard Deviation 1 (or Sample 1)
  • Mean 2 & Standard Deviation 2 (or Sample 2)
  • Sample sizes n₁ & n₂

Mathematical Formula

d = (X̄₁ - X̄₂) / s_pooled, g = d * [ 1 - 3 / (4(n₁+n₂) - 9) ]

Reporting Cautions

  • Use Hedges’ g when sample sizes are small (n < 20 per group).
  • Choose Glass’s delta when control and treatment groups have severely unequal variances.

Code Snippets (Python, R, TypeScript)

Python (SciPy / Statsmodels)
import numpy as np
def cohens_d(x, y):
    nx, ny = len(x), len(y)
    s_pooled = np.sqrt(((nx-1)*np.var(x, ddof=1) + (ny-1)*np.var(y, ddof=1)) / (nx+ny-2))
    return (np.mean(x) - np.mean(y)) / s_pooled
R Language
library(effsize)
cohen.d(group_a, group_b)
TypeScript (@statlab/core)
import { cohensD, hedgesG } from '@statlab/core';
const d = cohensD(groupA, groupB);
const g = hedgesG(groupA, groupB);

Developer Use Cases & Production Integrations

  • Quantifying practical impact magnitude beyond p-value significance in A/B test reporting.
  • Standardizing benchmark performance gains across heterogeneous hardware runs in VoxelAssurance.

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.