statistics.NormalDist.inv_cdf

Full name
statistics.NormalDist.inv_cdf
Library
statistics
Syntax

statistics.NormalDist.inv_cdf(p)

Description

The inv_cdf ("Inverse Cumulative Distribution Function") method of an object of type statistics.NormalDist returns the inverse cumulative distribution function, also known as the quantile function or the percent-point function. That is, it returns the value of the random variable for which the probability that the variable is less than or equal to said value matches the value passed as an argument.

Parameters
  • p: Probability of the distribution. It should be a real value in the open interval (0, 1).
Result

The statistics.NormalDist.inv_cdf method returns a value of type float.

Examples

If we start from the following normal distribution:

dist = statistics.NormalDist(mu = 5, sigma = 2)

...we can obtain the value for which the probability that the variable takes a value equal to or less than it is equal to 0.8 with the following code:

value = dist.inv_cdf(p = 0.8)
value
6.683242467145829

Indeed:

dist.cdf(x = value)
0.8
Submitted by admin on Tue, 04/20/2021 - 08:22