Package uk.ac.starlink.ttools.filter
Class UnivariateStats
- java.lang.Object
-
- uk.ac.starlink.ttools.filter.UnivariateStats
-
public abstract class UnivariateStats extends java.lang.Object
Calculates univariate statistics for a variable. Feed data to an instance of this object by repeatedly callingacceptDatum(java.lang.Object)
and then call the various accessor methods to get accumulated values.- Since:
- 27 Apr 2006
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description UnivariateStats()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
acceptDatum(java.lang.Object value)
Submits a single value to the statistics accumulator.static UnivariateStats
createStats(java.lang.Class<?> clazz)
Factory method to construct an instance of this class for accumulating particular types of values.abstract long
getCount()
Returns the number of good (non-null) values accumulated.abstract java.lang.Number
getMaximum()
Returns the numeric maximum value submitted.abstract long
getMaxPos()
Returns the sequence number of the maximum value submitted.abstract java.lang.Number
getMinimum()
Returns the numeric minimum value submitted.abstract long
getMinPos()
Returns the sequence number of the minimum value submitted.abstract double
getSum()
Returns the numeric sum of values accumulated.abstract double
getSum2()
Returns the sum of squares of values accumulated.abstract double
getSum3()
Returns the sum of cubes of values accumulated.abstract double
getSum4()
Returns the sum of fourth powers of values accumulated.
-
-
-
Method Detail
-
acceptDatum
public abstract void acceptDatum(java.lang.Object value)
Submits a single value to the statistics accumulator. The submitted value should be of a type compatible with the class type of this Stats object.- Parameters:
value
- value object
-
getCount
public abstract long getCount()
Returns the number of good (non-null) values accumulated.- Returns:
- good value count
-
getSum
public abstract double getSum()
Returns the numeric sum of values accumulated.- Returns:
- sum of values
-
getSum2
public abstract double getSum2()
Returns the sum of squares of values accumulated.- Returns:
- sum of squared values
-
getSum3
public abstract double getSum3()
Returns the sum of cubes of values accumulated.- Returns:
- sum of cubed values
-
getSum4
public abstract double getSum4()
Returns the sum of fourth powers of values accumulated.- Returns:
- sum of fourth powers
-
getMinimum
public abstract java.lang.Number getMinimum()
Returns the numeric minimum value submitted.- Returns:
- minimum
-
getMaximum
public abstract java.lang.Number getMaximum()
Returns the numeric maximum value submitted.- Returns:
- maximum
-
getMinPos
public abstract long getMinPos()
Returns the sequence number of the minimum value submitted. Returns -1 if there is no minimum.- Returns:
- row index of minimum
-
getMaxPos
public abstract long getMaxPos()
Returns the sequence number of the maximum value submitted. Returns -1 if there is no maximum.- Returns:
- row index of maximum
-
createStats
public static UnivariateStats createStats(java.lang.Class<?> clazz)
Factory method to construct an instance of this class for accumulating particular types of values.- Parameters:
clazz
- class of which all submitted values will be instances of (if they're not null)
-
-