magaras / pstats
Library that contains statistical methods.
Installs: 4 326
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^5.4.0 || ^7.0
- phpunit/phpunit: *
Requires (Dev)
This package is not auto-updated.
Last update: 2024-05-12 00:27:25 UTC
README
A PHP library containing a lot of statistical methods, from the most usefull ones (like mean and variance) to even some more sophisticated, like moving average and outliers around median.
I intend to keep updating this library in order for it to be as thorough as possible.
Install with composer composer require magaras/pstats
.
The library supports the following methods:
Mean
Basic::mean($data);
** Median**
Basic::median($data);
Mode
Basic::mode($data);
Range
Basic::range($data);
Percentage Change
Basic::percentageChange($start_value, $end_value);
Percentage Difference
Basic::percentageDifference($start_value, $end_value);
Absolute Error
Error::absoluteError(0, 0);
Mean Absolute Error
Error::mae($actuals, $predictions);
Mean Square Error
Error::mse($actuals, $predictions);
Variance (population / sample)
Error::variance($data, true); Error::variance($data, false);
Std
Error::std($data);
Absolute / Relative / Cumulative Frequency for continuous values
$frequency_classes = Frequency::frequencyContinuous($data); $frequency_classes[$i]->absolute_frequency $frequency_classes[$i]->relative_frequency $frequency_classes[$i]->cumulative_frequency
Absolute / Relative / Cumulative Frequency for discrete values
$frequency_classes = Frequency::frequencyDiscrete($data); $frequency_classes[$i]->absolute_frequency $frequency_classes[$i]->relative_frequency $frequency_classes[$i]->cumulative_frequency
Simple Moving Average
MovingAverage::simpleMovingAverage($moving_average_value, $data);
Exponential Moving Average
MovingAverage::exponentialMovingAverage(moving_average_value, $data);
Outliers Around Mean
Outliers::outlierAroundMean($data);
Outliers Around Median
Outliers::outlierAroundMedian($data);