A test statistic is a statistic (a quantity derived from the sample) used in statistical hypothesis testing.^{[1]} A hypothesis test is typically specified in terms of a test statistic, considered as a numerical summary of a dataset that reduces the data to one value that can be used to perform the hypothesis test. In general, a test statistic is selected or defined in such a way as to quantify, within observed data, behaviours that would distinguish the null from the alternative hypothesis, where such an alternative is prescribed, or that would characterize the null hypothesis if there is no explicitly stated alternative hypothesis.
An important property of a test statistic is that its sampling distribution under the null hypothesis must be calculable, either exactly or approximately, which allows pvalues to be calculated. A test statistic shares some of the same qualities of a descriptive statistic, and many statistics can be used as both test statistics and descriptive statistics. However, a test statistic is specifically intended for use in statistical testing, whereas the main quality of a descriptive statistic is that it is easily interpretable. Some informative descriptive statistics, such as the sample range, do not make good test statistics since it is difficult to determine their sampling distribution.
Two widely used test statistics are the tstatistic and the Ftest.
For example, suppose the task is to test whether a coin is fair (i.e. has equal probabilities of producing a head or a tail). If the coin is flipped 100 times and the results are recorded, the raw data can be represented as a sequence of 100 heads and tails. If there is interest in the marginal probability of obtaining a head, only the number T out of the 100 flips that produced a head needs to be recorded. But T can also be used as a test statistic in one of two ways:
Using one of these sampling distributions, it is possible to compute either a onetailed or twotailed pvalue for the null hypothesis that the coin is fair. Note that the test statistic in this case reduces a set of 100 numbers to a single numerical summary that can be used for testing.
Onesample tests are appropriate when a sample is being compared to the population from a hypothesis. The population characteristics are known from theory or are calculated from the population.
Twosample tests are appropriate for comparing two samples, typically experimental and control samples from a scientifically controlled experiment.
Paired tests are appropriate for comparing two samples where it is impossible to control important variables. Rather than comparing two sets, members are paired between samples so the difference between the members becomes the sample. Typically the mean of the differences is then compared to zero. The common example scenario for when a paired difference test is appropriate is when a single set of test subjects has something applied to them and the test is intended to check for an effect.
Ztests are appropriate for comparing means under stringent conditions regarding normality and a known standard deviation.
A ttest is appropriate for comparing means under relaxed conditions (less is assumed).
Tests of proportions are analogous to tests of means (the 50% proportion).
Chisquared tests use the same calculations and the same probability distribution for different applications:
Ftests (analysis of variance, ANOVA) are commonly used when deciding whether groupings of data by category are meaningful. If the variance of test scores of the lefthanded in a class is much smaller than the variance of the whole class, then it may be useful to study lefties as a group. The null hypothesis is that two variances are the same – so the proposed grouping is not meaningful.
In the table below, the symbols used are defined at the bottom of the table. Many other tests can be found in other articles. Proofs exist that the test statistics are appropriate.^{[2]}
Name  Formula  Assumptions or notes  

Onesample ztest  (Normal population or n > 30) and σ known. (z is the distance from the mean in relation to the standard deviation of the mean). For nonnormal distributions it is possible to calculate a minimum proportion of a population that falls within k standard deviations for any k (see: Chebyshev's inequality). 

Twosample ztest  Normal population and independent observations and σ_{1} and σ_{2} are known  
Onesample ttest 

(Normal population or n > 30) and unknown  
Paired ttest 

(Normal population of differences or n > 30) and unknown  
Twosample pooled ttest, equal variances 

(Normal populations or n_{1} + n_{2} > 40) and independent observations and σ_{1} = σ_{2} unknown  
Twosample unpooled ttest, unequal variances (Welch's ttest)  ^{[3]} 
(Normal populations or n_{1} + n_{2} > 40) and independent observations and σ_{1} ≠ σ_{2} both unknown  
Oneproportion ztest  n ^{.}p_{0} > 10 and n (1 − p_{0}) > 10 and it is a SRS (Simple Random Sample), see notes.  
Twoproportion ztest, pooled for 

n_{1} p_{1} > 5 and n_{1}(1 − p_{1}) > 5 and n_{2} p_{2} > 5 and n_{2}(1 − p_{2}) > 5 and independent observations, see notes.  
Twoproportion ztest, unpooled for  n_{1} p_{1} > 5 and n_{1}(1 − p_{1}) > 5 and n_{2} p_{2} > 5 and n_{2}(1 − p_{2}) > 5 and independent observations, see notes.  
Chisquared test for variance  Normal population  
Chisquared test for goodness of fit  df = k − 1 − # parameters estimated, and one of these must hold.
• All expected counts are at least 5.^{[4]} • All expected counts are > 1 and no more than 20% of expected counts are less than 5^{[5]} 

Twosample F test for equality of variances  Normal populations Arrange so and reject H_{0} for ^{[6]} 

Regression ttest of  Reject H_{0} for ^{[7]} *Subtract 1 for intercept; k terms contain independent variables. 

In general, the subscript 0 indicates a value taken from the null hypothesis, H_{0}, which should be used as much as possible in constructing its test statistic. ... Definitions of other symbols:

This page is based on a Wikipedia article written by authors
(here).
Text is available under the CC BYSA 3.0 license; additional terms may apply.
Images, videos and audio are available under their respective licenses.