PHPackages                             richjenks/stats - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. richjenks/stats

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

richjenks/stats
===============

Statistics library for non-statistical people

v1.0(6y ago)23149.0k↓14.7%3[1 issues](https://github.com/richjenks/stats/issues)1MITPHPPHP &gt;=7.2.0

Since Apr 27Pushed 4y ago1 watchersCompare

[ Source](https://github.com/richjenks/stats)[ Packagist](https://packagist.org/packages/richjenks/stats)[ Docs](https://github.com/richjenks/stats)[ RSS](/packages/richjenks-stats/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (1)

Stats
=====

[](#stats)

Statistics library for non-statistical people

- [Introduction](#introduction)
- [Installation](#installation)
- [Quickstart](#quickstart)
- [Usage](#usage)
    - [Mean/Average](#meanaverage)
    - [Median](#median)
    - [Mode](#mode)
    - [Frequencies](#frequencies)
    - [Range](#range)
    - [Variance, Standard Deviation &amp; Standard Error](#variance-standard-deviation--standard-error)
        - [Individual Deviations](#individual-deviations)
        - [Sample or Population](#sample-or-population)
    - [Quartiles, Interquartile Range &amp; Outliers](#quartiles-interquartile-range--outliers)
        - [Quartiles](#quartiles)
        - [Interquartile Range](#interquartile-range)
        - [Outliers](#outliers)
    - [Percentiles](#percentiles)
        - [All Percentiles](#all-percentiles)
        - [Single Percentile](#single-percentile)
        - [In Percentile](#in-percentile)
- [CLI](#cli)
- [Unit Tests](#unit-tests)

Introduction
------------

[](#introduction)

If you're into statistics then PHP will not be your language of choice (try [R](https://www.r-project.org/) instead) but if for any reason you, a non-statistician, need to *do some stats* then this library aims to provide a simple set of methods for common statistical functions.

By design, with the exception of statistical tests, functions generally accept a single series of data at a time. This is to keep the library simple to use

Many of the methods in this library are available from the [Statistics Extension](http://uk1.php.net/manual/en/book.stats.php), however this is not included in PHP by default. If possible, I'd recommend using this extension rather than my stats library.

Installation
------------

[](#installation)

1. Install with Composer: `composer require richjenks/stats`
2. Include autoloader: `require 'vendor/autoload.php';`
3. All static methods are available from the `RichJenks\Stats\Stats` class

Quickstart
----------

[](#quickstart)

```
