Read · 1 min

Making Sense of Two-Sample T-Tests

Below are four steps to conducting a two-sample t-test

1) Write out hypothesis statements (null and alternative)

two-sample:


H0:μ0=μ1H_0: \mu_0 = \mu_1

HA:μ≠μ1H_A: \mu \neq \mu_1 (two-tailed)


H0:μ0≤μ1H_0: \mu_0 \leq \mu_1

HA:μ0>μ1H_A: \mu_0 > \mu_1 (upper-tailed)


H0:μ0≥μ1H_0: \mu_0 \geq \mu_1

HA:μ0<μ1H_A: \mu_0 < \mu_1 (lower-tailed)

Such that:

μ0\mu_0 is sample 1's mean

μ1\mu_1 is sample 2's mean

2) Plug known values into two-sample t-score formula


two-sample t-score formula:

t−scoret-score: ∣t∣=Y1ˉ−Y2ˉs12/N1+s22/N2|t|=\frac{\bar{Y_1}−\bar{Y_2}}{\sqrt{s_1^2/N_1+s_2^2/N_2}}

Such that:

N1N_1 and N2N_2 are the sample sizes

Y1ˉ\bar{Y_1} and Y2ˉ\bar{Y_2} are the sample means

s1ˉ2\bar{s_1}^2 and s2ˉ2\bar{s_2}^2 are the sample variances.


3) Determine the degrees of freedom (dfdf)

The degrees of freedom is the smaller of n1−1n_1 - 1 and n2−1n_2-1

4) Determine the critical value by looking up (tα/2,dft_{\alpha/2, df}) in a t-table

5) T-Test Conclusion/Significance (Reject Null Hyp. or Fail to Reject Null Hyp)

If the absolute value of the t-value is greater than the critical value, you reject the null hypothesis. If the absolute value of the t-value is less than the critical value, you fail to reject the null hypothesis.

Read · 1 min

Two-Sample T-Test Example

Question: We have two groups of students from schools with different instructional methods. We’re interested if there is a difference in their attention span times. At school 1, our sample of 25 1st graders had an average time of 12.8min (SD: 1.6 min); at school 2, 20 1st graders had an average time of 11.5min (SD: 2.0 min). Assume α=0.05\alpha = 0.05.

1) Write out null and alternative hypothesis statements:

Because we are simply looking for a difference between two group means and not whether or not one is greater or smaller than another, this is a two-tailed two-sample test.

H0H_0: μ1=μ2\mu_1 = \mu_2

HAH_A: μ1≠μ2\mu_1 \neq \mu_2

2) Plug in known values into t-score formula

Known values:

N1=25N_1 = 25

N2=20N_2 = 20

Y1ˉ=12.8\bar{Y_1} = 12.8

Y2ˉ=11.5\bar{Y_2} = 11.5

s1ˉ2=1.62=2.56\bar{s_1}^2 = 1.6^2 = 2.56

s2ˉ2=22=4\bar{s_2}^2 = 2^2 = 4

t-statistic: ∣t∣=12.8−11.52.56/25+4/20=1.3/0.5499=2.364|t|=\frac{12.8−11.5}{\sqrt{2.56/25+4/20}} = 1.3/0.5499 = 2.364

3) Figure out the degrees of freedom parameter (dfdf)

The degrees of freedom is the smaller of (25−125-1) and (20−120-1), hence df=19df = 19.

4) Determine the critical value

Because this is a two-tailed test, we must divide our α=0.05\alpha = 0.05 by 2 before looking up the critical value (t0.025,19t_{0.025, 19}) in a t-table

Hence, our critical value = t0.025,19t_{0.025, 19} = 2.09302

5) Determine significance of results and whether or not to reject the null or fail to reject the null

Because our t-value is greater than our critical value (2.364>2.093022.364 > 2.09302), we have significant evidence to reject the null hypothesis.

There's a handy t-table by San Jose State University for you to keep in your back pocker!

Video

(Video) Two Sample t-Tests

by MarinStatsLectures

In this video by MarinStatsLectures, you will learn the basics of the two sample t-test.

Read · 2 min

We've learned about the basics of [t-tests]https://www.expii.com/t/statistics-what-is-a-t-test-5360) and we've learned about the one sample t-test.

In this next lesson, we will learn about two sample t-tests.

Two Sample t-Tests

In statistics, we will use the two sample t-test when we want to test whether the population means of two independent groups are equal or not. For example, if we want to compare two coffee shops in a nearby shopping complex, we can use a two samples t-test to compare survey answers. We can use the two samples t-test when two groups are independent, when the data is randomly sampled, and when the two groups have equal variances.

The t-statistic, which uses the standard error in its calculation, helps determine if the difference between the sample means is statistically significant.

Independent samples: The two groups being compared should be independent of each other, meaning the sample from one group does not influence the sample from the other group.

We can make a few assumptions when calculating a two samples t-test:

  • Normality: The data in each group should be approximately normally distributed, especially for small sample sizes.
  • Equal Variances: The variances of the two groups should be roughly equal (homogeneity of variance). If this assumption is violated, you can use a variant of the t-test that doesn’t assume equal variances, such as Welch’s t-test.
  • Random Sampling: The samples should be drawn randomly from the populations.

Recall that the null hypothesis says that there is no difference between group means. Mathematically, we can say that: μ1=μ2\mu_1 = \mu_2. The alternative hypothesis says that there is a difference between group means.

In general, while two samples t-test apply to both small and large samples, the sample size will affect the results. The two-sample t-test is more robust with larger samples due to the Central Limit Theorem, making it less sensitive to deviations from normality. Also, large samples can often tolerate violations of the equal variance assumption, but using Welch’s t-test is advisable when variances differ significantly. Lastly, larger sample sizes enhance the power of the test, leading to a greater likelihood of detecting significant differences when they exist.

Formula

Luckily, there is a formula that can help us with this concept!

t=Xˉ1−Xˉ2sp1n1+1n2t = \frac{\bar{X}_1 - \bar{X}_2}{s_p \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}}

Even more luckily, statistical software can tackle this task for us.

Looking Further

The pooled standard deviation allows for a more robust estimation of variability, leading to more accurate hypothesis testing. If the variances are not equal, using the pooled standard deviation could lead to incorrect conclusions, so Welch’s t-test should be used instead.

The choice of significance level (α\alpha) directly influences the conclusions drawn from the t-test. A lower α\alpha (e.g., 0.010.01) makes it harder to reject the null hypothesis compared to a higher α\alpha (e.g., 0.050.05).

In the next lesson, you will learn about unpaired and paired two sample t-tests.

Type a concept, like “slope” or “photosynthesis”.

↑ ↓ to choose · Enter to openSearch explanations and problems