Disclaimer: Auto generated file.
Please help us setting parameters to useful values and extending the examples.
/**
* Constructor
*
* @param integer $scale number of decimals
* @param integer $exceptions How to manage missing, null, N/A & not numeric. Stats::MISSING_ Stats::NA_ default Asume 0.00
* @return void
*/
/*
$stats = new Stats(integer $scale = 8, integer $exceptions = 8);
*/
$stats = new Stats();
- $stats->pushArray(array $valuesArray) : Stats
/**
* Caclulate stats for values in array
*
* @param array $valuesArray [val1, val2, ...]
* @return Stats object this
*/
-
$stats->pushArray(['a' => '1', 'b' => '2', 'c' => 3]);
->
Array
(
[min] => 1
[avg] => 2.00000000
[max] => 3
[count] => 3
[sum] => 6
[variance] => 1.00000000
[stdDev] => 1.00000000
[cv] => 50.00000000
[skewness] => 0.00000000
[kurtosis] => -1.50000000
)
- $stats->push(string|int $x) : void
/**
* Add a value to caclulate
*
* @param string|int $x
* @return void
*/
- $stats->push(3);"
- $stats->count() : string|int
/**
* Return count or n elements processed
*
* @return string|int number of items calculated
*/
- $stats->count(); -> 4
- $stats->min() : string
/**
* Minimum value encountered
*
* @return string bcmath number
*/
- $stats->min(); -> 1
- $stats->avg() : string
/**
* Average, mean, of calculated values
*
* @return string bcmath number
*/
- $stats->avg(); -> 2.25000000
- $stats->max() : string
/**
* Maximum value encountered
*
* @return string bcmath number
*/
- $stats->max(); -> 3
- $stats->sum() : string
/**
* Sum or total of cacluated values
*
* @return string bcmath number
*/
- $stats->sum(); -> 9
- $stats->variance() : string
/**
* Varaince
*
* @return string bcmath number
*/
- $stats->variance(); -> 0.91666666
- $stats->stdDev() : string
/**
* Standard deviation
*
* @return string bcmath number
*/
- $stats->stdDev(); -> 0.95742710
- $stats->skewness() :
/**
* Skewness
*
* Characterizes the degree of asymmetry of a distribution around its mean.
* [-0.5, 0.5] aprox symetric, [0.5,1],[-0.5,-1] moderatly, else highly
* Positive skewness indicates a distribution with an asymmetric tail extending toward more positive values.
* Negative skewness indicates a distribution with an asymmetric tail extending toward more negative values.
*
* Skewness, has several estimators see:
* https://www.researchgate.net/post/Is_there_any_difference_in_formula_when_calculating_Skewness_manually_and_using_SPSS_software
*
*/
-
$stats->skewness();
->
-0.49338220 - $stats->kurtosis() : string
/**
* Kurtosis
*
* Characterizes the relative peakedness or flatness of a distribution compared with the normal distribution.
* Positive kurtosis indicates a relatively peaked distribution.
* Negative kurtosis indicates a relatively flat distribution.
*
* A normal distribution has kurtosis exactly 3 (excess kurtosis exactly 0). Any distribution with kurtosis ≈3 (excess ≈0) is called mesokurtic.
* A distribution with kurtosis <3 (excess kurtosis <0) is called platykurtic. Compared to a normal distribution, its tails are shorter and thinner, and often its central peak is lower and broader.
* A distribution with kurtosis >3 (excess kurtosis >0) is called leptokurtic. Compared to a normal distribution, its tails are longer and fatter, and often its central peak is higher and sharper.
*
* @return string bcmath number
*/
- $stats->kurtosis(); -> -1.37190083
- $stats->cv() : string
/**
* Coefficient of Variation (cv) stdDev/Avg * 100
*
* @return string bcmath number
*/
- $stats->cv(); -> 42.55231500
- $stats->stats() : array
/**
* Returns basci statistics on calculated values
*
* @return array ['min'=>1,'avg'=>1,'max'=>1,'count'=>1,'sum'=1,'variance'=>1,'stdDev'=>1,'skewness'=>1,'kurtosis'=>1]
*/
-
$stats->stats();
->
Array
(
[min] => 1
[avg] => 2.25000000
[max] => 3
[count] => 4
[sum] => 9
[variance] => 0.91666666
[stdDev] => 0.95742710
[cv] => 42.55231500
[skewness] => -0.49338220
[kurtosis] => -1.37190083
)
|