Package org.tinfour.utils
Class BasicTabulator
- java.lang.Object
-
- org.tinfour.utils.BasicTabulator
-
public class BasicTabulator extends Object
Provides methods and elements for tabulating simple statistics for a set of values. This class is suitable for tracking either observations or residuals. It automatically tracks sums and ranges of values for both signed inputs and the absolute value of the inputs. Internally, this class uses the Kahan summation algorithm to provide extended precision when processing a very large number of samples.
-
-
Constructor Summary
Constructors Constructor Description BasicTabulator()Standard constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetMaxAbsValue()Get the maximum value of the signed input samplesdoublegetMaxValue()Get the maximum value of the signed input samplesdoublegetMean()Get the mean of the signed values of the input sample values.doublegetMeanAbsValue()Get the mean of the absolute values of the input sample values.doublegetMinAbsValue()Get the minimum of the signed input valuesdoublegetMinValue()Get the minimum of the signed input valuesintgetNumberNonFiniteSamples()Gets the number of non-finite sample values passed into this instance of the tabulator.intgetNumberSamples()Gets the number of sample values passed into this instance of the tabulator.doublegetStdDev()Get an unbiased estimate of the standard deviation of the population based on the tabulated values (signed values).doublegetStdDevAbsValue()Get an unbiased estimate of the standard deviation of the population based on the tabulated samples.static voidprintCaption(PrintStream ps)Print a header for the summary of tabulator output.voidsummarize(PrintStream ps, String label)Prints a summary of the statistics computed from signed inputs.voidsummarizeAbsValues(PrintStream ps, String label)Prints a summary of the statistics computed from absolute values of the inputs.voidtabulate(double value)Adds the specified value to the running tallies.
-
-
-
Method Detail
-
tabulate
public void tabulate(double value)
Adds the specified value to the running tallies. Internally, both the signed and absolute value equivalents of the input are tracked. Infinite values and Double.NaN are not added to the tally.- Parameters:
value- a valid floating point value, non-finite and NaN's are ignored.
-
getMeanAbsValue
public double getMeanAbsValue()
Get the mean of the absolute values of the input sample values.- Returns:
- a valid floating point number, zero if no input has occurred.
-
getMean
public double getMean()
Get the mean of the signed values of the input sample values.- Returns:
- a valid floating point number, zero if no input has occurred.
-
getStdDevAbsValue
public double getStdDevAbsValue()
Get an unbiased estimate of the standard deviation of the population based on the tabulated samples.- Returns:
- the standard deviation of the absolute values of the inputs, or zero if insufficient data is available.
-
getStdDev
public double getStdDev()
Get an unbiased estimate of the standard deviation of the population based on the tabulated values (signed values).- Returns:
- the standard deviation of the signed values of the inputs, or zero if insufficient data is available.
-
getMinValue
public double getMinValue()
Get the minimum of the signed input values- Returns:
- a valid floating point number
-
getMaxValue
public double getMaxValue()
Get the maximum value of the signed input samples- Returns:
- a valid floating point number
-
getMinAbsValue
public double getMinAbsValue()
Get the minimum of the signed input values- Returns:
- a valid floating point number
-
getMaxAbsValue
public double getMaxAbsValue()
Get the maximum value of the signed input samples- Returns:
- a valid floating point number
-
getNumberSamples
public int getNumberSamples()
Gets the number of sample values passed into this instance of the tabulator.- Returns:
- a positive, potentially zero value.
-
getNumberNonFiniteSamples
public int getNumberNonFiniteSamples()
Gets the number of non-finite sample values passed into this instance of the tabulator.- Returns:
- a positive, potentially zero value.
-
printCaption
public static void printCaption(PrintStream ps)
Print a header for the summary of tabulator output.- Parameters:
ps- a valid instance.
-
summarize
public void summarize(PrintStream ps, String label)
Prints a summary of the statistics computed from signed inputs.- Parameters:
ps- a valid print streamlabel- a label of 25 characters or fewer to be printed in the summary
-
summarizeAbsValues
public void summarizeAbsValues(PrintStream ps, String label)
Prints a summary of the statistics computed from absolute values of the inputs.- Parameters:
ps- a valid print streamlabel- a label of 25 characters or fewer to be printed in the summary
-
-