Java org.apache.commons.math.stat.descriptive.moment Variance fields, constructors, methods, implement or subclass

Example usage for Java org.apache.commons.math.stat.descriptive.moment Variance fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for org.apache.commons.math.stat.descriptive.moment Variance.

The text is from its open source code.

Constructor

Variance()
Constructs a Variance with default (true) isBiasCorrected property.
Variance(final SecondMoment m2)
Constructs a Variance based on an external second moment.
Variance(boolean isBiasCorrected)
Constructs a Variance with the specified isBiasCorrected property
Variance(Variance original)
Copy constructor, creates a new Variance identical to the original

Method

doubleevaluate(final double[] values)
Returns the variance of the entries in the input array, or Double.NaN if the array is empty.
doubleevaluate(final double[] values, final double[] weights)

Returns the weighted variance of the entries in the the input array.

Uses the formula

 Σ(weights[i]*(values[i] - weightedMean)2)/(Σ(weights[i]) - 1) 
where weightedMean is the weighted mean

This formula will not return the same result as the unweighted variance when all weights are equal, unless all weights are equal to 1.

doubleevaluate(final double[] values, final double mean)
Returns the variance of the entries in the input array, using the precomputed mean value.
doublegetResult()
voidincrement(final double d)

If all values are available, it is more accurate to use #evaluate(double[]) rather than adding values one at a time using this method and then executing #getResult , since evaluate leverages the fact that is has the full list of values together to execute a two-pass algorithm.

voidincrementAll(double[] values)
This default implementation just calls #increment in a loop over the input array.