nag_prob_non_central_beta_dist (g01gec) (PDF version)
g01 Chapter Contents
g01 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_prob_non_central_beta_dist (g01gec)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_prob_non_central_beta_dist (g01gec) returns the probability associated with the lower tail of the noncentral beta distribution.

2  Specification

#include <nag.h>
#include <nagg01.h>
double  nag_prob_non_central_beta_dist (double x, double a, double b, double lambda, double tol, Integer max_iter, NagError *fail)

3  Description

The lower tail probability for the noncentral beta distribution with parameters a and b and noncentrality parameter λ, PBβ:a,b;λ, is defined by
PBβ:a,b;λ=j=0e-λ/2 λ/2 j! PBβ:a,b;0, (1)
where
PBβ : a,b;0=Γ a+b Γ aΓ b 0βBa- 11-Bb- 1dB,
which is the central beta probability function or incomplete beta function.
Recurrence relationships given in Abramowitz and Stegun (1972) are used to compute the values of PBβ:a,b;0 for each step of the summation (1).
The algorithm is discussed in Lenth (1987).

4  References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Lenth R V (1987) Algorithm AS 226: Computing noncentral beta probabilities Appl. Statist. 36 241–244

5  Arguments

1:     xdoubleInput
On entry: β, the deviate from the beta distribution, for which the probability PBβ:a,b;λ is to be found.
Constraint: 0.0x1.0.
2:     adoubleInput
On entry: a, the first parameter of the required beta distribution.
Constraint: 0.0<a106.
3:     bdoubleInput
On entry: b, the second parameter of the required beta distribution.
Constraint: 0.0<b106.
4:     lambdadoubleInput
On entry: λ, the noncentrality parameter of the required beta distribution.
Constraint: 0.0lambda-2.0logU, where U is the safe range parameter as defined by nag_real_safe_small_number (X02AMC).
5:     toldoubleInput
On entry: the relative accuracy required by you in the results. If nag_prob_non_central_beta_dist (g01gec) is entered with tol greater than or equal to 1.0 or less than 10×machine precision (see nag_machine_precision (X02AJC)), then the value of 10×machine precision is used instead.
See Section 7 for the relationship between tol and max_iter.
6:     max_iterIntegerInput
On entry: the maximum number of iterations that the algorithm should use.
See Section 7 for suggestions as to suitable values for max_iter for different values of the arguments.
Suggested value: 500.
Constraint: max_iter1.
7:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_CONV
The solution has failed to converge in value iterations. Consider increasing max_iter or tol.
NE_INT_ARG_LT
On entry, max_iter=value.
Constraint: max_iter1.
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.
NE_PROB_B_INIT
The required accuracy was not achieved when calculating the initial value of the beta distribution. You should try a larger value of tol. The returned value will be an approximation to the correct value.
NE_PROB_LIMIT
The probability is too close to 0.0 or 1.0 for the algorithm to be able to calculate the required probability. nag_prob_non_central_beta_dist (g01gec) will return 0.0 or 1.0 as appropriate. This should be a reasonable approximation.
NE_REAL_ARG_CONS
On entry, a=value.
Constraint: 0.0<a106.
On entry, b=value.
Constraint: 0.0<b106.
On entry, lambda=value.
Constraint: 0.0lambda-2.0logU, where U is the safe range argument as defined by nag_real_safe_small_number (X02AMC).
On entry, x=value.
Constraint: 0.0x1.0.

7  Accuracy

Convergence is theoretically guaranteed whenever PY>max_itertol where Y has a Poisson distribution with mean λ/2. Excessive round-off errors are possible when the number of iterations used is high and tol is close to machine precision. See Lenth (1987) for further comments on the error bound.

8  Parallelism and Performance

Not applicable.

9  Further Comments

The central beta probabilities can be obtained by setting lambda=0.0.

10  Example

This example reads values for several beta distributions and calculates and prints the lower tail probabilities until the end of data is reached.

10.1  Program Text

Program Text (g01gece.c)

10.2  Program Data

Program Data (g01gece.d)

10.3  Program Results

Program Results (g01gece.r)


nag_prob_non_central_beta_dist (g01gec) (PDF version)
g01 Chapter Contents
g01 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2014