## What is T-Test?

A T-Test is a method used to derive an inference in statistics which is aimed to find out if there is any major difference between two means wherein the two groups considered may be related to each other.

### Explanation

- It is aimed at hypothesis testing which basically is used to test a hypothesis pertaining to a given population. A T-Test considers T statistic, T distribution values, and degrees of freedom which are used to determine the probability of difference between two data sets.
- The basic working behind T-Test is that it considers a sample from each of the two sets and builds a problem statement by considering a null hypothesis where both the means are stated to be equal.
- On the basis of equated formulas, values are drawn and compared with the standard values which further leads to the acceptance or rejection of the null hypothesis. The rejection of the null hypothesis indicates that the data set is quite accurate and not by chance.

### Types of T-Test

There are primarily four types of t-test which are as follows:

#### #1 – 1-Sample T-Test

It is aimed for testing if the mean of the value one has targeted is equal to the mean of a single population e.g. Testing whether the average weight of Class 5 students are more than 45kg

#### #2 – 2-Sample T-Test

It is aimed for testing if the mean of the value one has targeted is equal to the mean of two independent population e.g. Testing whether the average weight of Class 5 boy students is different from Class 5 girl students.

#### #3 – Paired T-Test

It is aimed for testing if the mean of the value one has targeted is equal to the mean of differences between the observations which are dependent. e.g. comparing marks of students before and after taking tuitions for each subject helps us identify whether taking tuitions is significant enough to improve the marks of students.

#### #4 – T-Test in Regression Output

It takes into consideration the coefficient in the regression equation and tests to what degree it differs from zero value. e.g. If the entrance exam score is a significant factor to determine whether a student will obtain a good final score.

### Assumptions of T-Test

- The first assumption for a t-test is related to the measurement scale. This is related to whether the scale follows a continuous or ordinal scale
- The second assumption can be regarding the random nature of the sample. This means that the data collected should be pure random in nature.
- The third assumption can be that when we plot the data related to t-test distribution it should follow a normal distribution and bring about a bell-curved graph.
- The fourth assumption can be that for t-distribution and specifically to obtain a shape of bell curve we need to have a bigger sample size
- The final assumption can be that for the t-test. The variance should be homogenous in nature. e. the standard deviations are almost equal.

### How to Calculate?

It works in two different scenarios i.e. one for the independent sample and another for the dependent sample.

#### #1 – Independent Sample Scenario

- We need to calculate the sum, the sample size which is determined by “N” and the score value for the mean for each of the independent samples. After this, the degree of freedom needs to be calculated for every independent sample.
- This is represented by subtracting the sample by one which we denote as “n-1”. After this, the variance and standard deviation need to be calculated.
- The degrees of freedom of the samples are added and this is termed as “df-total”. Next, we need to multiply the degree of freedom of each sample with the variance of each. We need to add the resultants and then divide the total by “df-total”. The result obtained is called the pooled variance.
- The pooled variance is then divided by the n of the samples. The result obtained for all the samples is then added. The square root of this is taken and this is termed as the standard error of the difference.
- Lastly, we need to subtract the lower mean of the sample from the greater mean of the sample. The difference obtained is then divided by the standard error of the difference and the results obtained are called the T-value.

#### #2 – Dependent Sample Scenario

- The scores obtained from each of the pairs of data set are noted and we need to subtract it. The differences obtained are added and termed as “D”. The differences of each sample are squared and added to obtain a resultant called “D-Squared”. After this, we need to multiply the “N” or number of scores paired with the “D-squared”.
- The resultant obtained is subtracted from the square of total “D”. This result is further divided with “N-1”. The square root of the resultant is obtained and is termed as a divisor. Lastly, we need to divide the total “D” by the divisor which gives us the final t-value.

### T-Test Examples

Let us consider we have scores for each subject in the examination held for two terms.

**Step 1:** Subtract Phase 1 from Phase 2

**Step 2:** Add up all the difference i.e. **-55**

**Step 3:** Square up the differences

**Step 4:** Add up all the squares of difference i.e. **983**

**Step 5:** Usage of formula to calculate the T value

**T = {(∑D)/N}/√{∑D**

^{2}– (∑D)^{2}/N)}/(N-1) – N**=**-9.16/√{983-(-55)^{2}/6)}/(6-1)*6**=**-9.16/√15.96**=**-9.16/3.99**T Value = -2.29**

The T value obtained is then compared with the T value obtained from the table using p-value and degree of freedom. If the calculated t value is greater than the table value at a specific predefined alpha level we can reject the null hypothesis saying there is a difference between the means.

### When It’s Used?

This is used to compare two means or proportions. Also, we use a t-test when the population parameters are unknown to the user. There are broadly three cases of t-test scenario usage which are as follows:

- An independent sample t-test is used when we want to compare the mean of two groups.
- A paired sample t-test is used when we want to compare the mean of the same group but at different points of time.
- One sample t-test is used when we are in a need to check the mean of an individual group against an unknown mean.

### T-Test Usage in Excel

- In excel the first and foremost thing we need is the installation of an add-in called Data Analysis. After this, we need to go to “Data” on the menu tab and click on it. The “Data Analysis” option will be visible there.
- To conduct a T-Test we need to have out data in a columnar format. On click “Data Analysis” we will get a number of statistical tests that we can perform and from the list, we need to choose a t-test and click “Ok”.
- A dialog box comes up where we need to enter the data for trail 1 in the variable range 1 box and also the trial 2 data in the variable range 2 boxes. By default, the value of alpha remains as 0.05 but this can be changed based on our preference. When all if fine click on “OK”.
- We can now see the result of our T-Test on the excel sheet. The most important value here to note is P-value. On what we have selected our alpha value if our P-value in excel is less than the alpha value we can conclude there is a statistical material difference between the means of our two sets of values.

### Conclusion

T-Test is aimed at hypothesis testing which basically is used to test a hypothesis pertaining to a given population. It tells us the level of significance of the difference between the groups which are generally measured on the basis of the mean. Here we basically find out the difference between population means and a hypothesized value.

### Recommended Articles

This has been a guide to What is T-Test & its Definition. Here we discuss how to calculate the t-test, types, and assumptions along with examples and when it’s used. You can learn more about from the following articles –

- 16 Courses
- 15+ Projects
- 90+ Hours
- Full Lifetime Access
- Certificate of Completion