Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Paired t-test | What Is Hypothesis Testing?
Quizzes & Challenges
Quizzes
Challenges
/
Applied Hypothesis Testing & A/B Testing

bookPaired t-test

A paired t-test is a statistical method used to compare the means of two related groups. You use this test when you have two measurements from the same subjects, such as before-and-after results for a treatment or matched pairs in an experiment. The paired t-test helps you determine if the average difference between these paired observations is significantly different from zero.

You should use a paired t-test when:

  • You measure the same group of subjects twice, such as before and after an intervention;
  • You have matched pairs, like twins or matched subjects, where each pair experiences both conditions;
  • The data points in one group are directly related to those in the other group.

This is different from an independent t-test, which is appropriate when comparing two unrelated groups. The paired t-test accounts for the fact that the data points are not independent, which increases statistical power and reduces variability due to subject differences.

The function ttest_rel from scipy.stats is used to perform the paired t-test in Python. This function compares two related samples and calculates whether their means are significantly different, based on the differences between paired observations.

123456789101112
import numpy as np from scipy.stats import ttest_rel # Example: Before and after test scores for the same students before_scores = np.array([78, 85, 69, 90, 88, 76, 95, 80]) after_scores = np.array([82, 88, 70, 92, 91, 78, 97, 85]) # Perform paired t-test t_stat, p_value = ttest_rel(after_scores, before_scores) print(f"T-statistic: {t_stat:.3f}") print(f"P-value: {p_value:.4f}")
copy
question mark

Which of the following scenarios is most appropriate for a paired t-test, rather than an independent t-test?

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 8

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

Awesome!

Completion rate improved to 3.23

bookPaired t-test

Scorri per mostrare il menu

A paired t-test is a statistical method used to compare the means of two related groups. You use this test when you have two measurements from the same subjects, such as before-and-after results for a treatment or matched pairs in an experiment. The paired t-test helps you determine if the average difference between these paired observations is significantly different from zero.

You should use a paired t-test when:

  • You measure the same group of subjects twice, such as before and after an intervention;
  • You have matched pairs, like twins or matched subjects, where each pair experiences both conditions;
  • The data points in one group are directly related to those in the other group.

This is different from an independent t-test, which is appropriate when comparing two unrelated groups. The paired t-test accounts for the fact that the data points are not independent, which increases statistical power and reduces variability due to subject differences.

The function ttest_rel from scipy.stats is used to perform the paired t-test in Python. This function compares two related samples and calculates whether their means are significantly different, based on the differences between paired observations.

123456789101112
import numpy as np from scipy.stats import ttest_rel # Example: Before and after test scores for the same students before_scores = np.array([78, 85, 69, 90, 88, 76, 95, 80]) after_scores = np.array([82, 88, 70, 92, 91, 78, 97, 85]) # Perform paired t-test t_stat, p_value = ttest_rel(after_scores, before_scores) print(f"T-statistic: {t_stat:.3f}") print(f"P-value: {p_value:.4f}")
copy
question mark

Which of the following scenarios is most appropriate for a paired t-test, rather than an independent t-test?

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 8
some-alt