Table of Contents
ToggleThe student’s t-distribution is similar to a normal distribution and is used in statistical inference to adjust for uncertainty. It is particularly useful when working with small sample sizes.
Degrees of freedom (df) determine the shape of the t-distribution. Degrees of freedom are calculated as:
df = n – 1
Where n is the sample size.
Use the t.cdf() function in Python’s Scipy Stats library to find the probability for a given t-value:
import scipy.stats as stats
print(stats.t.cdf(2.1, 29))
Or, use the pt() function in R:
pt(2.1, 29)
You can find the t-values of a p-value by using a t-table or with programming. For example, to find the t-value separating the top 25% from the bottom 75% with 29 degrees of freedom:
import scipy.stats as stats
print(stats.t.ppf(0.75, 29))
Or, use the qt() function in R:
qt(0.75, 29)
