Below are four steps to conducting a two-sample t-test
1) Write out hypothesis statements (null and alternative)
two-sample:
H0:μ0=μ1
HA:μ=μ1 (two-tailed)
H0:μ0≤μ1
HA:μ0>μ1 (upper-tailed)
H0:μ0≥μ1
HA:μ0<μ1 (lower-tailed)
Such that:
μ0 is sample 1's mean
μ1 is sample 2's mean
2) Plug known values into two-sample t-score formula
two-sample t-score formula:
t−score: ∣t∣=s12/N1+s22/N2Y1ˉ−Y2ˉ
Such that:
N1 and N2 are the sample sizes
Y1ˉ and Y2ˉ are the sample means
s1ˉ2 and s2ˉ2 are the sample variances.
3) Determine the degrees of freedom (df)
The degrees of freedom is the smaller of n1−1 and n2−1
4) Determine the critical value by looking up (tα/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.
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.
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.
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. 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=spn11+n21Xˉ1−Xˉ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 (α) directly influences the conclusions drawn from the t-test. A lower α (e.g., 0.01) makes it harder to reject the null hypothesis compared to a higher α (e.g., 0.05).
In the next lesson, you will learn about unpaired and paired two sample t-tests.