RunningStat
PHP implementations of online statistical algorithms
Loading...
Searching...
No Matches
Wikimedia\PSquare Class Reference

Represents a running, online estimate of a p-quantile for a series of observations using the P-squared algorithm. More...

Public Member Functions

 __construct (float $p=0.5)
 
 __serialize ()
 Export state, e.g.
 
 __unserialize (array $data)
 
 getCount ()
 Get the total number of accumulated observations.
 
 addObservation (int|float $x)
 Add an observation.
 
 getValue ()
 Get the estimated p-quantile value.
 

Detailed Description

Represents a running, online estimate of a p-quantile for a series of observations using the P-squared algorithm.

The algorithm is from "The P-Square Algorithm for Dynamic Calculation of Percentiles and Histograms without Storing Observations," Communications of the ACM, October 1985 by R. Jain and I. Chlamtac.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\PSquare::__construct ( float $p = 0.5)
Parameters
float$pthe percentile (defaults to 0.5, or median).

Member Function Documentation

◆ __serialize()

Wikimedia\PSquare::__serialize ( )

Export state, e.g.

for serializing and caching.

Returns
array

◆ addObservation()

Wikimedia\PSquare::addObservation ( int|float $x)

Add an observation.

Parameters
int | float$xValue to add

The documentation for this class was generated from the following file: