NAG CL Interface
s14cqc (beta_incomplete_vector)
1
Purpose
s14cqc computes an array of values for the regularized incomplete beta function and its complement .
2
Specification
void |
s14cqc (Integer n,
const double a[],
const double b[],
const double x[],
double w[],
double w1[],
Integer ivalid[],
NagError *fail) |
|
The function may be called by the names: s14cqc, nag_specfun_beta_incomplete_vector or nag_incomplete_beta_vector.
3
Description
s14cqc evaluates the regularized incomplete beta function
and its complement
in the normalized form, for arrays of arguments
,
and
, for
. The incomplete beta function and its complement are given by
with
- ,
- and ,
- and the beta function is defined as where is the gamma function.
Several methods are used to evaluate the functions depending on the arguments
,
and
. The methods include Wise's asymptotic expansion (see
Wise (1950)) when
, continued fraction derived by
DiDonato and Morris (1992) when
,
, and power series when
or
. When both
and
are large, specifically
,
, the
DiDonato and Morris (1992) asymptotic expansion is employed for greater efficiency.
Once either or is computed, the other is obtained by subtraction from . In order to avoid loss of relative precision in this subtraction, the smaller of and is computed first.
s14cqc is derived from BRATIO in
DiDonato and Morris (1992).
4
References
DiDonato A R and Morris A H (1992) Algorithm 708: Significant digit computation of the incomplete beta function ratios ACM Trans. Math. Software 18 360–373
Wise M E (1950) The incomplete beta function as a contour integral and a quickly converging series for its inverse Biometrika 37 208–218
5
Arguments
-
1:
– Integer
Input
-
On entry: , the number of points.
Constraint:
.
-
2:
– const double
Input
-
On entry:
the argument of the function, for .
Constraint:
, for .
-
3:
– const double
Input
-
On entry:
the argument of the function, for .
Constraints:
- , for ;
- or , for .
-
4:
– const double
Input
-
On entry:
, the upper limit of integration, for .
Constraints:
- , for ;
- or , for ;
- or , for .
-
5:
– double
Output
-
On exit: the values of the incomplete beta function evaluated from zero to .
-
6:
– double
Output
-
On exit: the values of the complement of the incomplete beta function , i.e., the incomplete beta function evaluated from to one.
-
7:
– Integer
Output
-
On exit:
contains the error code for the
th evaluation, for
.
-
No error.
-
.
-
Both .
-
.
-
Both .
-
Both .
-
8:
– NagError *
Input/Output
-
The NAG error argument (see
Section 7 in the Introduction to the NAG Library CL Interface).
6
Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_INT
-
On entry, .
Constraint: .
- NE_INTERNAL_ERROR
-
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
See
Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library CL Interface for further information.
- NW_IVALID
-
On entry, at least one argument had an invalid value.
Check
ivalid for more information.
7
Accuracy
s14cqc is designed to maintain relative accuracy for all arguments. For very tiny results (of the order of machine precision or less) some relative accuracy may be lost – loss of three or four decimal places has been observed in experiments. For other arguments full relative accuracy may be expected.
8
Parallelism and Performance
s14cqc is not threaded in any implementation.
None.
10
Example
This example reads values for each vector argument , and from a file. It then evaluates the function and its complement for each set of values.
10.1
Program Text
10.2
Program Data
10.3
Program Results