Detect traffic allocation imbalances in your A/B tests using the chi-square goodness-of-fit test.Validate randomization integrity, uncover data quality issues, and ensure your experiment conclusions are trustworthy.
In the context of A/B testing and controlled experiments, Sample Ratio Mismatch (SRM) refers to a statistically significant deviation between the expected allocation of units (users, sessions, or observations) across experimental variants and the observed allocation. For example, if you design a test to split traffic 50/50 between control and treatment, but your analytics pipeline reports 47% control and 53% treatment, you have a ratio mismatch.
SRM is a critical diagnostic because it signals that something may be wrong with your experiment infrastructure—data logging errors, inconsistent assignment logic, user filtering discrepancies, or even deliberate tampering. If left undetected, SRM can invalidate your statistical inferences, inflate false positive rates, and lead to incorrect business decisions. The chi-square goodness-of-fit test is the standard method for detecting SRM: it compares the observed counts against the expected counts under the null hypothesis that the true allocation matches the planned ratio.
χ² = Σ (Oi − Ei)² / Ei
where Oi is the observed count in variant i, and Ei is the expected count under the planned ratio. Under the null, χ² follows a chi-square distribution with (k − 1) degrees of freedom, where k is the number of variants.
The calculator returns three key statistics:
The status badge provides a quick decision:
Events dropped, duplicate tracking, or incorrect user‑ID assignment can skew observed counts. Always validate your analytics pipeline before trusting the numbers.
Hash collisions, inconsistent seed values, or conditional redirects can break randomization. Review your feature‑flag or split‑testing implementation.
If you apply different inclusion/exclusion criteria post‑assignment, the observed sample may not reflect the intended population. Keep filtering consistent across variants.
Misaligned date ranges or time‑zone conversions can cause counts to drift. Ensure all variants are measured over the same calendar period.
A large e‑commerce company ran an A/B test on their checkout page, expecting a 50/50 split. After two weeks, they observed a 48/52 split with N = 120,000 users. The SRM test returned χ² = 12.8, df = 1, p = 0.00035 — a highly significant mismatch.
Upon investigation, they discovered that a caching layer was serving the treatment variant to repeat visitors more frequently than the control. This meant that the “treatment” group had a higher proportion of returning users, which skewed both the sample ratio and the outcome metric (purchase rate). By fixing the caching issue and re‑running the test, they avoided a false positive and ultimately launched a feature that increased revenue by 4.2% — a $2M annual impact. The SRM check was the early warning that prevented a costly misstep.
Source: Internal experimentation audit, anonymized.