19 / Inference
Welch’s independent-samples t-test
Welch’s t-test compares two population means while allowing different sample sizes and variances. It turns an observed average difference into an estimate with uncertainty, helping a business distinguish a plausible operational improvement from ordinary sampling variation.
The business question
Do two independent suppliers, teams or processes have different average performance?
- Compare delivery times from independently sampled suppliers using an average-time outcome.
- Evaluate average order value or service duration across genuinely independent groups.
- Place an uncertainty range around a difference before valuing a process change.
How the method works
The analysis starts with a business-defined difference, such as supplier A’s mean delivery time minus supplier B’s. Each group contributes its own sample variance divided by its sample size. Adding these quantities estimates the sampling variance of the difference. The resulting standard error measures uncertainty about the two means; it is not the spread of individual delivery times.
Dividing the difference by its standard error produces the t statistic. Welch’s approximate degrees of freedom account for how much information each estimated variance contributes. A two-sided p-value asks how unusual a difference at least this extreme would be under equal population means and the sampling assumptions. It is not the probability that the suppliers are identical.
A confidence interval adds and subtracts an appropriate t-based margin from the observed difference. That interval is usually more useful for a purchasing decision than a significance label alone: it shows both direction and plausible size. Welch’s method avoids assuming equal variances, but it still needs independent, appropriately sampled observations and attention to strong skew, outliers and clustering.
The calculation
| Symbol | Meaning |
|---|---|
| mean_A, mean_B | Sample averages in the original business units. |
| s_A, s_B | Sample standard deviations, calculated with n−1 in the denominator. |
| n_A, n_B | Numbers of independent observations. |
| ν | Welch–Satterthwaite approximate degrees of freedom. |
A worked business example
ILLUSTRATIVE SCENARIO
Illustrative South African repair business comparing turnaround time from two independent spare-parts suppliers.
Inputs
- Supplier A: n=30, mean=18 minutes, sample SD=4 minutes.
- Supplier B: n=25, mean=22 minutes, sample SD=7 minutes.
- Predefined two-sided test and 95% confidence interval.
Work through the numbers
- Difference A−B = 18−22 = −4 minutes.
- Variance of the difference = 16/30 + 49/25 = 2.49333; SE = 1.57903 minutes.
- Welch degrees of freedom ≈36.596; t≈−2.533, with p≈0.015724.
- The 95% interval is approximately −7.201 to −0.799 minutes.
The interval supports a mean reduction under the model, but individual A jobs may still take longer than individual B jobs. Across 1,000 comparable jobs, four minutes represents 66.7 job-hours less elapsed turnaround. It represents released staff capacity only if those minutes are active staff work or demonstrably release a constrained resource; it is not an automatic payroll saving.
Explore the decision
Compare two independent means. The live explorer has its own example inputs; it is separate from the worked calculation above.
Enable JavaScript to use this calculator. The worked example and executable Python remain available.
Apply it at work
- Define the outcome, comparison, direction and minimum worthwhile difference before inspecting results.
- Sample separate orders from the same relevant operating periods and retain supplier and job context.
- Inspect distributions and unusual observations, then calculate the difference, interval and Welch p-value.
- Compare the interval with switching costs, reliability, service quality and a larger validation sample.
Check these assumptions
- Orders within and between groups are independent; repeated jobs from the same customer or day may require clustered analysis.
- The data represent the suppliers and conditions about which the decision will be made.
- Means are meaningful for the outcome; extreme skew or influential errors need investigation.
- The t approximation is adequate for the sample sizes and distributions; small severe-tailed samples can be unreliable.
Common mistakes and how to avoid them
- Using an independent test on before-and-after measurements of the same units wastes pairing and changes the uncertainty calculation.
- Treating p<0.05 as proof of a useful improvement ignores effect size, implementation cost and selection bias.
- Interpreting a confidence interval for the mean difference as an interval covering individual delivery times is incorrect.
How this can help the business
- A purchasing team can compare the plausible time advantage with price and quality differences before negotiating a trial.
- Operations can value released capacity separately from cash savings and verify whether the bottleneck actually moves.
Choose a supplier on total value only after the estimated difference and its uncertainty meet a pre-agreed practical requirement. A small p-value alone is not a purchasing rule.
When to use another approach
Use a paired t-test for matched observations, a robust or permutation method for difficult distributions, or regression when job mix must be adjusted.
Reproduce the worked example in Python
The code is self-contained for this example. Dependencies and run instructions are included with the downloadable notebook.
Show executable code and recorded output
import numpy as np
from scipy import stats
mean_a, sd_a, n_a = 18, 4, 30
mean_b, sd_b, n_b = 22, 7, 25
test = stats.ttest_ind_from_stats(mean_a, sd_a, n_a, mean_b, sd_b, n_b, equal_var=False)
v_a, v_b = sd_a**2 / n_a, sd_b**2 / n_b
se = np.sqrt(v_a + v_b)
df = (v_a + v_b)**2 / (v_a**2 / (n_a-1) + v_b**2 / (n_b-1))
margin = stats.t.ppf(0.975, df) * se
print("Difference A-B (minutes):", round(mean_a-mean_b, 3))
print("Welch t, df, p:", round(test.statistic, 3), round(df, 3), round(test.pvalue, 6))
print("95% CI:", round(mean_a-mean_b-margin, 3), round(mean_a-mean_b+margin, 3))Recorded output
Difference A-B (minutes): -4 Welch t, df, p: -2.533 36.596 0.015724 95% CI: -7.201 -0.799
Sources and further reading
Concepts are linked to primary teaching or technical sources. The business examples are illustrative applications, not reported client results.