betaInverseCdf¶
Evaluates the inverse of the beta distribution function.
Synopsis¶
betaInverseCdf (p, pin, qin)
Required Arguments¶
- float
p
(Input) - Probability for which the inverse of the beta distribution function is to
be evaluated. Argument
p
must be in the open interval (0.0 ,1.0). - float
pin
(Input) - First beta distribution parameter. Argument
pin
must be positive. - float
qin
(Input) - Second beta distribution parameter. Argument
qin
must be positive.
Return Value¶
Function betaInverseCdf
evaluates the inverse distribution function of a
beta random variable with parameters pin
and qin
.
Description¶
With P = p
, p = pin
, and q = qin
, function
betaInverseCdf
returns x such that
\[P = \frac{\mathit{\Gamma}(p+q)}{\mathit{\Gamma}(p)\mathit{\Gamma}(q)}
\int_0^x t^{p-1} (1-t)^{q-1} dt\]
where Γ(⋅) is the gamma function. The probability that the random variable takes a value less than or equal to x is P.
Example¶
Suppose X is a beta random variable with parameters 12 and 12. (X has a symmetric distribution.) This example finds the value x such that the probability that X ≤ x is 0.9.
from __future__ import print_function
from numpy import *
from pyimsl.math.betaInverseCdf import betaInverseCdf
pin = 12.0
qin = 12.0
p = 0.9
x = betaInverseCdf(p, pin, qin)
print("X is less than %6.4f with probability 0.9." % (x))
Output¶
X is less than 0.6299 with probability 0.9.