# Percentage of overlapping regions of two normal distributions

I was wondering, given two normal distributions with std1,mean1 and std2,mean2, how can I calculate the percentage of overlapping regions of two distributions.

I suppose this problem has a specific name, are you aware of any particular name describing this problem ?

Are you aware of any implementation of this (e.g., Java code) ?

Thanks,

-
What do you mean with overlapping region? Do you mean the area that is below both density curves? – Nick Sabbe Jun 22 '11 at 8:11
I mean the intersection of two areas – Ali Jun 22 '11 at 8:15
In short, writing the two pdfs as $f$ and $g$, do you really want to compute $\int \min(f(x),g(x))dx$ ? Could you enlighten us about the context in which this arises and how it would be interpreted? – whuber Jun 22 '11 at 14:38

This is also often called the "overlapping coefficient" (OVL). Googling for this will give you lots of hits. You can find a nomogram for the bi-normal case here:

http://www.rasch.org/rmt/rmt101r.htm

A useful paper may be:

Henry F. Inman; Edwin L. Bradley Jr (1989). The overlapping coefficient as a measure of agreement between probability distributions and point estimation of the overlap of two normal densities. Communications in Statistics - Theory and Methods, 18(10), 3851-3874. (Link)

Edit

Now you got me interested in this more, so I went ahead and created R code to compute this (it's a simple integration). I threw in a plot of the two distributions, including the shading of the overlapping region:

min.f1f2 <- function(x, mu1, mu2, sd1, sd2) {
f1 <- dnorm(x, mean=mu1, sd=sd1)
f2 <- dnorm(x, mean=mu2, sd=sd2)
pmin(f1, f2)
}

mu1 <- 2
mu2 <- 1
sd1 <- 2
sd2 <- 1

xs <- seq(min(mu1 - 3*sd1, mu2 - 3*sd2), max(mu1 + 3*sd1, mu2 + 3*sd2), .01)
f1 <- dnorm(xs, mean=mu1, sd=sd1)
f2 <- dnorm(xs, mean=mu2, sd=sd2)

plot(xs, f1, type="l", ylim=c(0, max(f1,f2)), ylab="density")
lines(xs, f2, lty="dotted")
ys <- min.f1f2(xs, mu1=mu1, mu2=mu2, sd1=sd1, sd2=sd2)
xs <- c(xs, xs[1])
ys <- c(ys, ys[1])
polygon(xs, ys, col="gray")

### only works for sd1 = sd2
SMD <- (mu1-mu2)/sd1
2 * pnorm(-abs(SMD)/2)

### this works in general
integrate(min.f1f2, -Inf, Inf, mu1=mu1, mu2=mu2, sd1=sd1, sd2=sd2)


For this example, the result is: 0.6099324 with absolute error < 1e-04. Figure below.

-
(+1) Googling turns up at least three distinct definitions (Matsushita, Morisita, and Weitzman). Your implementation is Weitzman's. – whuber Jun 22 '11 at 15:26
0.60993 24 is an approximation for 0.60993 43398 78944 33895... . – whuber Jun 22 '11 at 22:26

This is given by the Bhattacharyya coefficient . For other distributions, see also the generalised version, the Hellinger distance between two distributions.

I don't know of any libraries to compute this, but given the explicit formulation in terms of Mahalanobis distances and determinant of variance matrices, implementation should not be an issue.

-

I don't know if there is an obvious standard way of doing this, but:

First, you find the intersection points between the two densities. This can be easily achieved by equating both densities, which, for the normal distribution, should result in a quadratic equation for x.

Something close to: $$\frac{(x-\mu_2)^2}{2\sigma_2^2} - \frac{(x-\mu_1)^2}{2\sigma_1^2} = \log{\frac{\sigma_1}{\sigma_2}}$$

This can be solved with basic calculus.

Thus you have either zero, one or two intersection points. Now, these intersection points divide the real line into 1, 2 or three parts, where either of the two densities is the lowest one. If nothing more mathematical comes to mind, just try any point within one of the parts to find which one is the lowest.

Your value of interest is now the sum of the areas under the lowest density curve in each part. This area can now be found from the cumulative distribution function (just subtract the value in both edges of the 'part'.

-
(+1) Actually, when $\sigma_1 \ne \sigma_2$, the equation can be solved with the quadratic formula: no need for calculus. If we arrange (wlg) for $\mu_1 \ge \mu_2$, then the second density is smallest between the two zeros and otherwise the first density is smallest. This reduces the calculation to four evaluations of a Normal CDF. The situation with $\sigma_1 = \sigma_2$ is even simpler, requiring solution of a linear equation and only two evaluations of a CDF. – whuber Jun 22 '11 at 15:30
@whuber Could you turn this into a full answer? Or maybe Nick can edit his. – Aleksandr Dubinsky Feb 10 at 9:02