I'm estimating a GLM with two categorical variables and their interaction. The outcome is binary (incidence
) and the two variables are group
(2 genotypes) and treatment
(3 levels). My R code for the main model:
model <- glm(incidence ~ group*treatment, data=ags, family="binomial")
Now, I want to determine the main effect for both group
, treatment
and their interaction. I have been teached (or at least this is how I understood it), that you could achieve this for linear models in general by comparing model fits, like so:
model1 <- glm(incidence ~ group + treatment, data=ags, family="binomial")
model2 <- glm(incidence ~ group, data=ags, family="binomial")
model3 <- glm(incidence ~ treatment, data=ags, family="binomial")
# main effect "group:treatment"
anova(model1, model, test = "Chisq")
# main effect "treatement"
anova(model, model2, test = "Chisq")
# main effect "group"
anova(model, model3, test = "Chisq")
Note that for both main effects for both group
and treatment
I compare the full model vs. a model that lacks both the variable of interest as well as the interaction.
Now, an alternative strategy would be to do a Type I, II or III ANOVA, like so:
# example Type I ANOVA
anova(model, test="Chisq")
Would this be preferred over the first method (given that the correct type of ANOVA is used)? And why? Also, to my understanding, my model comparison method is not equal to each of the ANOVA types, correct?