AllenDowney / ThinkStats2

Text and supporting code for Think Stats, 2nd Edition
http://allendowney.github.io/ThinkStats2/
GNU General Public License v3.0
4.03k stars 11.31k forks source link

6.1 - NormalPdf class #60

Closed cpnguyen5 closed 2 years ago

cpnguyen5 commented 7 years ago

Your book has been awesome thus far! I came across a potential issue in your NormalPdf class, specifically when working with the example on adult female heights from the BRFSS dataset (page 76-77).

Per your code, the definition of the Density function looks to simply return the scipy.stats.norm.pdf() method. What I found was that running pdf.Density(mean + std) does not yield the same results as running the scipy.stats.norm.pdf() method.

thinkstats2 Module mean, var = 163, 52.8 std = math.sqrt(var) pdf = thinkstats2.NormalPdf(mean, std) pdf.Density(mean + std) yields 0.0333001

scipy.stats scipy.stats.norm.pdf(mean + std) yields 0.0

Am I mistaken that both approaches are the same at the core?

Thanks!