0

I am looking to find the overlapping probability of two normal distributions in Python. I've looked around on stackoverflow and found the following:

Overlapping probability of two normal distribution with scipy

The code by "amitdatta" seems to give a syntax error and has lower and upper variables undefined.

The error that occurs is overlap = (norm.cdf(r1,m1,std1)-norm.cdf(lower,m1,std1))+(norm.cdf(r2,m2,std2)-norm.cdf(r1,m2,std2))+(norm.cdf(upper,m1,std1)-norm.cdf(r2,m1,std1))
                                                                                                                                                                ^
SyntaxError: invalid syntax

(The syntax error arrow points to the second "r2" in the code)

Can anyone point me to code or advise me on finding the overlapping probability of two normal distributions?

Thanks!

Version: Python 3.6.2

Chris B
  • 75
  • 1
  • 1
  • 7
  • 2
    The answer has clarifications in the comments below it about the `upper` and `lower` usage, and if you have a question on how to correct the syntax error you should show us the code and the error in the body of the question – Ofer Sadan Jun 17 '18 at 10:32
  • How would I express the upper and lower in code? Edited the question to include the error. The code is copied from the linked one. – Chris B Jun 17 '18 at 11:51

0 Answers0