What is a T-Test?

A T-Test is a hypothesis test that we use in statistics to compare two data sets’ respective means. It is a kind of inferential statistics. It concludes if there is a significant difference between the two groups’ means, which otherwise could be related to a few attributes.

For example, you can use a t-test to determine if there is a difference in patients recovering from Covid-19 when admitted to a Government facility vs. a private facility.

To understand and calculate the t-test, we need to know basic terminologies such as:

Mean (Average): It is a ratio of the sum of the terms to the total number of terms.

Variance: It is a measure to determine the amount of deviation of a variable from its expected value. Its calculation involves squaring the deviation. For example, if we measure the length in centimeters, its variance would be calculated in centimeter squared. 

P-value: It is a value to determine whether to accept or reject the null hypothesis. The p-value describes the likeliness of a particular set of observations in case the null hypothesis holds true.

A t-test is called so because it lets you boil your sample data to a single value (t-value). We need three key data values to calculate a t-test:

  • Mean difference: difference of mean value from every data set
  • Every group’s standard deviation value
  • The data value number of every group

The common formula for calculating a t-test is:

t=x0s∕n

‘t’ is the test statistic or t-value. The formula is a ratio, and it is also called a signal-to-noise ratio.

Signal

The signal is the numerator. It is the difference between the sample mean and the null hypothesis value. If the difference is zero, the entire ratio becomes zero. The signal strength increases when the sample mean and the null hypothesis difference increases (either in +ve or -ve direction).

Noise

Noise is the denominator. The equation depicted in the denominator is called ‘standard error of the mean.

’ It indicates the accuracy of sample estimation to the population mean. A larger value implies the presence of more random error, due to which the precision of sample estimation is less. The random error is called noise. 

When the noise is more, we observe the larger difference between the sample mean and null hypothesis value. It holds true even when the null hypothesis is true. The noise factor is incorporated in the denominator to determine if the signal can stand out from it.

 

What is a T-value?

Every kind of t-test is performed to determine the significant difference between a hypothesized value and population mean, or difference between two population means. 

The inference obtained out of the result is called the t-value. It is also called the signal-to-noise ratio. The value compares the null hypothesis to sample mean(s). It incorporates both variability and the sample size in the data. In simple terms, the t-value is a difference calculation that is represented in standard error units.

When the t-value is zero, it signifies that the sample result complies with the null hypothesis. When the difference between the sample estimate and the null hypothesis increases, the absolute value of the t-value increases. The difference is called effect size. 

For example, if a t-value is 3, it implies that the observed difference is thrice the variability in the data. There is a greater chance of a lack of significant difference when the t-value is closer to zero.

When we take random data samples from the same population repeatedly, we will observe a different t-value every time. It is due to a random sampling error.

 

What are the different kinds of t-tests?

Based on the data and the analysis type, we can perform three kinds of t-tests:

  • One-sample t-test: comparing a mean of a single group against a defined mean
  • Independent two-sample t-test/ Unpaired two-sample t-test: for comparison of means of two groups
  • Paired t-test: for comparison of means at a different time but in the same group

One-Sample T-Test

A One-Sample T-Test is applied to determine if a population mean has a significant difference from a hypothesized value. We can use the test when the population variances are equal or unequal. The size of the sample could be small or large.

To understand the function of a 1-sample t-test, we need to follow the following procedure:

  • Define the hypotheses. The table mentioned below displays three sets of alternative and null hypotheses. µ represents the true population, and M represents a hypothesized value. 
Set Null Hypothesis Alternative Hypothesis Number of tails
1 µ = M µ ≠ M 2
2 µ ≤ M µ > M 1
3 µ ≥ M µ < M 1
  • Define significance level. The common values of significance levels that the researchers use are 0.1, 0.05, or 0.01. However, we can use any value between 0 and 1.
  • Obtain the degrees of freedom (DF). 

DF = n – 1

‘n’ is the number of observations in a sample.

  • Calculate test statistic (t). The equation for it is:

t = x-Ms∕n

x signifies an observed mean sample.

M signifies hypothesized population mean (null hypothesis).

s signifies sample’s standard deviation.

  • Evaluate P-value. It is the probability of detecting a sample statistic to the level of the test statistic. To derive the probability value, we can use a ‘t Distribution Calculator.’
  • Derive null hypothesis. The calculation includes a comparison of P-value and significance level. When the P-value is less than the significance level, the null hypothesis is discarded. 

Independent Two-Sample T-Test/ Unpaired Two-Sample T-Test

We use an independent two-sample t-test for comparison of two different samples’ means. For example, we can use the test comparing the average height of female college students with the average height of male college students. The number of college students of each gender should be the same. 

The formula for calculating the test statistics (t) is:

t=mAmBs2nA+s2nB

mA = Sample A mean

mB = Sample B mean

nA = Sample size A

nB = Sample size B

s2 = common variance estimator of the two samples

s2=x-mA2+∑x-mB2nA+nB-2

 

nA+nB-2 is the degree of freedom

 

The test follows similar logic to the one-sample t-test. It confirms whether the averages of each group are different from one another. The t-statistics and t-critical values are compared. 

  • We define the hypotheses.

Null Hypothesis: There is no difference between the two samples’ means.

Alternative Hypothesis: there is a difference between the two samples’ means.

  • Define significance level. We can use any value between 0 and 1. Researchers prefer using 0.1, 0.05, or 0.01. 
  • Calculate the degree of freedom (DF). In a two-sample t-test, the DF varies by conditions. The basic thumb rule is to pick a smaller value between nA-1 and nB-1.
  • Calculate the test statistics using the formula mentioned above.
  • Calculate P-value. It is the probability of detecting a sample statistic to the level of the test statistic. To derive the probability value, we can use a ‘t Distribution Calculator.’
  • Derive the null hypothesis. We discredit the null hypothesis when the P-value is less than the significance level value. We proceed with the null hypothesis when the t-statistics is less than the t-critical value.

Paired T-Test

A paired t-test is applied to observe a mean difference between paired data of two sets.

  • Establish paired differences. Consider a new variable d.

d=x1x2

x1 = value of variable x in data set one. x2 = value of variable x in data set two that is paired with x1

  • Define hypotheses. In the table mentioned below, we have demonstrated three sets of alternative and null hypotheses. d is a difference in population values, and M is a hypothesized value.
Set Null Hypothesis Alternative Hypothesis Number of tails
1 d=M d ≠M 2
2 d ≤M d>M 1
3 d ≥M d<M 1
  • Define significance level. We can use any value between 0 and 1. Researchers prefer using 0.1, 0.05, or 0.01. 
  • Calculate the degree of freedom (DF). 

DF = n – 1

n = number of paired observations

  • Evaluate test statistic (t). The formula for calculating it is:

t=d-Msdn

d = sample mean difference between paired observations

M = hypothesized mean difference (null hypothesis)

sd = standard deviation of d values.

  • Calculate P-value. It is the probability of detecting a sample statistic to the level of the test statistic. To derive the probability value, we can use a ‘t Distribution Calculator’.
  • Derive the null hypothesis. The null hypothesis is rejected when the P-value is less than the significance level value.

We have various comprehensive calculators that you can use online for free. You can choose from t-test calculator, graphing, matrix, the standard deviation to statistics, and scientific calculators. Check it here

Leave a Comment