24 public static function distribution($sampleSuccesses, $sampleNumber, $populationSuccesses, $populationNumber)
37 return $e->getMessage();
40 if (($sampleSuccesses < 0) || ($sampleSuccesses > $sampleNumber) || ($sampleSuccesses > $populationSuccesses)) {
43 if (($sampleNumber <= 0) || ($sampleNumber > $populationNumber)) {
46 if (($populationSuccesses <= 0) || ($populationSuccesses > $populationNumber)) {
50 $successesPopulationAndSample = (float) Combinations::withoutRepetition($populationSuccesses, $sampleSuccesses);
51 $numbersPopulationAndSample = (float) Combinations::withoutRepetition($populationNumber, $sampleNumber);
52 $adjustedPopulationAndSample = (float) Combinations::withoutRepetition(
53 $populationNumber - $populationSuccesses,
54 $sampleNumber - $sampleSuccesses
57 return $successesPopulationAndSample * $adjustedPopulationAndSample / $numbersPopulationAndSample;
static validateInt($value)
static distribution($sampleSuccesses, $sampleNumber, $populationSuccesses, $populationNumber)
HYPGEOMDIST.
static flattenSingleValue($value='')
Convert an array to a single scalar value by extracting the first element.