gov.sandia.cognition.statistics.method
Class StudentTConfidence

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.statistics.method.StudentTConfidence
All Implemented Interfaces:
ConfidenceIntervalEvaluator<Collection<? extends Number>>, NullHypothesisEvaluator<Collection<? extends Number>>, CloneableSerializable, Serializable, Cloneable

@ConfidenceTestAssumptions(name="Paired Student\'s t-test",
                           description="Computes the value of the null hypothesis that the differences between paired samples have zero mean and that the data are sampled from a Gaussian distributions with equal variances.",
                           alsoKnownAs="Dependent t-test for paired samples",
                           nullHypothesis="The means of the groups are equal.",
                           assumptions={"The data for the pairs are iid samples from a Gaussian distribution with equal variances.","The common variances times the degrees of freedom is a chi-square distribution.","The data pairs should be sampled independently from each other."},
                           distribution=StudentTDistribution.CDF.class,
                           dataPaired=true,
                           dataSameSize=true,
                           reference=@PublicationReference(author="Wikipedia",title="Student\'s t-test, Dependent t-test for paired samples",type=WebPage,year=2009,url="http://en.wikipedia.org/wiki/Student_t_test#Dependent_t-test_for_paired_samples"))
public class StudentTConfidence
extends AbstractCloneableSerializable
implements NullHypothesisEvaluator<Collection<? extends Number>>, ConfidenceIntervalEvaluator<Collection<? extends Number>>

This class implements Student's t-tests for different uses. The confidence test is the Paired Student's t-test to determine if the difference between the pairs have zero mean. The confidence interval calculation computes the Student-t confidence interval for the mean of the given data.

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

Nested Class Summary
static class StudentTConfidence.Statistic
          Confidence statistics for a Student-t test
static class StudentTConfidence.Summary
          An implementation of the Summarizer interface for creating a ConfidenceInterval
 
Field Summary
static double DEFAULT_TOLERANCE
          Default tolerance for the standard deviation, 1.0E-10.
static StudentTConfidence INSTANCE
          This class has no members, so here's a static instance.
 
Constructor Summary
StudentTConfidence()
          Creates a new instance of StudentTConfidence
 
Method Summary
 ConfidenceInterval computeConfidenceInterval(Collection<? extends Number> data, double confidence)
          Computes a confidence interval for a given dataset and confidence (power) level
 ConfidenceInterval computeConfidenceInterval(double mean, double variance, int numSamples, double confidence)
          Computes the confidence interval given the mean and variance of the samples, number of samples, and corresponding confidence interval
 StudentTConfidence.Statistic evaluateNullHypothesis(Collection<? extends Number> data1, Collection<? extends Number> data2)
          Computes a paired Student-t test for the given data.
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 

Field Detail

INSTANCE

public static final StudentTConfidence INSTANCE
This class has no members, so here's a static instance.


DEFAULT_TOLERANCE

public static final double DEFAULT_TOLERANCE
Default tolerance for the standard deviation, 1.0E-10.

See Also:
Constant Field Values
Constructor Detail

StudentTConfidence

public StudentTConfidence()
Creates a new instance of StudentTConfidence

Method Detail

evaluateNullHypothesis

@PublicationReference(author={"William H. Press","Saul A. Teukolsky","William T. Vetterling","Brian P. Flannery"},
                      title="Numerical Recipes in C, Second Edition",
                      type=Book,
                      year=1992,
                      pages=618,
                      notes="Function tptest()",
                      url="http://www.nrbook.com/a/bookcpdf.php")
public StudentTConfidence.Statistic evaluateNullHypothesis(Collection<? extends Number> data1,
                                                                                                                    Collection<? extends Number> data2)
Computes a paired Student-t test for the given data. The datasets must be the same size.

Specified by:
evaluateNullHypothesis in interface NullHypothesisEvaluator<Collection<? extends Number>>
Parameters:
data1 - First dataset to consider
data2 - Second dataset to consider
Returns:
ConfidenceStatistic for a Student-t test

computeConfidenceInterval

public ConfidenceInterval computeConfidenceInterval(Collection<? extends Number> data,
                                                    double confidence)
Description copied from interface: ConfidenceIntervalEvaluator
Computes a confidence interval for a given dataset and confidence (power) level

Specified by:
computeConfidenceInterval in interface ConfidenceIntervalEvaluator<Collection<? extends Number>>
Parameters:
data - Dataset to use to compute the ConfidenceInterval
confidence - Confidence level (power, 1-pvalue) for the ConfidenceInterval, must be on the interval (0,1]
Returns:
ConfidenceInterval describing the range of values that contain the estimate for the given confidence level

computeConfidenceInterval

public ConfidenceInterval computeConfidenceInterval(double mean,
                                                    double variance,
                                                    int numSamples,
                                                    double confidence)
Description copied from interface: ConfidenceIntervalEvaluator
Computes the confidence interval given the mean and variance of the samples, number of samples, and corresponding confidence interval

Specified by:
computeConfidenceInterval in interface ConfidenceIntervalEvaluator<Collection<? extends Number>>
Parameters:
mean - Mean of the distribution.
variance - Variance of the distribution.
numSamples - Number of samples in the underlying data
confidence - Confidence value to assume for the ConfidenceInterval
Returns:
ConfidenceInterval capturing the range of the mean of the data at the desired level of confidence