# betainv

Beta inverse cumulative distribution function

## Syntax

X = betainv(P,A,B)

## Description

X = betainv(P,A,B) computes the inverse of the beta cdf with parameters specified by A and B for the corresponding probabilities in P. P, A, and B can be vectors, matrices, or multidimensional arrays that are all the same size. A scalar input is expanded to a constant array with the same dimensions as the other inputs. The parameters in A and B must all be positive, and the values in P must lie on the interval [0, 1].

The inverse beta cdf for a given probability p and a given pair of parameters a and b is

$x={F}^{-1}\left(p|a,b\right)=\left\{x:F\left(x|a,b\right)=p\right\}$

where

$p=F\left(x|a,b\right)=\frac{1}{B\left(a,b\right)}\underset{0}{\overset{x}{\int }}{t}^{a-1}{\left(1-t\right)}^{b-1}dt$

and B( · ) is the Beta function. Each element of output X is the value whose cumulative probability under the beta cdf defined by the corresponding parameters in A and B is specified by the corresponding value in P.

## Examples

p = [0.01 0.5 0.99];
x = betainv(p,10,5)
x =
0.3726  0.6742  0.8981

According to this result, for a beta cdf with a = 10 and b = 5, a value less than or equal to 0.3726 occurs with probability 0.01. Similarly, values less than or equal to 0.6742 and 0.8981 occur with respective probabilities 0.5 and 0.99.

## Algorithms

The betainv function uses Newton's method with modifications to constrain steps to the allowable range for x, i.e., [0 1].