Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

Statistics - Student's T Distribution


The student's t-distribution is similar to a normal distribution and used in statistical inference to adjust for uncertainty.


Student's T Distribution

The t-distribution is used for estimation and hypothesis testing of a population mean (average).

The t-distribution is adjusted for the extra uncertainty of estimating the mean.

If the sample is small, the t-distribution is wider. If the sample is big, the t-distribution is narrower.

The bigger the sample size is, the closer the t-distribution gets to the standard normal distribution.

Below is a graph of a few different t-distributions.

Normal distribution and t-distribtutions with different degrees of freedom.

Notice how some of the curves have bigger tails.

This is due to the uncertainty from a smaller sample size.

The green curve has the smallest sample size.

For the t-distribution this is expressed as 'degrees of freedom' (df), which is calculated by subtracting 1 from the sample size (n).

For example a sample size of 30 will make 29 degrees of freedom for the t-distribution.

The t-distribution is used to find critical t-values and p-values (probabilities) for estimation and hypothesis testing.

Note: Finding the critical t-values and p-values of the t-distribution is similar z-values and p-values of the standard normal distribution. But make sure to use the correct degrees of freedom.



Finding the P-Value of a T-Value

You can find the p-values of a t-value by using a t-table or with programming.

Example

With Python use the Scipy Stats library t.cdf() function find the probability of getting less than a t-value of 2.1 with 29 degrees of freedom:

import scipy.stats as stats
print(stats.t.cdf(2.1, 29))
Try it Yourself »

Example

With R use the built-in pt() function find the probability of getting less than a t-value of 2.1 with 29 degrees of freedom:

pt(2.1, 29)
Try it Yourself »

Finding the T-value of a P-Value

You can find the t-values of a p-value by using a t-table or with programming.

Example

With Python use the Scipy Stats library t.ppf() function 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))
Try it Yourself »

Example

With R use the built-in qt() function find the t-value separating the top 25% from the bottom 75% with 29 degrees of freedom (df):

qt(0.75, 29)
Try it Yourself »

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.