public class Stats extends Object implements Serializable, RevisionHandler
Modifier and Type | Field and Description |
---|---|
double |
count
The number of values seen
|
double |
max
The maximum value seen, or Double.NaN if no values seen
|
double |
mean
The mean of values at the last calculateDerived() call
|
double |
min
The minimum value seen, or Double.NaN if no values seen
|
double |
stdDev
The std deviation of values at the last calculateDerived() call
|
double |
sum
The sum of values seen
|
double |
sumSq
The sum of values squared seen
|
Constructor and Description |
---|
Stats() |
Modifier and Type | Method and Description |
---|---|
void |
add(double value)
Adds a value to the observed values
|
void |
add(double value,
double n)
Adds a value that has been seen n times to the observed values
|
void |
calculateDerived()
Tells the object to calculate any statistics that don't have their
values automatically updated during add.
|
String |
getRevision()
Returns the revision string.
|
static void |
main(String[] args)
Tests the paired stats object from the command line.
|
void |
subtract(double value)
Removes a value to the observed values (no checking is done
that the value being removed was actually added).
|
void |
subtract(double value,
double n)
Subtracts a value that has been seen n times from the observed values
|
String |
toString()
Returns a string summarising the stats so far.
|
public double count
public double sum
public double sumSq
public double stdDev
public double mean
public double min
public double max
public void add(double value)
value
- the observed valuepublic void add(double value, double n)
value
- the observed valuen
- the number of times to add valuepublic void subtract(double value)
value
- the observed valuepublic void subtract(double value, double n)
value
- the observed valuen
- the number of times to subtract valuepublic void calculateDerived()
public String toString()
public String getRevision()
getRevision
in interface RevisionHandler
public static void main(String[] args)
args
- ignored.Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.