📘 Two-Sample t-Test & Paired t-Test
We will explore the differences between the two tests, their use cases, and how to apply them effectively.
🔹 Two-Sample t-Test
The two-sample t-test compares the means of two independent groups to determine if there is a statistically significant difference between them.
Use case: When you have two groups, and you want to compare their means.
Assumptions:
- Both samples are independent of each other.
- The data in each group is normally distributed.
- The variance in each group is approximately equal (homogeneity of variance).
Formula:
\[ t = \frac{\bar{x_1} - \bar{x_2}}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}} \]
Where:
- \(\bar{x_1}, \bar{x_2}\) = sample means of the two groups
- \(s_1^2, s_2^2\) = sample variances of the two groups
- n₁, n₂ = sample sizes of the two groups
Degrees of freedom:
\[ df = n_1 + n_2 - 2 \]The degrees of freedom (df) determine the shape of the t-distribution used to find the p-value.
🔍 Example
We want to test whether there is a difference in exam scores between students who study with a new method (Group 1) and those who study traditionally (Group 2).
Given:
- Group 1: Mean = 75, SD = 10, n = 30
- Group 2: Mean = 70, SD = 12, n = 30
Step 1: Calculate the test statistic (t):
\[ t = \frac{75 - 70}{\sqrt{\frac{10^2}{30} + \frac{12^2}{30}}} = \frac{5}{\sqrt{\frac{100}{30} + \frac{144}{30}}} = \frac{5}{\sqrt{8.05}} \approx 1.77 \]Step 2: Degrees of Freedom (df):
\[ df = 30 + 30 - 2 = 58 \]Step 3: Compare with critical value
Using a t-table with df = 58, find the critical t-value at α = 0.05. If t > critical value, reject H₀.
Conclusion: Based on the test statistic and p-value, we decide whether to reject H₀ or not.
🔹 Paired t-Test
The paired t-test compares the means of two related groups (or measurements) to determine if there is a significant difference.
Use case: When the two groups are related or dependent. For example, comparing the scores of students before and after a course.
Assumptions:
- The samples are dependent (paired observations).
- The data in each pair is normally distributed.
- The differences between pairs are independent.
Formula:
\[ t = \frac{\bar{d}}{\frac{s_d}{\sqrt{n}}} \]
Where:
- \(\bar{d}\) = Mean of the differences between paired observations
- sₖ = Standard deviation of the differences between paired observations
- n = Number of pairs
Degrees of freedom:
\[ df = n - 1 \]🔍 Example
We want to test if a diet plan changes the average weight of individuals. We measure the weight of 10 individuals before and after the diet.
Given:
- Before diet (X₁): 80, 85, 90, 92, 94, 96, 98, 100, 105, 110
- After diet (X₂): 78, 83, 88, 90, 93, 95, 97, 98, 104, 109
Step 1: Calculate the differences (d = X₂ - X₁):
- 2, 2, 2, 2, 1, 1, 1, 2, 1, 1
Step 2: Calculate the mean and standard deviation of the differences:
\[ \bar{d} = \frac{2 + 2 + 2 + 2 + 1 + 1 + 1 + 2 + 1 + 1}{10} = 1.5 \] \[ s_d = \sqrt{\frac{\sum (d_i - \bar{d})^2}{n-1}} \approx 0.5 \]Step 3: Calculate the t-statistic:
\[ t = \frac{1.5}{\frac{0.5}{\sqrt{10}}} = \frac{1.5}{0.158} \approx 9.49 \]Step 4: Compare with critical value
If the calculated t-statistic exceeds the critical t-value at α = 0.05, reject the null hypothesis.
Conclusion: Based on the test statistic, we determine if the diet plan significantly reduces weight.
🔄 Comparison: Two-Sample t-Test vs Paired t-Test
| Test | Use | Formula | Assumptions |
|---|---|---|---|
| Two-Sample t-Test | Compare means of two independent groups | \(\frac{\bar{x_1} - \bar{x_2}}{\sqrt{\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}}}\) | Independent samples, normal distribution, equal variances |
| Paired t-Test | Compare means of two related groups | \(\frac{\bar{d}}{\frac{s_d}{\sqrt{n}}}\) | Paired data, normal distribution of differences |
🧠 Key Insights
- The two-sample t-test compares the means of two independent groups.
- The paired t-test compares the means of two related or dependent groups.
- Both tests assume normality and use the t-distribution.
- Understanding which test to apply depends on the structure of the data (independent vs dependent groups).