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
Compute a paired T test directly from summary statistics of the differences between corresponding samples.