Solved – How to set up ANCOVA with two categorical variables

ancovacategorical datacontinuous data

I have a dataset of Geese body masses in two locations over a 100 day study period. I am interested in examining how mean body mass changes over study period and if there is a difference between the two locations. To do this, I want to run an Analysis of Co-variance with Mass as the response variable, day as a continuous independent variable, and location as a categorical independent variable, with an interaction term between day and location. However, as goose body size is correlated to gender, I also need to include a categorical variable for sex.

I have the capability to run this in R or SAS, I just am confused as how to get started.

Best Answer

ANCOVA is just a limited regression model. So, you can simply run a regression model, which allows for continuous and categorical variables. In R, your analysis might look like this:

fit <- lm(Mass ~ day + location + day:location + sex, data = goose.data)
summary(fit)
Related Question