*55*

Whenever you conduct a t-test, you will get a test statistic as a result. To determine if the results of the t-test are statistically significant, you can compare the test statistic to a**Â TÂ critical value**. If the absolute value of the test statistic is greater than the T critical value, then the results of the test are statistically significant.

The T critical value can be found by using aÂ t distribution tableÂ or by using statistical software.

To find the T critical value, you need to specify:

- A significance level (common choices are 0.01, 0.05, and 0.10)
- The degrees of freedom

Using these two values, you can determine the T critical value to be compared with the test statistic.

**How to Find the T Critical Value in Python**

To find the T critical value in Python, you can use theÂ scipy.stats.t.ppf()Â function, which uses the following syntax:

**scipy.stats.t.ppf(q, df)**

where:

**q:Â**The significance level to use**df**: The degrees of freedom

The following examples illustrate how to find the T critical value for a left-tailed test, right-tailed test, and a two-tailed test.

**Left-tailed testÂ **

Suppose we want to find the T critical value for a left-tailed test with a significance level of .05 and degrees of freedom = 22:

import scipy.stats #find T critical value scipy.stats.t.ppf(q=.05,df=22) -1.7171

The T critical value isÂ **-1.7171**. Thus, if the test statistic is less than this value, the results of the test are statistically significant.

**Right-tailed testÂ **

Suppose we want to find the T critical value for a right-tailed test with a significance level of .05 and degrees of freedom = 22:

import scipy.stats #find T critical value scipy.stats.t.ppf(q=1-.05,df=22) 1.7171

The T critical value isÂ **1.7171**. Thus, if the test statistic is greater than this value, the results of the test are statistically significant.

**Two-tailed testÂ **

Suppose we want to find the T critical value for a two-tailed test with a significance level of .05 and degrees of freedom = 22:

import scipy.stats #find T critical value scipy.stats.t.ppf(q=1-.05/2,df=22) 2.0739

Whenever you perform a two-tailed test, there will be two critical values. In this case, the T critical values areÂ **2.0739Â **andÂ **-2.0739**. Thus, if the test statistic is less than -2.0739 or greater than 2.0739, the results of the test are statistically significant.

*Refer to theÂ SciPy documentationÂ for the exact details of the t.ppf() function.*