The OpenD Programming Language

pairedTTest

Compute a paired T test directly from summary statistics of the differences between corresponding samples.

  1. ConfInt pairedTTest(T before, U after, double testMean, Alt alt, double confLevel)
  2. ConfInt pairedTTest(T diffSummary, double testMean, Alt alt, double confLevel)
    pairedTTest
    (
    T
    )
    (,
    double testMean = 0
    ,,
    double confLevel = 0.95
    )

Examples

float[] data1 = [8, 6, 7, 5, 3, 0, 9];
float[] data2 = [3, 6, 2, 4, 3, 6, 8];

// Calculate summary statistics on difference explicitly.
MeanSD summary;
foreach(i; 0..data1.length) {
    summary.put(data1[i] - data2[i]);
}

// Test the null hypothesis that the mean difference between corresponding
// elements (data1[i] - data2[i]) is greater than 5 against the null that it
// is <= 5.  Calculate confidence intervals at 99%.
auto result = pairedTTest(summary, 5, Alt.twoSided, 0.99);

// This is equivalent to:
auto result2 = pairedTTest(data1, data2, 5, Alt.twoSided, 0.99);

References: http://en.wikipedia.org/wiki/Student%27s_t-test

Meta