MathPHP\Statistics\Distribution::cumulativeFrequency PHP Method

cumulativeFrequency() public static method

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 )
return 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;
    }