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).
A ConfInt containing T, the P-value and the boundaries of the confidence interval for mean(data) at the level specified.
1 uint data = [1,2,3,4,5]; 2 3 // Test the null hypothesis that the mean of data is >= 1 against the 4 // alternative that the mean of data is < 1. Calculate confidence 5 // intervals at 90%. 6 auto result1 = studentsTTest(data, 1, Alt.less, 0.9); 7 8 // Do the same thing, only this time we've already calculated the summary 9 // statistics explicitly before passing them to studensTTest. 10 auto summary = meanStdev(data); 11 writeln(summary.stdev); 12 result2 = studentsTTest(summary, 1, Alt.less, 0.9); // Same as result1. 13 assert(result1 == result2);