src/Statistics/Distribution.php
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;
    }
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;
    }
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 ; }
Cumulative frequency distribution

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.

@param array $values Ex: ( A, A, A, A, A, A, B, B, B, C )

@return array cumulative frequency distribution Ex: ( A => 6, B => 9, C => 10 )
Cumulative frequency distribution