magaras/pstats

Library that contains statistical methods.

1.2.1 2022-09-17 16:49 UTC

This package is not auto-updated.

Last update: 2024-05-12 00:27:25 UTC


README

Build Status

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);