T test

A t-test is any statistical hypothesis test in which the test statistic has a Student's t-distribution if the null hypothesis is true.

History
"Student" was the pen name of William Sealy Gosset, a statistician for Guinness brewery in Dublin, Ireland. Gosset was hired as a result of an innovative policy of Claude Guinness: to recruit the best graduates from Oxford and Cambridge for the application of biochemistry and statistics to Guinness's industrial processes. Gosset published the t-test in Biometrika in 1908, but was forced to use a pen name by his employer who regarded the fact that they were using statistics as a trade secret. In fact, Gosset's identity was unknown not only to fellow statisticians but to his employer - the company insisted on the pseudonym so that it could turn a blind eye to the breach of its rules. Gosset invented the t-statistic to enable the quality of beer brews to be monitored in a cost-effective manner. Today, it is more generally applied to the confidence that can be placed in judgements made from small samples.

Among the most frequently used t-tests are:


 * A statistical test of the null hypothesis that the means of two normally distributed populations are equal. All such tests are usually referred to as Student's t-tests, though strictly speaking that name should only be used if the variances of the two populations are also assumed to be equal; the form of the test used when this assumption is dropped is sometimes called Welch's t-test.  There are different versions of the t-test depending on whether the two samples are
 * independent of each other (e.g., individuals randomly assigned into two groups), or
 * paired, so that each member of one sample has a unique relationship with a particular member of the other sample (e.g., the same people measured before and after an intervention, or IQ test scores of a husband and wife).
 * If the t value that is calculated is greater than the threshold chosen for statistical significance (alpha conventionally equal to 0.05), then the null hypothesis that the two groups do not differ is rejected in favor of the alternative hypothesis, which typically states that the groups do differ.


 * A statistical test of whether the mean of a normally distributed population has a value specified in a null hypothesis.


 * A statistical test of whether the slope of a regression line differs significantly from 0.

Varieties of t-test in the case of two samples
If we have two data sets, each characterized by its mean, the standard deviation and the number of data points, we can use some kind of t-test to determine whether the means are distinct, provided that the underlying distributions can be assumed to be normal.


 * Whether the data points are normally distributed can be assessed by a normality test, such as Kolmogorov-Smirnov or Shapiro-Wilk.


 * Whether the sample variances are equal can be assessed using Bartlett's test, Levene's test, or the Brown & Forsythe test However, it is probably statistically conservative not to make this assumption: modern statistical packages make the test equally easy to do with or without it. (Since all calculations are done subject to the null hypothesis, it may be very difficult to come up with a reasonable null hypothesis that accounts for equal means in the presence of unequal variances.  In the usual case, the null hypothesis is that the different treatments have no effect; this makes unequal variances untenable.  In this case, one should forgo the ease of using this variant afforded by the statistical packages. See also Behrens-Fisher problem.)


 * For novices, the most difficult issue is often whether the samples are paired (dependent) or independent. Dependent samples are sometimes described as involving "repeated measures", often arising when we make before and after measurements on the same individuals or objects.  But this is not the only case where related samples arise.  For example, in a comparison of the height of men and women, we might recruit 100 married or cohabiting opposite-sex couples, and compare the height of each woman with her partner; this would call for a related samples test.  There are repeated measures here, but it is the couple that is measured twice - once for the female and once for the male.  Alternatively, we might recruit 100 men and 100 women, with no relationship between any particular man and any particular woman; in this case we would use an independent samples test.

Alternatives to the t-test
If a non-parametric alternative to the t-test is wanted, the usual choices are:
 * for independent samples, the Mann-Whitney U test
 * for related samples, either the binomial test or the Wilcoxon signed-rank test