1
{ ******************************************************************
2
Probability functions related to the incomplete Beta function
3
****************************************************************** }
10
utypes, umath, uibeta;
12
function FBeta(A, B, X : Float) : Float;
13
{ Cumulative probability for Beta distrib. with param. A and B }
15
function FBinom(N : Integer; P : Float; K : Integer) : Float;
16
{ Cumulative probability for binomial distrib. }
18
function FStudent(Nu : Integer; X : Float) : Float;
19
{ Cumulative probability for Student distrib. with Nu d.o.f. }
21
function PStudent(Nu : Integer; X : Float) : Float;
22
{ Prob(|t| > X) for Student distrib. with Nu d.o.f. }
24
function FSnedecor(Nu1, Nu2 : Integer; X : Float) : Float;
25
{ Cumulative prob. for Fisher-Snedecor distrib. with Nu1 and Nu2 d.o.f. }
27
function PSnedecor(Nu1, Nu2 : Integer; X : Float) : Float;
28
{ Prob(F > X) for Fisher-Snedecor distrib. with Nu1 and Nu2 d.o.f. }
32
function FBeta(A, B, X : Float) : Float;
34
FBeta := IBeta(A, B, X);
37
function FBinom(N : Integer; P : Float; K : Integer) : Float;
39
if (P < 0.0) or (P > 1.0) or (N <= 0) or (N < K) then
40
FBinom := DefaultVal(FDomain, 0.0)
42
FBinom := DefaultVal(FOk, Power(1.0 - P, N))
44
FBinom := DefaultVal(FOk, 1.0)
46
FBinom := 1.0 - IBeta(K + 1, N - K, P);
49
function FStudent(Nu : Integer; X : Float) : Float;
54
FStudent := DefaultVal(FDomain, 0.0)
56
FStudent := DefaultVal(FOk, 0.5)
59
F := 0.5 * IBeta(0.5 * Nu, 0.5, Nu / (Nu + X * X));
60
if X < 0.0 then FStudent := F else FStudent := 1.0 - F;
64
function PStudent(Nu : Integer; X : Float) : Float;
67
PStudent := DefaultVal(FDomain, 0.0)
69
PStudent := IBeta(0.5 * Nu, 0.5, Nu / (Nu + X * X));
72
function FSnedecor(Nu1, Nu2 : Integer; X : Float) : Float;
74
if (Nu1 < 1) or (Nu2 < 1) or (X <= 0) then
75
FSnedecor := DefaultVal(FDomain, 0.0)
77
FSnedecor := 1.0 - IBeta(0.5 * Nu2, 0.5 * Nu1, Nu2 / (Nu2 + Nu1 * X));
80
function PSnedecor(Nu1, Nu2 : Integer; X : Float) : Float;
82
if (Nu1 < 1) or (Nu2 < 1) or (X <= 0) then
83
PSnedecor := DefaultVal(FDomain, 0.0)
85
PSnedecor := IBeta(0.5 * Nu2, 0.5 * Nu1, Nu2 / (Nu2 + Nu1 * X));
b'\\ No newline at end of file'