MathPHP\Statistics\Distribution::cumulativeFrequency PHP 메소드

cumulativeFrequency() 공개 정적인 메소드

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 )
리턴 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;
    }