UnivariateStudentTTest(IReadOnlyCollectionDouble, IReadOnlyCollectionDouble) Method

Tests whether one sample mean is compatible with another sample mean.

Definition

Namespace: Meta.Numerics.Statistics
Assembly: Meta.Numerics (in Meta.Numerics.dll) Version: 4.2.0+6d77d64445f7d5d91b12e331399c4362ecb25333
C#
public static TestResult StudentTTest(
	IReadOnlyCollection<double> a,
	IReadOnlyCollection<double> b
)

Parameters

a  IReadOnlyCollectionDouble
The first sample, which must contain at least two entries.
b  IReadOnlyCollectionDouble
The second sample, which must contain at least two entries.

Return Value

TestResult
The result of the test. The statistic is the Student's t and the probability is the chance of obtaining such an extreme value of t if the two samples are drawn from the same distribution.

Remarks

Given two samples, a back-of-the-envelope way to determine whether their means differ in a statistically significant way is to compare their PopulationMean(IReadOnlyCollectionDouble) values. If their error bars overlap, they are probably statistically compatible; if they do not, the difference in means is probably statistically significant. Student's t-test is a way to refine this back-of-the-envelope procedure into a statistical test that can determine exactly how likely a given separation of means is under the null hypothesis that the two samples are drawn from the same distribution.

The t-statistic is proportional to the mean of a minus the mean of b, so t > 0 indicates that a has a greater mean.

Student's t-test was one of the first statistical tests. It was described by William Sealy Gosset, a chemist who worked for the Guinness brewing company. Since Guinness was concerned that other breweries might take advantage of a technique published by one of its chemists, Gosset published his work under the pseudonym Student.

Exceptions

ArgumentNullExceptiona or b is .
InsufficientDataExceptiona or b contains fewer than two values.

See Also