MathPHP\Statistics\Distribution::cumulativeFrequency PHP Méthode

cumulativeFrequency() public static méthode

The values of the input array will be the keys of the result array. The cumulative frequency of the values will be the value of the result array for that key.
public static cumulativeFrequency ( array $values ) : array
$values array Ex: ( A, A, A, A, A, A, B, B, B, C )
Résultat array cumulative frequency distribution Ex: ( A => 6, B => 9, C => 10 )
    public static function cumulativeFrequency(array $values) : array
    {
        $running_total = 0;
        $cumulative_frequencies = array();
        foreach (self::frequency($values) as $value => $frequency) {
            $running_total += $frequency;
            $cumulative_frequencies[$value] = $running_total;
        }
        return $cumulative_frequencies;
    }