SampleStudentTTest Method (Double) |
Namespace: Meta.Numerics.Statistics
Exception | Condition |
---|---|
InsufficientDataException | There are fewer than two data points in the sample. |
The test statistic of Student's t-test is the difference between the sample mean and the reference mean, measured in units of the sample mean uncertainty. Under the null hypothesis that the sample was drawn from a normally distributed population with the given reference mean, this statistic can be shown to follow a Student distribution (StudentDistribution). If t is far from zero, with correspondingly small left or right tail probability, then the sample is unlikely to have been drawn from a population with the given reference mean.
Because the distribution of a t-statistic assumes a normally distributed population, this test should only be used only on sample data compatible with a normal distribution. The sign test (SignTest(Double)) is a non-parametric alternative that can be used to test the compatibility of the sample median with an assumed population median.
In some country, the legal limit blood alcohol limit for drivers is 80 on some scale. Because they have noticed that the results given by their measuring device fluctuate, the police perform three seperate measurements on a suspected drunk driver. They obtain the results 81, 84, and 93. They argue that, because all three results exceed the limit, the court should be very confident that the driver's blood alcohol level did, in fact, exceed the legal limit. You are the driver's lawyer. Can you make an argument to that the court shouldn't be so sure?
Here is some code that computes the probability of obtaining such high measured values, assuming that the true level is exactly 80.
Sample values = new Sample(); values.Add(81, 84, 93); TestResult result = values.StudentTTest(80); return(result.RightProbability);
What level of statistical confidence do you think should a court require in order to pronounce a defendant guilty?