[SciPy-User] scipy.stats.gaussian_kde ppf?

josef.pktd at gmail.com josef.pktd at gmail.com
Thu Aug 30 13:17:54 EDT 2012


On Thu, Aug 30, 2012 at 12:35 PM, Robert Kern <robert.kern at gmail.com> wrote:
> On Thu, Aug 30, 2012 at 5:15 PM,  <josef.pktd at gmail.com> wrote:
>> On Thu, Aug 30, 2012 at 12:41 AM, Serge Rogov <SergeRogov at minifab.com.au> wrote:
>>> Hi all,
>>>
>>> I need to compute confidence intervals from gaussian_kde, but I found that
>>> the ppf function is missing. I have implemented my own naïve version that
>>> precomputes the cdf for the kde and then performs a search for the desired
>>> probability, but it’s extremely slow and shows a bit of error when compared
>>> to norm.ppf even at large sample sizes. Has anyone had to do something like
>>> this before?
>>
>> I've never seen a ppf for a kde.
>>
>> gaussian_kde is multivariate, and I don't know if there is a
>> definition of ppf for multivariate distributions.
>>
>> My guess is that there is nothing better than 2 rootfinding calls to
>> find the confidence interval for 1d (maybe with norm.ppf as starting
>> values if the distribution is approximately normal)
>
> You can invert the empirical CDF for a nicer starting value,
> regardless of distribution.

good idea,
or even with a linear interpolation of the inverse empirical cdf,
which might already be in statsmodels.

Josef

>
> --
> Robert Kern
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user



More information about the SciPy-User mailing list