equatiomatic icon indicating copy to clipboard operation
equatiomatic copied to clipboard

"Error: {equatiomatic} only supports models where each random effect has a corresponding fixed effect."

Open arthur-albuquerque opened this issue 3 years ago • 3 comments

Hi, I am having an issue trying to use equatiomatic with lme4, please see below:

d = 
  dplyr::tribble(
  ~study, ~treat, ~n, ~event, ~control,
  1, 0, 377, 113, 1,
  1, 1, 377, 128, 0,
  2, 0, 40, 4, 1,
  2, 1, 41, 6, 0,
  3, 0, 100, 20, 1,
  3, 1, 101, 22, 0,
  4, 0, 1010, 201, 1,
  4, 1, 1001, 241, 0
) 


m1 = 
  lme4::glmer(
  cbind(event, n - event) ~ 1 + factor(treat) + (control + treat - 1|study),
  data=d,
  family=binomial(link="logit"))

summary(m1)

equatiomatic::extract_eq(m1)

I get this error message: Error: {equatiomatic} only supports models where each random effect has a corresponding fixed effect. You specified the following variables as randomly varying without including the corresponding fixed effect: control, treat

Would it be possible to add support for this type of model?

Thanks!

arthur-albuquerque avatar Oct 19 '21 13:10 arthur-albuquerque

Hi - the issue here is that you are estimating an intercept in the fixed effects portion of the model but not in the random effects portion of the model.

If I were to add support for this model, how would you expect the rendered equation to look?

datalorax avatar Oct 19 '21 16:10 datalorax

Hi! I see. The model was extracted from this article, section: "Model 6: the “Van Houwelingen bivariate” model".

Honestly, I am an inexperienced medical student, so I am not sure I can be of any help, but the article above describes the model.

arthur-albuquerque avatar Oct 19 '21 16:10 arthur-albuquerque

Thanks, I'll take a look and see if I can figure it out.

datalorax avatar Oct 19 '21 18:10 datalorax