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 = 0, Alt alt = Alt.twoSided, double confLevel = 0.95)
  2. ConfInt pairedTTest(T diffSummary, double testMean = 0, Alt alt = Alt.twoSided, double confLevel = 0.95)
    pairedTTest
    (
    T
    )
    (
    ,
    double testMean = 0
    ,,
    double confLevel = 0.95
    )

Examples

1 float[] data1 = [8, 6, 7, 5, 3, 0, 9];
2 float[] data2 = [3, 6, 2, 4, 3, 6, 8];
3 
4 // Calculate summary statistics on difference explicitly.
5 MeanSD summary;
6 foreach(i; 0..data1.length) {
7     summary.put(data1[i] - data2[i]);
8 }
9 
10 // Test the null hypothesis that the mean difference between corresponding
11 // elements (data1[i] - data2[i]) is greater than 5 against the null that it
12 // is <= 5.  Calculate confidence intervals at 99%.
13 auto result = pairedTTest(summary, 5, Alt.twoSided, 0.99);
14 
15 // This is equivalent to:
16 auto result2 = pairedTTest(data1, data2, 5, Alt.twoSided, 0.99);

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

Meta