In previous articles, I discussed how to calculate the probability of obtaining data as extreme as those we have observed if the null hypothesis were true. This probability, called the P value, was obtained by first calculating the test statistic. We used this information to conduct a 1-sample z test and a 1-sample t test to see whether there is evidence of a difference in age between our sample mean and the hypothesized population mean.
In this article we will compare 2 means using an independent z test or independent t test.
If we have 2 independent groups with continuous normally distributed outcomes, we can compare their means using a z test if the sample is large enough (n > 30) and the population standard error is known, or using a t test if n < 30.
The 2-sample z test is calculated as follows.
where ˉx1
x ¯ 1
and ˉx2
x ¯ 2
are the sample means for the first and the second groups, respectively; σ1
σ 1
and σ2
σ 2
are the population standard deviations; and n1
n 1
and n2
n 2
are the sample sizes of the respective groups.
In most situations, we assume that the populations have equal but unknown standard deviations: ie, σ1=σ2=σ
σ 1 = σ 2 = σ
. When the experimental units are similar (eg, 2 groups of children) and we have observed all factors that might affect the measurements of the subjects, the assumption of equal variances can be considered realistic. In this case, we estimate the common standard deviation :