# How to fit KDE from existing probability density function values

I am working with options data, and I am using Breeden-Litzenberger formula to derive the risk-neutral terminal stock price PDF. After applying the formula, here is a scatter plot of strike price vs Breeden-Litzenberger pdf: At this stage, I would like to fit KDE using statsmodels.nonparamteric.KDEUnivariate and then use scipy.interpolate.interp1d to obtain a CDF function, ensuring the area under the fitted PDF = 1 etc.

How do I do this with PDF values and not with a sample from the distribution in question? Should I do bootstrapping? Should I fit the CDF with GammaGam to have values > 0 and imposing constraints='monotonic_inc'?

The overall goal is to obtain a CDF function, making sure it is actually statistically correct.

Any input would be appreciated!

• I think sampling from the empirical distribution (basically bootstrapping) and then estimating the KDE would work - not sure as to its theoretical properties though. Nov 4, 2022 at 20:24

From a statistical viewpoint, it is not standard to be in a situation to

1. have a "noisy CDF",
2. sample points from it,
3. deduce another CDF that would be "less noisy".

You can repeat point (2) and (3) to "bootstrap the CDF", but what would it means?

First, you have to know that bootstrap is not magic: it allows to "naively" obtain an unbiased estimate of the variance of an estimator, but nothing more. If you want to obtain quantiles (that is exactly what you aim for, since empirical CDF are made of quantiles), you have to apply some corrections. Efron (the author of bootstrap), has a nice paper on that topic "Bootstrap confidence intervals" by DiCiccio, Thomas J., and Bradley Efron (1996).

Qualitatively, it is clear that if you do not have enough sample points, you cannot obtain better estimates of quantiles, just reusing your points. It is only valid at the asymptotic limit (and if you have an infinity of points, you do not need bootstrap).

Second, starting from a noisy CDF cannot generate sample points that are not noisy. Your best hope is that if you sample "few enough" points, the method you use at point (3) would "regularize" the "secondary" CDF. The truth is that there is no good reason that for, except if the "true, not noisy, underlying CDF" is of the same family as the one use by method of your step (3). For instance, to make it very simple:

• if the underlying CDF is a Gaussian,
• and step (3) is assuming it is a Gaussian, hence it just computes its mean and variance.
• Then of course it may work.

Third, to be very practical, you should keep in mind that you are talking about derivatives, market prices and risk-neutral probabilities: if you change it, it will say something about market price. The cost of modifying your original distribution should be reflected on market prices (i.e. at given strikes), and should not only come from a statistical procedure. For instance you shouldn't modify points are strikes that are heavily traded, because market participants "strongly believe" in them.

• Understood your answer and it makes a lot of sense. I should probably not try to smooth it out since I am interested in whatever the market is implying. Please see the answer to my own question for a follow-up on this. Nov 8, 2022 at 14:00
• The overall goal here is to compare the real world PDF with the risk-neutral PDF. To estimate the risk neutral PDF, I would take a single options snapshot, whereas to estimate the real world PDF, I was thinking of taking ~2 years of historical data. What I am trying to achieve is an analysis of the Radon-Nikodym derivative (risk-neutral PDF / real-world PDF). For example: real world CDF vs risk-neutral CDF of a 0.001 log move. Is this a correct way to compare real world and risk neutral? Is there another way I could estimate the real-world PDF, maybe from the risk-neutral PDF itself? Nov 8, 2022 at 16:18
• you can always compare distribution from a statistical viewpoint (KL divergence, or Chi2 distance, etc), but again: it is probably better to try to do such a comparison from a financial perspective. For instance: what would be the PnL of "arbitraging" the difference between the 2 distributions? this is a clear financial measure. Nov 9, 2022 at 18:21
• by the way @MarcoDiBartolo: if you like my answers, please vote them up (+1) ;{)} Nov 9, 2022 at 18:22