Home forums ANOVA Some parameters are not estimable, most likely due to empty cells of the design

Tagged: ,

Viewing 3 reply threads
  • Author
    Posts
    • #206
      João Santiago
      Participant

      So 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?

    • #207
      henrik
      Keymaster

      Short 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 the factorize 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.

    • #208
      João Santiago
      Participant

      That did it Henrik, thanks!

      Additionally, I’m having issues running emmeans(): Error in X[ii, ii, drop = FALSE] %*% y[ii] : non-conformable arguments. Running without factorize = 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?

    • #209
      João Santiago
      Participant

      Forgot to add that aov_car did not warn me about centering if the covariates are not centered.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.