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
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 (

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)
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.

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)