I spent three hours last week debugging what looked like impossible math in our experiment pipeline. An R analysis flagged a two-sample feature rollout as inconclusive with p = 0.0866. My Python reimplementation, running against the exact same database extract, declared a statistically significant victory with p = 0.00102.
The observations were identical and group means matched to four decimals, yet R's t.test and Python's scipy.stats.ttest_ind gave opposite verdicts. This discrepancy comes from a thirty-year divergence in library defaults, combined with textbook statistical advice that collapses on real data.
The bug was not in the database query. It was in how each environment handles group variance.
When you call t.test(a, b) in R, stats defaults to var.equal = FALSE . R runs Welch's t-test, using the Welch–Satterthwaite equation to adjust degrees of freedom downward for unequal variance.
Passing two arrays straight to ttest_ind in scipy.stats leaves equal_var=True active by default.…