Anova in Stata

July 27, 2019

Doing analysis of variance (often refered to as ANOVA) in Stata is easy. Let’s begin by finding a suitable dependent variable which should be continuous and an independent categorical type variable.

Let’s load up the nlsw88 data set and see if the mean of wage is the same across race. This is achieved by using a one-way ANOVA of wage against race. Adding the tabulate option will provide some additional information:

oneway wage race, tabulate

Result of one-way anova wage:race

In the bottom table we can see the result of the ANOVA calculation and with a p-value of 0.000 we can safely reject the null hypothesis of equal means across the categories at test. Let’s try another example:

oneway wage industry, tabulate

Again we can see that wages do not seem to be equal across industries either:

Result of one-way anova wage:race


Profile picture

Written by Johan Osterberg who lives and works in Gothenburg, Sweden as a developer specialized in e-commerce. Connect with me on Linkedin

2024 © Johan Osterberg