bundles / scipy latest / scipy / stats / _probability_distribution / _ProbabilityDistribution / icdf
function
scipy.stats._probability_distribution:_ProbabilityDistribution.icdf
Signature
def icdf ( self , p , / , method ) Summary
Inverse of the cumulative distribution function.
Extended Summary
For monotonic continuous distributions, the inverse of the cumulative distribution function ("inverse CDF"), denoted , is the argument for which the cumulative distribution function evaluates to .
When a strict "inverse" of the cumulative distribution function does not exist (e.g. discrete random variables), the "inverse CDF" is defined by convention as the smallest value within the support for which is at least .
icdf accepts p for .
Parameters
p: array_likeThe argument of the inverse CDF.
method: {None, 'formula', 'complement', 'inversion'}The strategy used to evaluate the inverse CDF. By default (
None), the infrastructure chooses between the following options, listed in order of precedence.'formula': use a formula for the inverse CDF itself'complement': evaluate the inverse CCDF at the complement ofp'inversion': solve numerically for the argument at which the CDF is equal top
Not all
methodoptions are available for all distributions. If the selectedmethodis not available, aNotImplementedErrorwill be raised.
Returns
out: arrayThe inverse CDF evaluated at the provided argument.
Notes
Suppose a probability distribution has support . The inverse CDF returns its minimum value of at and its maximum value of at . Because the CDF has range , the inverse CDF is only defined on the domain ; for and , icdf returns nan.
The inverse CDF is also known as the quantile function, percentile function, and percent-point function.
Examples
Instantiate a distribution with the desired parameters:import numpy as np from scipy import stats X = stats.Uniform(a=-0.5, b=0.5)✓
X.icdf(0.25)
✗np.allclose(X.cdf(X.icdf(0.25)), 0.25)
✓X.icdf([-0.1, 0, 1, 1.1])
✓See also
Aliases
-
scipy.stats._distribution_infrastructure._ProbabilityDistribution.icdf