0

I have a simple CDF (cumulative distribution function) that I want to estimate using a KDE (kernel density estimation) in order to smooth out the 'steppy' nature of the CDF. The dataset is quite small (40 datapoints), so the steps are quite obvious in the CDF.

I saw that there are functions that do this in R (kCDF) and MatLab (ksdensity, with the option 'cdf'), but I need it in Python.

I tried to estimate the PDF first using scipy.stats.kde.gaussian_kde, and then get the CDF from the PDF, but this introduces a lot of unnecessary error. Ideally, I would like to use a KDE estimator directly over the CDF, would it be possible?

Joe Roe
  • 626
  • 3
  • 12
  • Does this answer your question? [Using scipy gaussian kernel density estimation to calculate CDF inverse](https://stackoverflow.com/questions/47417986/using-scipy-gaussian-kernel-density-estimation-to-calculate-cdf-inverse) – Thulfiqar Mar 19 '21 at 11:17
  • 1
    This has nothing to do with R, or matlab and shouldn't be tagged as such. Also it is off-topic as "looking for recommendation or software". – Oliver Mar 19 '21 at 11:19
  • Did you try with `statsmodels`? https://www.statsmodels.org/stable/examples/notebooks/generated/kernel_density.html#The-KDE-is-a-distribution – Max Pierini Mar 27 '21 at 11:36
  • I'm also looking for the same solution! – Mehdi Jun 18 '21 at 23:00

0 Answers0