RunningStat
PHP implementations of online statistical algorithms
|
Represents a running, online estimate of a p-quantile for a series of observations using the P-squared algorithm. More...
Public Member Functions | |
__construct ( $p=0.5) | |
__serialize () | |
Export state, e.g. | |
__unserialize (array $data) | |
getCount () | |
Get the total number of accumulated observations. | |
addObservation ( $x) | |
Add an observation. | |
getValue () | |
Get the estimated p-quantile value. | |
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.
Wikimedia\PSquare::__construct | ( | $p = 0.5 | ) |
float | $p | the percentile (defaults to 0.5, or median). |
Wikimedia\PSquare::__serialize | ( | ) |
Export state, e.g.
for serializing and caching.
Wikimedia\PSquare::__unserialize | ( | array | $data | ) |
array | $data |
Wikimedia\PSquare::addObservation | ( | $x | ) |
Add an observation.
int | float | $x | Value to add |
Wikimedia\PSquare::getCount | ( | ) |
Get the total number of accumulated observations.
Wikimedia\PSquare::getValue | ( | ) |
Get the estimated p-quantile value.