[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/libs/ -> RunningStat.php (summary)

Compute running mean, variance, and extrema of a stream of numbers. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 176 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

RunningStat:: (6 methods):
  count()
  push()
  getMean()
  getVariance()
  getStdDev()
  merge()


Class: RunningStat  - X-Ref

Represents a running summary of a stream of numbers.

RunningStat instances are accumulator-like objects that provide a set of
continuously-updated summary statistics for a stream of numbers, without
requiring that each value be stored. The measures it provides are the
arithmetic mean, variance, standard deviation, and extrema (min and max);
together they describe the central tendency and statistical dispersion of a
set of values.

One RunningStat instance can be merged into another; the resultant
RunningStat has the state it would have had if it had accumulated each
individual point. This allows data to be summarized in parallel and in
stages without loss of fidelity.

Based on a C++ implementation by John D. Cook:
<http://www.johndcook.com/standard_deviation.html>
<http://www.johndcook.com/skewness_kurtosis.html>

The in-line documentation for this class incorporates content from the
English Wikipedia articles "Variance", "Algorithms for calculating
variance", and "Standard deviation".

count()   X-Ref
Count the number of accumulated values.

return: int Number of values

push( $x )   X-Ref
Add a number to the data set.

param: int|float $x Value to add

getMean()   X-Ref
Get the mean, or expected value.

The arithmetic mean is the sum of all measurements divided by the number
of observations in the data set.

return: float Mean

getVariance()   X-Ref
Get the estimated variance.

Variance measures how far a set of numbers is spread out. A small
variance indicates that the data points tend to be very close to the
mean (and hence to each other), while a high variance indicates that the
data points are very spread out from the mean and from each other.

return: float Estimated variance

getStdDev()   X-Ref
Get the estimated stanard deviation.

The standard deviation of a statistical population is the square root of
its variance. It shows shows how much variation from the mean exists. In
addition to expressing the variability of a population, the standard
deviation is commonly used to measure confidence in statistical conclusions.

return: float Estimated standard deviation

merge( RunningStat $other )   X-Ref
Merge another RunningStat instance into this instance.

This instance then has the state it would have had if all the data had
been accumulated by it alone.

param: RunningStat RunningStat instance to merge into this one



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1