ppf_hat — SciPy v1.15.3 Manual (original) (raw)

scipy.stats.sampling.TransformedDensityRejection.

TransformedDensityRejection.ppf_hat(u)#

Evaluate the inverse of the CDF of the hat distribution at u.

Parameters:

uarray_like

An array of percentiles

Returns:

ppf_hatarray_like

Array of quantiles corresponding to the given percentiles.

Examples

from scipy.stats.sampling import TransformedDensityRejection from scipy.stats import norm import numpy as np from math import exp

class MyDist: ... def pdf(self, x): ... return exp(-0.5 * x2) ... def dpdf(self, x): ... return -x * exp(-0.5 * x2) ... dist = MyDist() rng = TransformedDensityRejection(dist)

rng.ppf_hat(0.5) -0.00018050266342393984 norm.ppf(0.5) 0.0 u = np.linspace(0, 1, num=1000) ppf_hat = rng.ppf_hat(u)