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

cumulativeRelativeFrequency() 공개 정적인 메소드

Cumulative relative frequency = cumulative frequency / sample size 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 cumulativeRelativeFrequency ( array $values ) : array
$values array Ex: ( A, A, A, A, A, A, B, B, B, C )
리턴 array cumulative relative frequency distribution Ex: ( A => 0.6, B => 0.9, C => 1 )
    public static function cumulativeRelativeFrequency(array $values) : array
    {
        $sample_size = count($values);
        $cumulative_frequencies = self::cumulativeFrequency($values);
        return array_map(function ($frequency) use($sample_size) {
            return $frequency / $sample_size;
        }, $cumulative_frequencies);
    }