shared
Class StatData

java.lang.Object
  |
  +--shared.StatData

public class StatData
extends java.lang.Object

StatData is a class for doing statistical computations.


Field Summary
static int CLASS_ACC_DATA
          Deprecated. Use Java's instanceOf() function instead of class_id().
static int CLASS_ERROR_DATA
          Deprecated. Use Java's instanceOf() function instead of class_id().
static int CLASS_STAT_DATA
          Deprecated. Use Java's instanceOf() function instead of class_id().
static int STAT_DATA_ID_BASE
          Deprecated. Use Java's instanceOf() function instead of class_id().
 
Constructor Summary
StatData()
          Constructor.
 
Method Summary
 void append(StatData other)
          Append function adds the items of the other StatData to the items from this StatData.
 StatData assign(StatData rhs)
          Set the StatData's member data to the same as that passed-in as 'rhs'.
static int cell(double value, double mean, double columnWidth)
          Generates a cell number centered aroung 0 for histograms.
 int class_id()
          Deprecated. Use Java's instanceOf built-in instead.
 void clear()
          Clear function removes all items from the StatData.
 void display_math_histogram(double columnWidth, int precision)
          Generate histogram for the data.
 void display_math_histogram(double columnWidth, int precision, java.io.Writer stream)
          Generate histogram for the data.
 void display()
          Displays the data.
 void display(java.io.Writer stream)
          Displays the data.
 boolean equals(StatData rhs)
          Compare the base-class member data of StatData for equality.
 double index(int indx)
          Returns the element at the specified index.
 void insert(double item)
          Inserts an item into the Array.
 double mean()
          Calculates the mean of the data.
 double mean(double trim)
          Calculates the trimmed mean of the data.
 boolean notEquals(StatData rhs)
          Tests if this StatData does not have equivalent data members.
 void percentile(double confIntProb, DoubleRef low, DoubleRef high)
          Returns the confidence interval for the given confidence probability.
 int size()
          Returns the number of the items stored in this StatData.
 double squared_error(double trueVal)
          Compute squared error around the true value.
 double std_dev_of_mean()
          Calculates the standard-deviation of the mean of the data.
 double std_dev_of_mean(double trim)
          Calculates the standard-deviation of the mean of the data.
 double std_dev()
          Calculates the standard-deviation of the data.
 double std_dev(double trim)
          Calculates the standard-deviation of the data.
 double variance_of_mean()
          Calculates the variance of the mean of the data.
 double variance_of_mean(double trim)
          Calculates the variance of the mean of the data.
 double variance()
          Calculates the variance of the data.
 double variance(double trim)
          Calculates the variance of the data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STAT_DATA_ID_BASE

public static final int STAT_DATA_ID_BASE
Deprecated. Use Java's instanceOf() function instead of class_id().

Class id value.

CLASS_STAT_DATA

public static final int CLASS_STAT_DATA
Deprecated. Use Java's instanceOf() function instead of class_id().

Class id value.

CLASS_ACC_DATA

public static final int CLASS_ACC_DATA
Deprecated. Use Java's instanceOf() function instead of class_id().

Class id value.

CLASS_ERROR_DATA

public static final int CLASS_ERROR_DATA
Deprecated. Use Java's instanceOf() function instead of class_id().

Class id value.
Constructor Detail

StatData

public StatData()
Constructor.
Method Detail

size

public int size()
Returns the number of the items stored in this StatData.
Returns:
The number of items.

insert

public void insert(double item)
Inserts an item into the Array. If an item is inserted into the array and there is no more space available, we fall back on the Array's error checking for operator [].
Parameters:
item - Item to be inserted into the Array.

index

public double index(int indx)
Returns the element at the specified index. Replaces the [] operator.
Parameters:
indx - The index of the element requested.
Returns:
The element at the given index.

variance

public double variance(double trim)
Calculates the variance of the data.
Parameters:
trim - Sets the value at which the variance will be trimmed to.
Returns:
The trimmed variance.

variance

public double variance()
Calculates the variance of the data. Trim defaults to 0.
Returns:
The variance value.

std_dev

