PHP Class MathPHP\Statistics\Distribution

Mostrar archivo Open project: markrogoyski/math-php

Public Methods

Method Description
cumulativeFrequency ( array $values ) : array Cumulative frequency distribution
cumulativeRelativeFrequency ( array $values ) : array Cumulative relative frequency distribution Cumulative frequency distribution relative to the sample size.
frequency ( array $values ) : array Frequency distribution A table that displays the frequency of various outcomes in a sample.
relativeFrequency ( array $values ) : array Relative frequency distribution Frequency distribution relative to the sample size.
stemAndLeafPlot ( array $values, boolean $print = false ) : array Stem and leaf plot Device for presenting quantitative data in a graphical format, similar to a histogram, to assist in visualizing the shape of a distribution.

Method Details

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 )

cumulativeRelativeFrequency() public static method

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 )
return array cumulative relative frequency distribution Ex: ( A => 0.6, B => 0.9, C => 1 )

frequency() public static method

Each entry in the table contains the frequency or count of the occurrences of values within a particular group or interval. The table summarizes the distribution of values in the sample. https://en.wikipedia.org/wiki/Frequency_distribution The values of the input array will be the keys of the result array. The count of the values will be the value of the result array for that key.
public static frequency ( array $values ) : array
$values array Ex: ( A, A, A, B, B, C )
return array frequency distribution Ex: ( A => 3, B => 2, C => 1 )

relativeFrequency() public static method

Relative Frequency = Frequency / Sample Size The values of the input array will be the keys of the result array. The relative frequency of the values will be the value of the result array for that key.
public static relativeFrequency ( array $values ) : array
$values array Ex: ( A, A, A, A, A, A, B, B, B, C )
return array relative frequency distribution Ex: ( A => 0.6, B => 0.3, C => 0.1 )

stemAndLeafPlot() public static method

https://en.wikipedia.org/wiki/Stem-and-leaf_display Returns an array with the keys as the stems, and the values are arrays containing the leaves. Optional parameter to print the stem and leaf plot. Given input array: [ 44 46 47 49 63 64 66 68 68 72 72 75 76 81 84 88 106 ] Prints: 4 | 4 6 7 9 5 | 6 | 3 4 6 8 8 7 | 2 2 5 6 8 | 1 4 8 9 | 10 | 6
public static stemAndLeafPlot ( array $values, boolean $print = false ) : array
$values array
$print boolean Optional setting to print the distribution
return array keys are the stems, values are the leaves