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

NA introduced whenm using variable names with spaces in LME4 models #220

Open
Laurent-Smeets-GSS-Account opened this issue Jun 10, 2022 · 1 comment

Comments

@Laurent-Smeets-GSS-Account

Consider the 4 models below. Only the 4th does not work and NA's instead of factor variables names are introduced when adding spaces to variable names (I am doing this to make the output more human friendly to read) in lme4 models, but not in OLS lm() models.

library(lme4)
library(equatiomatic)
sim_longitudinal$`group dummy` <- as.factor(sim_longitudinal$group)
sim_longitudinal$group_dummy <- as.factor(sim_longitudinal$group)

## works
model1 <- lm(score ~ 1 + treatment + group_dummy,
             data = sim_longitudinal)

extract_eq(model1)

## works
model2 <- lm(score ~ 1 + treatment + `group dummy`,
             data = sim_longitudinal)

extract_eq(model2)

## works
model3 <- lmer(score ~ 1 + treatment + group_dummy  + (1|school),
             data = sim_longitudinal)

extract_eq(model3)

## does not work
model4 <- lmer(score ~ 1 + treatment + `group dummy`  + (1|school),
               data = sim_longitudinal)

extract_eq(model4)
@datalorax
Copy link
Owner

Yeah this makes sense to me. We'll probably just need to build another wrapper for these. Thank you for the report!

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