public double std_dev(double trim)
Calculates the standard-deviation of the data.
Parameters:
trim - Sets the value at which the standard-deviation will be trimmed to.
Returns:
The trimmed standard-deviation.

std_dev

public double std_dev()
Calculates the standard-deviation of the data. Trim defaults to 0.
Returns:
The trimmed standard-deviation.

variance_of_mean

public double variance_of_mean(double trim)
Calculates the variance of the mean of the data.
Parameters:
trim - Sets the value at which the variance will be trimmed to.
Returns:
The trimmed variance of the mean.

variance_of_mean

public double variance_of_mean()
Calculates the variance of the mean of the data. Trim defaults to 0.
Returns:
The trimmed variance of the mean.

std_dev_of_mean

public double std_dev_of_mean(double trim)
Calculates the standard-deviation of the mean of the data.
Parameters:
trim - Sets the value at which the standard-deviation will be trimmed to.
Returns:
The trimmed standard-deviation of the mean.

std_dev_of_mean

public double std_dev_of_mean()
Calculates the standard-deviation of the mean of the data. Trim defaults to 0.
Returns:
The trimmed standard-deviation of the mean.

percentile

public void percentile(double confIntProb,
                       DoubleRef low,
                       DoubleRef high)
Returns the confidence interval for the given confidence probability.
Parameters:
confIntProb - The confidence probability. Must be between 0 and 1.
low - The lower bound for the interval.
high - The upper bound for the interval.

display

public void display(java.io.Writer stream)
Displays the data.
Parameters:
stream - The Writer to which the StatData is displayed.

display

public void display()
Displays the data.

display_math_histogram

public void display_math_histogram(double columnWidth,
                                   int precision,
                                   java.io.Writer stream)
Generate histogram for the data.
Parameters:
columnWidth - The width of columns.
precision - Precision used for numerical display.
stream - The Writer to which the histogram is displayed.

display_math_histogram

public void display_math_histogram(double columnWidth,
                                   int precision)
Generate histogram for the data.
Parameters:
columnWidth - The width of columns.
precision - Precision used for numerical display.

append

public void append(StatData other)
Append function adds the items of the other StatData to the items from this StatData. Use this function to combine statistical data from more than one source.
Parameters:
other - The StatData to be appended.

clear

public void clear()
Clear function removes all items from the StatData. This avoids having to use StatData pointers just to allow you to clear out a StatData.

class_id

public int class_id()
Deprecated. Use Java's instanceOf built-in instead.

Returns a value uniquely identifying this class.
Returns:
A value identifying this class.

assign

public StatData assign(StatData rhs)
Set the StatData's member data to the same as that passed-in as 'rhs'. Replaces the "=" operator.
Parameters:
rhs - The StatData whose member data is to be duplicated in this StatData.
Returns:
This StatData after assignment has taken place.

equals

public boolean equals(StatData rhs)
Compare the base-class member data of StatData for equality. All derived classes need to both define an equality test method, and within that method invoke the base-class equality test method. Replaces the "==" operator.
Parameters:
rhs - The StatData to be compared to.
Returns:
TRUE if the member data is equivalent, FALSE otherwise.

notEquals

public boolean notEquals(StatData rhs)
Tests if this StatData does not have equivalent data members. Replaces the "!=" operator.
Parameters:
rhs - The StatData to be compared to.
Returns:
FALSE if the member data is equivalent, TRUE otherwise.

squared_error

public double squared_error(double trueVal)
Compute squared error around the true value.
Parameters:
trueVal - The true value for which squared error is requested.
Returns:
The squared error.

mean

public double mean()
Calculates the mean of the data.
Returns:
The mean of the data.

mean

public double mean(double trim)
Calculates the trimmed mean of the data.
Parameters:
trim - The amount of trimming to be done. Trim = 0.5 now gives the median.
Returns:
The trimmed mean of the data.

cell

public static int cell(double value,
                       double mean,
                       double columnWidth)
Generates a cell number centered aroung 0 for histograms. Cell computation is
floor ((x - (mean+w/2))/w + 1)
floor ((x - mean)/w + .5)
Parameters:
value - The histogram value.
mean - Mean of values in the histogram.
columnWidth - The width of columns in the histogram.
Returns:
A cell number.