Closed gmrwvu closed 6 years ago
EstimatePdf uses KDE to approximate the PDF based on a sample. It's not a great idea, because the expo distribution is positive valued, and KDE doesn't know that. The result you got is consistent with what I would expect.
Thanks
When I plot a randomly generated exponential distribution, the CDF plots as expected but the PDF only plots as expected once the x value hits the rate. Before that is has a parabolic up trace. I am using Anaconda Python 2.7.17. Here is the code and the resulting graph import random import thinkstats2 import thinkplot sample = [random.expovariate(1.0/50) for i in range(500)] thinkplot.PrePlot(rows=1, cols=2) thinkplot.SubPlot(1) cdf = thinkstats2.Cdf(sample) thinkplot.Cdf(cdf) thinkplot.SubPlot(2) sample_pdf = thinkstats2.EstimatedPdf(sample) thinkplot.Pdf(sample_pdf) thinkplot.Show() Why is there an initial hook to the pdf? Am I doing something wrong?