Simplify overlap() formula for case where variances are equal (GH-12323)

This commit is contained in:
Raymond Hettinger 2019-03-14 02:25:26 -07:00 committed by Miss Islington (bot)
parent 3191391515
commit 41f0b78cbf
1 changed files with 1 additions and 1 deletions

View File

@ -773,7 +773,7 @@ class NormalDist:
dv = Y_var - X_var
dm = fabs(Y.mu - X.mu)
if not dv:
return 2.0 * NormalDist(dm, 2.0 * X.sigma).cdf(0)
return 1.0 - erf(dm / (2.0 * X.sigma * sqrt(2.0)))
a = X.mu * Y_var - Y.mu * X_var
b = X.sigma * Y.sigma * sqrt(dm**2.0 + dv * log(Y_var / X_var))
x1 = (a + b) / dv