naginterfaces.library.stat.inv_cdf_beta_vector¶
- naginterfaces.library.stat.inv_cdf_beta_vector(tail, p, a, b, tol=0.0)[source]¶
inv_cdf_beta_vector
returns a number of deviates associated with given probabilities of the beta distribution.For full information please refer to the NAG Library document for g01te
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g01/g01tef.html
- Parameters
- tailstr, length 1, array-like, shape
Indicates which tail the supplied probabilities represent. For , for :
The lower tail probability, i.e., .
The upper tail probability, i.e., .
- pfloat, array-like, shape
, the probability of the required beta distribution as defined by .
- afloat, array-like, shape
, the first parameter of the required beta distribution.
- bfloat, array-like, shape
, the second parameter of the required beta distribution.
- tolfloat, optional
The relative accuracy required by you in the results. If
inv_cdf_beta_vector
is entered with greater than or equal to or less than (seemachine.precision
), the value of is used instead.
- Returns
- betafloat, ndarray, shape
, the deviates for the beta distribution.
- ivalidint, ndarray, shape
indicates any errors with the input arguments, with
No error.
On entry, invalid value supplied in when calculating .
On entry, , or, .
On entry, , or, , or, , or, .
The solution has not converged but the result should be a reasonable approximation to the solution.
Requested accuracy not achieved when calculating the beta probability. The result should be a reasonable approximation to the correct solution.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- Warns
- NagAlgorithmicWarning
- (errno )
On entry, at least one value of , , , or was invalid, or the solution failed to converge.
Check for more information.
- Notes
The deviate, , associated with the lower tail probability, , of the beta distribution with parameters and is defined as the solution to
The algorithm is a modified version of the Newton–Raphson method, following closely that of Cran et al. (1977).
An initial approximation, , to is found (see Cran et al. (1977)), and the Newton–Raphson iteration
where is used, with modifications to ensure that remains in the range .
The input arrays to this function are designed to allow maximum flexibility in the supply of vector arguments by re-using elements of any arrays that are shorter than the total number of evaluations required. See the G01 Introduction for further information.
- References
Cran, G W, Martin, K J and Thomas, G E, 1977, Algorithm AS 109. Inverse of the incomplete beta function ratio, Appl. Statist. (26), 111–114
Hastings, N A J and Peacock, J B, 1975, Statistical Distributions, Butterworth