org.android.activityminer.logic.statistics
Class StudentTTest

Package class diagram package StudentTTest
java.lang.Object
  extended by org.android.activityminer.logic.statistics.StudentTTest

public class StudentTTest
extends Object

Am simple Student t test implementation to generate a X%, two-sided mean confidence interval for one sample.


Nested Class Summary
static class StudentTTest.ConfidenceCoefficent
          Known confidence coefficients (for confidence interval calculation)
 
Field Summary
private static double[][] table
          Critical values of Student's t distribution with ν (v<10) degrees of freedom.
 
Constructor Summary
StudentTTest()
           
 
Method Summary
static double meanConfidenceDelta(double[] sample, StudentTTest.ConfidenceCoefficent cc)
          Mean confidence delta computation for a single sample.
private static double meanConfidenceDelta(double mean, double var, int n, StudentTTest.ConfidenceCoefficent cc)
          Mean confidence delta computation.
static double[] meanConfidenceInterval(double[] sample, StudentTTest.ConfidenceCoefficent cc)
          Mean confidence interval computation for a single sample.
private static double[] meanConfidenceInterval(double mean, double var, int n, StudentTTest.ConfidenceCoefficent cc)
          Mean confidence interval computation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

private static final double[][] table
Critical values of Student's t distribution with ν (v<10) degrees of freedom. Values have benn calculated with R: qt(1-α/2,df=v).

Constructor Detail

StudentTTest

public StudentTTest()
Method Detail

meanConfidenceDelta

private static final double meanConfidenceDelta(double mean,
                                                double var,
                                                int n,
                                                StudentTTest.ConfidenceCoefficent cc)
                                         throws IllegalArgumentException
Mean confidence delta computation.

Parameters:
mean - the sample mean
var - the sample variance
n - the sample count
cc - the confidence coefficient (1-significance)
Returns:
the confidence delta from the mean (mean +- result is the interval)
Throws:
IllegalArgumentException - if n is not more than 1

meanConfidenceDelta

public static final double meanConfidenceDelta(double[] sample,
                                               StudentTTest.ConfidenceCoefficent cc)
                                        throws IllegalArgumentException
Mean confidence delta computation for a single sample.

Parameters:
sample - the sample
cc - the confidence coefficient (1-significance)
Returns:
the confidence delta from the mean (mean +- result is the interval)
Throws:
IllegalArgumentException - if n is not more than 1

meanConfidenceInterval

private static final double[] meanConfidenceInterval(double mean,
                                                     double var,
                                                     int n,
                                                     StudentTTest.ConfidenceCoefficent cc)
                                              throws IllegalArgumentException
Mean confidence interval computation.

Parameters:
mean - the sample mean
var - the sample variance
n - the sample count
cc - the confidence coefficient (1-significance)
Returns:
the confidence intervals lower and upper bound
Throws:
IllegalArgumentException - if n is not more than 1

meanConfidenceInterval

public static final double[] meanConfidenceInterval(double[] sample,
                                                    StudentTTest.ConfidenceCoefficent cc)
                                             throws IllegalArgumentException
Mean confidence interval computation for a single sample.

Parameters:
sample - the sample
cc - the confidence coefficient (1-significance)
Returns:
the confidence intervals lower and upper bound
Throws:
IllegalArgumentException - if n is not more than 1