Download the PHP package richjenks/stats without Composer

On this page you can find all versions of the php package richjenks/stats. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package stats

Stats

Statistics library for non-statistical people

Introduction

If you're into statistics then PHP will not be your language of choice (try R 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, however this is not included in PHP by default. If possible, I'd recommend using this extension rather than my stats library.

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

Stats will generally return either a float or an array, whichever is most appropriate for the function

Usage

Mean/Average

Calculates the mean/average of given data:

The average function aliases mean, e.g. Stats::average([1, 2, 3]); also returns 2

Median

Calculates the median (middle value) of given data:

Mode

Calculates the mode(s) — most common value(s) — of given data:

This function always return an array because it is able to handle multi-modal data and an empty array would mean there is no mode

Frequencies

Constructs a sorted array of frequencies for each value in a series:

Range

Determines the range (highest minus lowest) of given data:

Variance & Standard Deviation

These functions calculate:

Individual Deviations

The deviations function is also available if you require the deviations for each individual value, for example:

Sample or Population

Sample is the default mode for Variance and Standard Deviation but if you're unsure of the effect this decision has on your data then you probably don't need it and can skip this section.

Definitions

Population Every subject applicable, e.g. people who wear glasses or non-extinct species of frog

Sample The subset of subjects for which data is available, e.g. 100 glass-wearing subjects or a dozen species of frog

You can optionally pass the constants Stats::Sample or Stats::POPULATION as second parameters to determine whether your data is for a sample or a whole population:

Standard Error of the Mean

Estimates how well the sample mean approximates the population mean:

Quartiles, Interquartile Range & Outliers

These functions calculate the data required to construct a Box Plot which, when you understand what each data point means, is a concise way of displaying and comparing data sets.

Quartiles

Calculates Quartiles 0—4, where:

Interquartile Range

Calculates the range between Q¹ and Q³ (the middle 50% of data):

Outliers

Determines which values in a series are outliers (too far from the other values so sometimes omitted from the data set, possibly due to experimental error):

Inliers

Determines which values in a series are not outliers, i.e. removes outliers:

Whiskers

Determines the lower and upper limit for identifying outliers:

Percentiles

All percentile functions accept an optional additional parameter for rounding that works as follows:

All Percentiles

Determines the percentile of each value:

Single Percentile

Determines the value closest to the given percentile:

Intra-Percentile

Determines the values that fall in the given percentile, i.e. the lowest x% of all values:

CLI

CLI usage is supported via the included scli (Stats Command Line Interface) file and simply expects the name of the required method followed by its arguments:

In cases where the result is a set (i.e. an array) it is presented as comma-separated

Unit Tests


All versions of stats with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package richjenks/stats contains the following files

Loading the files please wait ....