ARCHIVED: In Stata, how do I conduct a t-test when two samples have unequal variances?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

Comparing the means of two independent samples requires three assumptions: independence, normality, and equal variance. When the equal variance assumption is not satisfied, a pooled variance is no longer valid.

The .ttest command also has the unequal option, which produces Satterthwaite's or Welch's approximation for the degree of freedom. This makes a t-test valid even in a case of unequal variances. Consider the following example:

  .ttest math, by(gender) unequal

The unequal option above indicates that variances of the two groups are different. By default, the unequal option computes Satterthwaite's approximation instead of the usual degree of freedom. You also can calculate Welch's approximation using the welch option, as follows:

  .ttest math=stats, unpaired unequal welch

In the above example, the unpaired option indicates that the two variables are independent. The welch option also works if the unequal option is not specified on the command line.

If you have questions about using statistical and mathematical software at Indiana University, contact the UITS Research Applications and Deep Learning team.

This is document aluo in the Knowledge Base.
Last modified on 2023-05-09 14:37:10.