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

Simple slopes fails for nlme models when nlme library not imported #21

Open
jeff-hughes opened this issue Jun 11, 2024 · 0 comments
Open

Comments

@jeff-hughes
Copy link
Owner

Reproducible example:

set.seed(123)
pre_treat <- rnorm(50)
post_treat <- 2 + rnorm(50)
pre_control <- rnorm(50)
post_control <- rnorm(50)
dv <- c(pre_treat, post_treat, pre_control, post_control)

pre_post <- factor(rep(c(rep(0, 50), rep(1, 50)), 2))
condition <- factor(c(rep(0, 100), rep(1, 100)))
id <- c(rep(1:50, 2), rep(51:100, 2))

data <- data.frame(id, condition, pre_post, dv)

model <- nlme::lme(dv ~ condition * pre_post, random=~1|id, data)
slopes <- reghelper::simple_slopes(model)

Code fails with error:

Error in lme.formula(fixed = dv ~ condition * pre_post, data = mdata, : could not find function "lme.formula"

Importing nlme library first with library(nlme) seems to correct the issue.

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

1 participant