gov.sandia.cognition.statistics.method
Class FieldConfidenceInterval

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.statistics.method.ConfidenceInterval
          extended by gov.sandia.cognition.statistics.method.FieldConfidenceInterval
All Implemented Interfaces:
CloneableSerializable, Serializable, Cloneable

public class FieldConfidenceInterval
extends ConfidenceInterval

This class has methods that automatically compute confidence intervals for Double/double Fields in dataclasses. For example, if you're in a hurry and want to compute the confidence intervals for all given class (e.g., LinearRegression.Statistic), then you can simply class the computeConfidenceInterval() with a Collection of your desired class and it will return the confidence interval associated with the internal Fields of the data. That is, it will return a confidence interval associated with each public/protected/private field within the class automatically, with you having to specify them individually (unless you want to).

Since:
2.0
Author:
Kevin R. Dixon
See Also:
Serialized Form

Constructor Summary
FieldConfidenceInterval(Field field, ConfidenceInterval confidenceInterval)
          Creates a new instance of FieldConfidenceInterval
 
Method Summary
static
<DataType> ArrayList<FieldConfidenceInterval>
computeConfidenceInterval(Collection<DataType> data, ArrayList<Field> interestedFields, ConfidenceIntervalEvaluator<Collection<? extends Number>> confidenceIntervalEvaluator, double confidence)
          Computes a FieldConfidenceInterval for the given Fields in the given data
static
<DataType> ArrayList<FieldConfidenceInterval>
computeConfidenceInterval(Collection<DataType> data, ConfidenceIntervalEvaluator<Collection<? extends Number>> confidenceIntervalEvaluator, double confidence)
          Computes a FieldConfidenceInterval for each Double/double Field in the given data.
 Field getField()
          Getter for field
 boolean isMatch(Field field)
          Determines if the given field is a match to the internal Field
 boolean isMatch(String fieldName)
          Determines if the given field is a match to the internal Field
 void setField(Field field)
          Setter for field
 String toString()
           
 boolean withinInterval(Object o)
          Determines whether the Field within the given Object is within the specified interval
 
Methods inherited from class gov.sandia.cognition.statistics.method.ConfidenceInterval
getCentralValue, getConfidence, getLowerBound, getNumSamples, getUpperBound, setCentralValue, setConfidence, setLowerBound, setNumSamples, setUpperBound, withinInterval
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FieldConfidenceInterval

public FieldConfidenceInterval(Field field,
                               ConfidenceInterval confidenceInterval)
Creates a new instance of FieldConfidenceInterval

Parameters:
field - Field associated with the confidence interval
confidenceInterval - ConfidenceInterval associated with the Field
Method Detail

isMatch

public boolean isMatch(Field field)
Determines if the given field is a match to the internal Field

Parameters:
field - Field to compare against the internal Field
Returns:
True if a match, false otherwise

isMatch

public boolean isMatch(String fieldName)
Determines if the given field is a match to the internal Field

Parameters:
fieldName - Field name to compare against the internal Field
Returns:
True if a match, false otherwise

withinInterval

public boolean withinInterval(Object o)
Determines whether the Field within the given Object is within the specified interval

Parameters:
o - Object from which to pull the Field's value to determine if it's within the specified interval
Returns:
True if o's Field is within the interval, false otherwise

getField

public Field getField()
Getter for field

Returns:
Field associated with the confidence interval

setField

public void setField(Field field)
Setter for field

Parameters:
field - Field associated with the confidence interval

toString

public String toString()
Overrides:
toString in class ConfidenceInterval

computeConfidenceInterval

public static <DataType> ArrayList<FieldConfidenceInterval> computeConfidenceInterval(Collection<DataType> data,
                                                                                      ConfidenceIntervalEvaluator<Collection<? extends Number>> confidenceIntervalEvaluator,
                                                                                      double confidence)
Computes a FieldConfidenceInterval for each Double/double Field in the given data.

Type Parameters:
DataType - The type of data to compute the confidence interval over.
Parameters:
data - Collection of data from which to pull the values. Must all be same type!
confidenceIntervalEvaluator - Statistical test that transforms a Collection of Doubles into a ConfidenceInterval
confidence - Confidence (power) of the resulting ConfidenceInterval
Returns:
Collection of FieldConfidenceInterval, one for each Double/double Field found in "DataType"

computeConfidenceInterval

public static <DataType> ArrayList<FieldConfidenceInterval> computeConfidenceInterval(Collection<DataType> data,
                                                                                      ArrayList<Field> interestedFields,
                                                                                      ConfidenceIntervalEvaluator<Collection<? extends Number>> confidenceIntervalEvaluator,
                                                                                      double confidence)
Computes a FieldConfidenceInterval for the given Fields in the given data

Type Parameters:
DataType - The type of data to compute the confidence interval over.
Parameters:
interestedFields - Fields from which to pull data
data - Collection of data from which to pull the values. Must all be same type!
confidenceIntervalEvaluator - Statistical test that transforms a Collection of Doubles into a ConfidenceInterval
confidence - Confidence (power) of the resulting ConfidenceInterval
Returns:
Collection of FieldConfidenceInterval, one for each Double/double Field found in "DataType"