Class VarPAggregator<V extends Number>

java.lang.Object
org.apache.derby.impl.sql.execute.VarPAggregator<V>
All Implemented Interfaces:
Externalizable, Serializable, Aggregator<V,Double,VarPAggregator<V>>
Direct Known Subclasses:
StdDevPAggregator, VarSAggregator

public class VarPAggregator<V extends Number> extends Object implements Aggregator<V,Double,VarPAggregator<V>>, Externalizable

This class implements the SQL Standard VAR_POP() aggregator, computing a population's variance. It uses the IBM formula described here:


 sum(xi2)/n - m2
 
 where
 
 n is the number of items in the population
 m is the population average
 x1 ... xn are the items in the population
 

The IBM formula can be computed without buffering up an arbitrarily long list of items. The IBM formula is algebraically equivalent to the textbook formula for population variance:


 sum( (xi - m)2 )/n
 
See Also: