PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_stat_prob_beta (g01ee)
Purpose
nag_stat_prob_beta (g01ee) computes the upper and lower tail probabilities and the probability density function of the beta distribution with parameters and .
Syntax
Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 23: |
tol was removed from the interface |
Description
The probability density function of the beta distribution with parameters
and
is:
The lower tail probability,
is defined by
The function
, also known as the incomplete beta function is calculated using
nag_specfun_beta_incomplete (s14cc).
References
Hastings N A J and Peacock J B (1975) Statistical Distributions Butterworth
Parameters
Compulsory Input Parameters
- 1:
– double scalar
-
, the value of the beta variate.
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
None.
Output Parameters
- 1:
– double scalar
-
The lower tail probability, .
- 2:
– double scalar
-
The upper tail probability, .
- 3:
– double scalar
-
The probability density function, .
- 4:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Note: nag_stat_prob_beta (g01ee) may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the function:
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
-
x is too far out into the tails for the probability to be evaluated exactly. The results returned are
and
as appropriate. These should be a good approximation to the required solution.
-
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 accuracy is limited by the error in the incomplete beta function. See
Accuracy in
nag_specfun_beta_incomplete (s14cc) for further details.
Further Comments
None.
Example
This example reads values from a number of beta distributions and computes the associated upper and lower tail probabilities and the corresponding value of the probability density function.
Open in the MATLAB editor:
g01ee_example
function g01ee_example
fprintf('g01ee example results\n\n');
x = [0.25; 0.75; 0.50];
a = [1.00; 1.50; 2.00];
b = [2.00; 1.50; 1.00];
fprintf(' x a b p q pdf\n');
for j = 1:numel(x)
[p, q, pdf, ifail] = g01ee( ...
x(j), a(j), b(j));
fprintf('%8.4f', x(j), a(j), b(j), p, q, pdf);
fprintf('\n')
end
g01ee example results
x a b p q pdf
0.2500 1.0000 2.0000 0.4375 0.5625 1.5000
0.7500 1.5000 1.5000 0.8045 0.1955 1.1027
0.5000 2.0000 1.0000 0.2500 0.7500 1.0000
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015