Package ch.idsia.utils.statistics
Class StatisticalSummary
java.lang.Object
ch.idsia.utils.statistics.StatisticalSummary
- All Implemented Interfaces:
java.io.Serializable
public class StatisticalSummary
extends java.lang.Object
implements java.io.Serializable
This class is used to model the statistics
of a fix of numbers. For the statistics
we choose here it is not necessary to store
all the numbers - just keeping a running total
of how many, the sum and the sum of the squares
is sufficient (plus max and min, for max and min).
Warning: the geometric mean calculation is only valid if all numbers
added to the summary are positive (>0) - no warnings
are given if this is not the case - you'll just get a wrong answer
for the gm() !!!
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStatisticalSummary.Watch -
Field Summary
Fields Modifier and Type Field Description java.lang.StringnameStatisticalSummary.Watchwatch -
Constructor Summary
Constructors Constructor Description StatisticalSummary()StatisticalSummary(java.lang.String name) -
Method Summary
Modifier and Type Method Description voidadd(double d)voidadd(double[] d)voidadd(StatisticalSummary ss)voidadd(java.lang.Number n)voidadd(java.util.Vector<java.lang.Number> v)doublegm()static StatisticalSummaryload(java.lang.String path)static voidmain(java.lang.String[] args)doublemax()doublemean()doublemin()intn()voidreset()voidsave(java.lang.String path)doublesd()static doublesigDiff(StatisticalSummary s1, StatisticalSummary s2)doublestdErr()doublesumSquareDiff()returns the sum of the squares of the differences between the mean and the ith valuesjava.lang.StringtoString()
-
Field Details
-
Constructor Details
-
StatisticalSummary
public StatisticalSummary() -
StatisticalSummary
public StatisticalSummary(java.lang.String name)
-
-
Method Details
-
reset
public final void reset() -
max
public double max() -
min
public double min() -
mean
public double mean() -
gm
public double gm() -
sigDiff
-
sumSquareDiff
public double sumSquareDiff()returns the sum of the squares of the differences between the mean and the ith values -
sd
public double sd() -
n
public int n() -
stdErr
public double stdErr() -
add
-
add
public void add(double d) -
add
public void add(java.lang.Number n) -
add
public void add(double[] d) -
add
public void add(java.util.Vector<java.lang.Number> v) -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
save
public void save(java.lang.String path) -
load
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-