Running ANCOVAs in Stata
Like SPSS, Stata makes adding continuous variables to the ANOVA model simple. Recalling for a moment that the basic command is anova [dependent variable] [indep variables], [options]
adding covariates is just one of these options. In fact, in order to minimize how long the command gets, you can specify your variables in one of two ways:
The first method involves telling Stata which variables are continuous, and is done via the continuous
option. In practice, that might look something like anova intrinsi gpa sex ethnicit grade sex*ethnicit ethnicit*grade sex*grade sex*ethnicit*grade, continuous(gpa)
In this case it makes sense to specify the continuous variable because there is only one. Also in this case, because one variable was specified as continuous, Stata assumes that all the other variables are categorical. Remember, if no options are specified, Stata assumes that all the variables are categorical.
The command above yields the following output:
The other option is to specify the categorical variables, at which point Stata will assume the rest are continuous. The command for doing so is quite similar to the above, with one key difference. which is the categorical
option. In this case the final command will look as follows anova intrinsi gpa sex ethnicit grade sex*ethnicit ethnicit*grade sex*grade sex*ethnicit*grade, category(sex ethnicit grade)
The output for this command is exactly the same as above. While it does not make a lot of sense to use category
with this example, the general idea is simply to specify whichever option requires the least typing.
If you prefer to use the menus, you can go Statistics=>Linear Models and Related => ANOVA/MANOVA => Analysis of variance and covariance which is pretty straightforward
Back to ANOVA