Independent t-test Simulation

Demonstrating the sampling distribution of the difference between two independent sample means ($\bar{X}_2 - \bar{X}_1$). Compare how Standard Error is computed using Welch's vs Student's t-test under different variance and sample size conditions.

Test Type:
Student's $t$
Variances:
Unequal
Sample Sizes:
Unequal

Pop 1: Control

$\mu_1 = 50, \sigma_1 = 5, n_1 = 25$

Pop 2: Treatment

$\mu_2 = 60, \sigma_2 = 20, n_2 = 5$
True Mean Difference: $\mu_2 - \mu_1 = +10$

Current Independent Samples

Waiting to draw Pop 1...
$\bar{X}_1:$ --
$s_1:$ --
Waiting to draw Pop 2...
$\bar{X}_2:$ --
$s_2:$ --
Mean Diff ($\bar{X}_2 - \bar{X}_1$)
--
Student's Est. SE
--

Distributions

0 / 1000 Exp.
Mean Diff ($\bar{X}_2 - \bar{X}_1$)
Mean of Mean Diffs
--
Empirical SE
--
Avg. Student's Est. SE
--
Theoretical SE
~4.34

Standard Error in Independent Groups

Student's t-test assumes equal variances. It calculates a pooled variance ($s_p^2$) which is a weighted average of the two sample variances based on their degrees of freedom ($n-1$).

Student's standard error formula: $$\text{SE} = \sqrt{s_p^2 \left(\frac{1}{n_1} + \frac{1}{n_2}\right)}$$ where $$s_p^2 = \frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2}$$

Notice that because we draw unequal sample sizes ($n_1=15, n_2=10$) and variances ($\sigma_1=10, \sigma_2=20$), the pooled variance leans heavily toward the smaller variance of the larger sample (Pop 1). This causes Student's SE to consistently underestimate the true error!