Solved – R – Test for homogeneity of regression slopes results in singular model

I am trying to check the assumptions of a two-way ANCOVA.
So in my model I have

  • two factors (F1, F2)
  • one dummy coded two level covariate (C)
  • one dependent variable (D)

In order to check the assumption of homogeneity of regression slopes I tried
to perform an ANOVA with type 3 sums for the model D ~ F1*F2*C to see whether any
interactions with the covariate might be significant.
Using the Anova function from the car package this corresponds to

modd<-aov(D~F1*F2*C) Anova(modd,type=3) 

However, I encounter the following Error message:

Error in Anova.III.lm(mod, error, singular.ok = singular.ok, ...) :   there are aliased coefficients in the model 

My question is, whether it makes sense for the homogeneity test to force R to compute the
ANOVA anyway by supplying the singular.ok=T option or what else I should do in order to
check the assumption.

Since C is a dummy variable with 2 levels, it really is like a factor, and your data is then a 3-factor experiment. Since there is singularity, it means that some of the cells (combinations of F1, F2, and C) are not represented in the data. Use the table function to find out which combinations have zero frequency, and maybe that can help you decide what might be a simpler model. And/or look at coef(modd) and see which coefficients are NA, corresponding to predictors that were thrown out.

Thinking about C as a covariate rather than a factor may just be adding confusion.

Similar Posts:

Rate this post

Leave a Comment