Main Content

betainv

Beta inverse cumulative distribution function

Description

x = betainv(p,a,b) returns the inverse cumulative distribution function (icdf) of the beta distribution with the shape parameters a and b, evaluated at the probability values in p.

example

Examples

collapse all

Compute the inverse cdf (icdf) values evaluated at the probability values in p for the beta distribution with the shape parameters a and b.

p = 0.005:0.01:0.995;
a = 10;
b = 5;
x = betainv(p,a,b);

Plot the icdf.

plot(p,x)
grid on
xlabel("p");
ylabel("x");

Figure contains an axes object. The axes object with xlabel p, ylabel x contains an object of type line.

Input Arguments

collapse all

Probability values at which to evaluate the inverse of the cdf (icdf), specified as a scalar value or an array of scalar values in the range [0,1].

To evaluate the icdf at multiple values, specify p using an array. To evaluate the icdfs of multiple distributions, specify a and b using arrays. If one or more of the input arguments p, a, and b are arrays, then the array sizes must be the same. In this case, betainv expands each scalar input into a constant array of the same size as the array inputs. Each element in x is the icdf value of the distribution specified by the corresponding elements in a and b, evaluated at the corresponding element in p.

Data Types: single | double

First shape parameter, specified as a positive scalar value or an array of positive scalar values.

To evaluate the icdf at multiple values, specify p using an array. To evaluate the icdfs of multiple distributions, specify a and b using arrays. If one or more of the input arguments p, a, and b are arrays, then the array sizes must be the same. In this case, betainv expands each scalar input into a constant array of the same size as the array inputs. Each element in x is the icdf value of the distribution specified by the corresponding elements in a and b, evaluated at the corresponding element in p.

Data Types: single | double

Second shape parameter, specified as a positive scalar value or an array of positive scalar values.

To evaluate the icdf at multiple values, specify p using an array. To evaluate the icdfs of multiple distributions, specify a and b using arrays. If one or more of the input arguments p, a, and b are arrays, then the array sizes must be the same. In this case, betainv expands each scalar input into a constant array of the same size as the array inputs. Each element in x is the icdf value of the distribution specified by the corresponding elements in a and b, evaluated at the corresponding element in p.

Data Types: single | double

Output Arguments

collapse all

Inverse cdf values evaluated at the probabilities in p, returned as a scalar value or an array of scalar values. x is the same size as p, a, and b after any necessary scalar expansion. Each element in x is the inverse cdf value of the distribution specified by the corresponding elements in a and b, evaluated at the corresponding probability in p.

More About

collapse all

Algorithms

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

Alternative Functionality

  • betainv is a function specific to the beta distribution. Statistics and Machine Learning Toolbox™ also offers the generic function icdf, which supports various probability distributions. To use icdf, create a BetaDistribution probability distribution object and pass the object as an input argument or specify the probability distribution name and its parameters. Note that the distribution-specific function betainv is faster than the generic function icdf.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a