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