Biostatistics Study NotesFrom concepts and derivations to interpretation

CHAPTER 04 · TOPIC 05

Independent Two-Sample t Test

Compare two independent means with Welch or pooled t tests and understand their variance assumptions and degrees of freedom.

On this page
  1. Data Structure
  2. Hypotheses
  3. When variances are different: Welch t-test
  4. When variances are equal: pooled t-test
  5. Testing Procedure
  6. Relationship to One-Way ANOVA

The independent two-sample t-test compares the population means of two unrelated groups for a quantitative variable. One observation unit belongs to only one group, and there is no one-to-one correspondence between groups.

Data Structure#

variableformat
independent variableTwo groups of unrelated categorical variables
dependent variableQuantitative variables whose averages can be calculated
targets for comparisonPopulation mean difference μ₁−μ₂

The two groups cannot be subtracted individually. X̄₁−X̄₂ is a linear combination of independent random variables whose variance is the sum of the variances of each mean.

mean differenceD=Xˉ1Xˉ2D=\bar X_1-\bar X_2
Independent mean difference varianceVar(D)=σ12n1+σ22n2\operatorname{Var}(D)=\frac{\sigma_1^2}{n_1}+\frac{\sigma_2^2}{n_2}

Hypotheses#

two-sidedH0:μ1μ2=0,H1:μ1μ20H_0:\mu_1-\mu_2=0,\qquad H_1:\mu_1-\mu_2\ne0
right-tailedH0:μ1μ20,H1:μ1μ2>0H_0:\mu_1-\mu_2\leq0,\qquad H_1:\mu_1-\mu_2>0
left-tailedH0:μ1μ20,H1:μ1μ2<0H_0:\mu_1-\mu_2\geq0,\qquad H_1:\mu_1-\mu_2<0

When variances are different: Welch t-test#

Estimated variance of mean differenceVar^(Xˉ1Xˉ2)=s12n1+s22n2\widehat{\operatorname{Var}}(\bar X_1-\bar X_2)=\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}
Welch tt=(Xˉ1Xˉ2)Δ0s12/n1+s22/n2t=\frac{(\bar X_1-\bar X_2)-\Delta_0}{\sqrt{s_1^2/n_1+s_2^2/n_2}}
Welch–Satterthwaite degrees of freedomν(s12/n1+s22/n2)2(s12/n1)2n11+(s22/n2)2n21\nu\approx\frac{\left(s_1^2/n_1+s_2^2/n_2\right)^2}{\dfrac{(s_1^2/n_1)^2}{n_1-1}+\dfrac{(s_2^2/n_2)^2}{n_2-1}}

When variances are equal: pooled t-test#

pool distributionsp2=(n11)s12+(n21)s22n1+n22s_p^2=\frac{(n_1-1)s_1^2+(n_2-1)s_2^2}{n_1+n_2-2}
pooled standard errorSEp=sp2(1n1+1n2)\operatorname{SE}_p=\sqrt{s_p^2\left(\frac1{n_1}+\frac1{n_2}\right)}
Pooled tt=(Xˉ1Xˉ2)Δ0sp2(1/n1+1/n2),ν=n1+n22t=\frac{(\bar X_1-\bar X_2)-\Delta_0}{\sqrt{s_p^2(1/n_1+1/n_2)}},\qquad \nu=n_1+n_2-2
methodVariance assumptiondegree of freedom
Welch tDo not require σ₁²=σ₂²Welch–Satterthwaite approximation
Pooled tAssuming σ₁²=σ₂²n₁+n₂−2

Testing Procedure#

  1. Confirm the independence and quantitative data of the two groups
  2. Set H₀, H₁, direction, α
  3. Calculate n, X̄, s for each group and choose Welch or pooled
  4. Find and interpret p-value from t and degrees of freedom

Relationship to One-Way ANOVA#

When using the same equal variance model with two independent groups, the t-test and one-way ANOVA give the same significance conclusion.

F=t2F=t^2