Paired t-Test

This lesson will focus on how to perform the paired t-test in Python.

We'll cover the following

Paired t-test

A paired t-test checks whether the means of the same sample differ at two different times. We can use the function ttest_rel from the scipy.stats module to perform the paired t-test.

We will check the mean of grades for two exams, G1 and G3. G1 is the result of the exam after the first quarter and G3 is the result of exam at the end of the year. We will check if the mean grades differ for the same sample at different times.

Null hypothesis H0H_0: x1ˉ=x2ˉ\bar{x_1} = \bar{x_2}

Alternate hypothesis HaH_a: x1ˉx2ˉ\bar{x_1} \neq \bar{x_2}

We choose α\alpha to be at 95%95\% confidence level which means α=1(conf.level)=10.95=0.05\alpha =1 - (conf.level) = 1 - 0.95 = 0.05

Get hands-on with 1200+ tech skills courses.