PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_stat_inv_cdf_beta (g01fe)
Purpose
nag_stat_inv_cdf_beta (g01fe) returns the deviate associated with the given lower tail probability of the beta distribution.
Syntax
Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 23: |
tol was made optional (default 0) |
Description
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
.
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
Parameters
Compulsory Input Parameters
- 1:
– double scalar
-
, the lower tail probability from the required beta distribution.
Constraint:
.
- 2:
– double scalar
-
, the first parameter of the required beta distribution.
Constraint:
.
- 3:
– double scalar
-
, the second parameter of the required beta distribution.
Constraint:
.
Optional Input Parameters
- 1:
– double scalar
Default:
The relative accuracy required by you in the result. If
nag_stat_inv_cdf_beta (g01fe) is entered with
tol greater than or equal to
or less than
(see
nag_machine_precision (x02aj)), then the value of
is used instead.
Output Parameters
- 1:
– double scalar
The result of the function.
- 2:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Note: nag_stat_inv_cdf_beta (g01fe) may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the function:
If on exit or , then nag_stat_inv_cdf_beta (g01fe) returns .
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
-
-
-
On entry, | , |
or | , |
or | , |
or | . |
- W
-
There is doubt concerning the accuracy of the computed result.
iterations of the Newton–Raphson method have been performed without satisfying the accuracy criterion (see
Accuracy). The result should be a reasonable approximation of the solution.
- W
-
Requested accuracy not achieved when calculating beta probability. The result should be a reasonable approximation to the correct solution. You should try setting
tol larger.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
The required precision, given by
tol, should be achieved in most circumstances.
Further Comments
The typical timing will be several times that of
nag_stat_prob_beta (g01ee) and will be very dependent on the input argument values. See
nag_stat_prob_beta (g01ee) for further comments on timings.
Example
This example reads lower tail probabilities for several beta distributions and calculates and prints the corresponding deviates until the end of data is reached.
Open in the MATLAB editor:
g01fe_example
function g01fe_example
fprintf('g01fe example results\n\n');
p = [ 0.50 0.99 0.25];
a = [ 1.0 1.5 20.0 ];
b = [ 2.0 1.5 10.0 ];
dev = p;
fprintf(' p a b deviate\n');
for j = 1:numel(p)
[dev(j), ifail] = g01fe( ...
p(j), a(j), b(j));
end
fprintf('%8.3f%8.3f%8.3f%8.3f\n', [p; a; b; dev]);
g01fe example results
p a b deviate
0.500 1.000 2.000 0.293
0.990 1.500 1.500 0.967
0.250 20.000 10.000 0.611
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015