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

bookWhat Is a t-test

The t-test is a fundamental statistical method for determining whether there is a significant difference between the means of two groups.

Origin of the t-test

  • Developed by William Sealy Gosset in the early 20th century;
  • Published under the pseudonym "Student," leading to the name "Student's t-test";
  • Created to address quality control problems at the Guinness Brewery, especially when working with small sample sizes and unknown population variances.

When to use a t-test

Use a t-test when you want to compare the means of two groups to see if they are statistically different from each other. This is especially useful in these scenarios:

  • Small sample sizes;
  • Unknown population standard deviation;
  • Comparing test scores between two classes;
  • Evaluating the effect of a treatment versus a control group;
  • Analyzing results from an A/B test in product development.
123456789101112131415161718192021222324252627
# Calculate the t-statistic manually for two small samples import numpy as np # Sample data: group A and group B group_a = np.array([12, 15, 14, 10, 13]) group_b = np.array([16, 18, 14, 17, 15]) # Calculate means mean_a = np.mean(group_a) mean_b = np.mean(group_b) # Calculate sample variances var_a = np.var(group_a, ddof=1) var_b = np.var(group_b, ddof=1) # Sample sizes n_a = len(group_a) n_b = len(group_b) # Calculate pooled standard deviation pooled_std = np.sqrt(((n_a - 1) * var_a + (n_b - 1) * var_b) / (n_a + n_b - 2)) # Calculate t-statistic t_stat = (mean_a - mean_b) / (pooled_std * np.sqrt(1/n_a + 1/n_b)) print("t-statistic:", round(t_stat, 3))
copy
question mark

When should you use a t-test instead of a z-test or a chi-square test?

Select the correct answer

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 2

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

Suggested prompts:

What does the t-statistic value mean in this context?

How do I interpret the result of this t-test?

Can you explain the steps in the calculation?

Awesome!

Completion rate improved to 3.23

bookWhat Is a t-test

Svep för att visa menyn

The t-test is a fundamental statistical method for determining whether there is a significant difference between the means of two groups.

Origin of the t-test

  • Developed by William Sealy Gosset in the early 20th century;
  • Published under the pseudonym "Student," leading to the name "Student's t-test";
  • Created to address quality control problems at the Guinness Brewery, especially when working with small sample sizes and unknown population variances.

When to use a t-test

Use a t-test when you want to compare the means of two groups to see if they are statistically different from each other. This is especially useful in these scenarios:

  • Small sample sizes;
  • Unknown population standard deviation;
  • Comparing test scores between two classes;
  • Evaluating the effect of a treatment versus a control group;
  • Analyzing results from an A/B test in product development.
123456789101112131415161718192021222324252627
# Calculate the t-statistic manually for two small samples import numpy as np # Sample data: group A and group B group_a = np.array([12, 15, 14, 10, 13]) group_b = np.array([16, 18, 14, 17, 15]) # Calculate means mean_a = np.mean(group_a) mean_b = np.mean(group_b) # Calculate sample variances var_a = np.var(group_a, ddof=1) var_b = np.var(group_b, ddof=1) # Sample sizes n_a = len(group_a) n_b = len(group_b) # Calculate pooled standard deviation pooled_std = np.sqrt(((n_a - 1) * var_a + (n_b - 1) * var_b) / (n_a + n_b - 2)) # Calculate t-statistic t_stat = (mean_a - mean_b) / (pooled_std * np.sqrt(1/n_a + 1/n_b)) print("t-statistic:", round(t_stat, 3))
copy
question mark

When should you use a t-test instead of a z-test or a chi-square test?

Select the correct answer

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 2
some-alt