Home › forums › ANOVA › Some parameters are not estimable, most likely due to empty cells of the design
Tagged: ANOVA, unbalanced
- This topic has 3 replies, 2 voices, and was last updated 5 years, 7 months ago by
João Santiago.
-
AuthorPosts
-
-
February 21, 2018 at 13:56 GMT+0000 #206
João Santiago
ParticipantSo I’m having this error:
Error in aov_car(value ~ treatment * sex + age + smoker + BMI + Error(ID/treatment), : Some parameters are not estimable, most likely due to empty cells of the design (i.e., structural missings). Check your data.
Losing the BMI variable fixes it, but I would rather keep it (makes sense to adjust for it). There are no NAs in my data, BMI is of type numeric. I tried adding
na.rm = TRUE
but it did nothing. The data is not balanced (not the same number of women and men, smokers and non-smokers, but same number of treatment A and treatment B). This is complete within design, so each participant took part in two conditions. Data has one observation per row (total of 2*n rows).Anything else I can try, besides dropping BMI?
-
February 21, 2018 at 17:24 GMT+0000 #207
henrik
KeymasterShort answer: You have to set
factorize = FALSE
.Longer answer:
afex
‘s default behavior is to assume that the user wants an ANOVA and so transforms all variables to factors. This is what likely happens in your case. To turn this off, use thefactorize
argument.The help page (
?aov_car
) further specifies:To run an ANCOVA you need to set
factorize = FALSE
and make sure that all variables have the correct type (i.e., factors are factors and numeric variables are numeric and centered).This is most likely what you want to do.
-
February 22, 2018 at 10:38 GMT+0000 #208
João Santiago
ParticipantThat did it Henrik, thanks!
Additionally, I’m having issues running emmeans():
Error in X[ii, ii, drop = FALSE] %*% y[ii] : non-conformable arguments
. Running withoutfactorize = FALSE
makes no difference, so I guess it has nothing to do with that. emmeans works fine with lmer output, as a control.A bit off-topic, but I forgot to center my variables. Now I did and the p-values for treatment changed by a lot. Wasn’t that not suppose to happen? Or is this normal for sum.contrasts?
-
February 22, 2018 at 17:40 GMT+0000 #209
João Santiago
ParticipantForgot to add that aov_car did not warn me about centering if the covariates are not centered.
-
-
AuthorPosts
- You must be logged in to reply to this topic.