Two Sample t-Test for Difference of the Population Means (Equal Variances)

When can this test be used?

  • There are two samples from two populations. (The samples can be different sizes.)
  • The two samples are independent.
  • Both populations are normally distributed or both sample sizes are large enough that the means are normally distributed.
    (A rule of thumb is that the sample size is large enough if n ≥ 15.)
  • Both population standard deviations, σx and σy, are unknown, but are assumed to be equal.


Population Data Mean Standard Deviation Sample Size Sample Mean Sample Standard Deviation
1 xi μx σx n x sx
2 yi μy σy m y sy

How is this test used?

  1. State the hypotheses:
    H0:μx − μy = D
    HA:μx − μy ≠ D or HA:μx − μy > D or HA:μx − μy < D
    The hypothesized difference in the means is D.

    Usually, the hypothesized difference is D = 0. In this case the hypotheses simplify to:
    H0:μx = μy
    HA:μx ≠ μy or HA:μx > μy or HA:μx < μy
  2. Pick a significance level, α.
  3. Compute the test statistic:
    t = ((x − y) − D)/((s2p(1)/(n) + (1)/(m))) = (difference in sample means  − hypothesized difference in population means )/(((pooled variance estimate)(1)/(sample 1 size ) + (1)/(sample 2 size)))
    s2p = ((n − 1)s2x + (m − 1)s2y)/(n + m − 2)
  4. Find the degrees of freedom:
    df = n + m − 2

    The degrees of freedom is the sum of the sample sizes minus 2.


  5. Find the p-value:
    The p-value depends on which alternative hypothesis is being used. The p-value is the probability or the area in the tail(s) of the t distribution with n + m − 2 degrees of freedom.

    If HA:μx − μy > D , p-value = P(T ≥ t)
    figure ttest3.png
    If HA:μx − μy < D , p-value = P(T ≤ t)
    figure ttest4.png
    If HA:μx − μy ≠ D , p-value = P(T ≤  − |t| or T ≥ |t|) or 2P(T ≥ |t|)
    figure ttest5.png
  6. State the conclusion:
    Once the p-value is known, compare it to α, the significance level.
    If the p-value is smaller than α, the observed outcome wasn’t very likely given that the null hypothesis is true. So reject the null hypothesis in favor of the alternative hypothesis.
    If the p-value is greater than α then the observed outcome was likely enough that it is reasonable to assume that the null hypothesis is true so fail to reject the null hypothesis.

p − value < α reject H0
p − value > α fail to reject H0