papaya
Class Comparison.TTest

java.lang.Object
  extended by papaya.Comparison.TTest
Enclosing class:
Comparison

public static class Comparison.TTest
extends Object

Methods related to comparing two populations. Each method returns an array with the first element containing the t-statistic, and the second corresponding to the p-value, or significance, of rejecting the null hypothesis.

Tests can be:

Test statistics are available for all tests. Methods including "Test" in in their names perform tests, all other methods return t-statistics. Among the "Test" methods, double-valued methods return p-values; boolean-valued methods perform fixed significance level tests. Significance levels are always specified as numbers between 0 and 0.5 (e.g. tests at the 95% level use alpha=0.05).

Note: Inspired by the stats.inference.TTest class available in the Apache Commons math library.


Method Summary
static float[] equalVar(float[] data1, float[] data2)
          Returns the t-statistic and p-value for checking whether the means between the two datasets are different under the assumption that both datasets have equal variances.
static float[] paired(float[] before, float[] after)
          Returns the t-statistic and p-value for checking a pair of dependent samples.
static float[] unequalVar(float[] data1, float[] data2)
          Returns the t-statistic and p-value for checking whether the means between the two datasets are different under the assumption that both datasets have unequal variances.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

equalVar

public static float[] equalVar(float[] data1,
                               float[] data2)
Returns the t-statistic and p-value for checking whether the means between the two datasets are different under the assumption that both datasets have equal variances. The p-value corresponds to the null hypothesis of no-difference (i.e. two-tailed).

Returns:
an array with the first element = t and the second element = p.

unequalVar

public static float[] unequalVar(float[] data1,
                                 float[] data2)
Returns the t-statistic and p-value for checking whether the means between the two datasets are different under the assumption that both datasets have unequal variances. The p-value corresponds to the null hypothesis of no-difference (i.e. two-tailed). This is also known as Welch's t-test.

Returns:
an array with the first element = t and the second element = p.

paired

public static float[] paired(float[] before,
                             float[] after)
Returns the t-statistic and p-value for checking a pair of dependent samples. That is, when there is only one sample that has been tested twice (repeated measures) or when there are two samples that have been matched or "paired". The p-value corresponds to the null hypothesis of no-difference in both measurements (i.e. two-tailed).

Both datasets have to have equal lengths.

Parameters:
before - the dataset before treatment/measurement.
after - the dataset after treatment/measurement.
Returns:
an array with the first element = t and the second element = p.


Processing library papaya by Adila Faruk. (C) 2014