How to Compute the t-critical Values

tags: #statistics/inferential/ttest

What are t-critical values?

T-critical values are the cut-off values that are used to determine the rejection region of a corresponding t-distribution in a t-test.

The t-critical value is based on the significance level alpha and the degrees of freedom (df) of the t-distribution[1], and the type of hypothesis test being conducted.

To find the t-critical value for a given significance level alpha and degrees of freedom df, you can use the t.ppf() function [2] from the scipy.stats module in Python:

from scipy.stats import t

# finding the critical value
t.ppf(alpha, df) 

# This is the percent-point function (aka quantile function) of the t-distribution

Python: T-critical values for a two-tailed test

The area of rejection is the region in the tails of the t-distribution where the probability is less than α/2 (since the test is two-tailed, we need to split the alpha level in half for each tail), therefore, the t* value is measured as:

tα2

For example, to find the t-critical value for a two-tailed test with alpha=0.05 and df=10, you could use the following code:

from scipy.stats import t

upper_t_crit = t.ppf(1 - 0.05/2, df=10) 
lower_t_crit = t.ppf(0.05/2, df=10) 

Any calculated t-value that falls outside of the range (tcrit,tcrit) would be considered statistically significant at the 0.05 alpha level.

Screen Shot 2023-02-18 at 8.34.16 PM.png500

Python: T-critical values for a one-tailed test

For a one-tailed test, we only need to consider one tail of the t-distribution.

The area of rejection is the region in the tail of the t-distribution where the probability is less than alpha.

E.g., for a one-tailed test in the UPPER tail:

from scipy.stats import t

t_crit = t.ppf(1 - 0.05, df=10)
Why are we subtracting the alpha from 1?

The t.ppf method returns a cumulative probability function from the left of the distribution. Therefore, if we just do t.ppf(0.05, df=10), this will only return the corresponding t-value where the probability corresponds to 0.05, which is the rejection region for the LEFT/LOWER tail.

To get the UPPER TAILED t-critical value, we need to find the corresponding t-value where the probability is 0.95.

Screen Shot 2023-02-18 at 8.45.50 PM.png400

If we want to perform a one-tailed test in the lower tail (i.e., alternative hypothesis is less than), we would use a negative value of the t_crit value:

from scipy.stats import t

t_crit = -t.ppf(0.05, df=10)


  1. The t-distribution is a family of probability distributions that are used in t-tests, and its shape depends on the sample size and degrees of freedom. ↩︎

  2. the t.ppf() function in Python returns the t-value that corresponds to the cumulative probability from the left tail of the distribution. ↩︎

Powered by Forestry.md