Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
arthur-albuquerque opened this issue Oct 19, 2021 · 3 comments

Comments

@arthur-albuquerque
Copy link

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!

@datalorax
Copy link
Owner

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?

@arthur-albuquerque
Copy link
Author

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.

@datalorax
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants