mean = sum(x_i) / n
where n
is the number of observations.
To limit numeric errors, the value of the statistic is computed using the following recursive updating algorithm:
m =
the first valuem = m + (new value - m) / (number of observations)
Returns Double.NaN
if the dataset is empty.
Note that this implementation is not synchronized. If multiple threads access an instance of this class concurrently, and at least one of the threads invokes the increment()
or clear()
method, it must be synchronized externally.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|