A ConfInt containing T, the P-value and the boundaries of the confidence interval for mean(data) at the level specified.
References: http://en.wikipedia.org/wiki/Student%27s_t-test
uint[] data = [1,2,3,4,5]; // Test the null hypothesis that the mean of data is >= 1 against the // alternative that the mean of data is < 1. Calculate confidence // intervals at 90%. auto result1 = studentsTTest(data, 1, Alt.less, 0.9); // Do the same thing, only this time we've already calculated the summary // statistics explicitly before passing them to studensTTest. auto summary = meanStdev(data); writeln(summary.stdev); result2 = studentsTTest(summary, 1, Alt.less, 0.9); // Same as result1. assert(result1 == result2);
One-sample Student's T-test for difference between mean of data and a fixed value. Alternatives are Alt.less, meaning mean(data) < testMean, Alt.greater, meaning mean(data) > testMean, and Alt.twoSided, meaning mean(data)!= testMean.
data may be either an iterable with elements implicitly convertible to double or a summary struct (see isSummary).