HypGeomDist(SuccessfulTrials: Integer; Trials: Integer; SuccessfulInPopulation: Integer; PopulationSize: Integer): Double;
SuccessfulTrials. The number of successful trials in the sample. This value must meet the following restrictions:
SuccessfulTrials > = 0;
SuccessfulTrials < = min(Trials, SuccessfulInPopulation);
SuccessfulTrials > = max(0, Trials - PopulationSize + SuccessfulTrials);
Trials. Sample size. Tolerance range: [0; PopulationSize];
SuccessfulInPopulation. The number of successful trials in general population. Tolerance range: [0; PopulationSize].
PopulationSize. Size of population. This value must meet the following constraint: PopulationSize >= 0.
The HypGeomDist method returns the hypergeometric distribution.
The method returns probability for the specified number of successful trials in a sample, if you have defined the sample size, the number of successful trials in a universal set and the size of the universal set. The function is used to solve problems involving a finite universal set, where each observation is assumed to be a success or a failure and each subset of the specified size can be selected with equal probability. The method is used for samples with no repeats from a finite universal set.
Sub UserProc;
Var
st: Statistics;
d0: Double;
Begin
st := New Statistics.Create;
d0 := st.HypGeomDist(1, 4, 8, 20);
If st.Status <> 0 Then
Debug.WriteLine(st.Errors);
Else
Debug.WriteLine("Distribution: " + d0.ToString);
End If;
End Sub UserProc;
Executing this example shows hypergeometric distribution value in the console window:
Module execution started
Distribution: 0.36326109345456303
Module execution finished
See also: