'LME with Random effects R code error message?

I'm trying to create a random mixed effects model with CCT as the outcome and time*behavior as the main predictor interaction term. I'm having a hard time running the model, as this is my code and it keeps saying "unused argument" error message. I'm using the variable ID as the random effects variable, and this is my code. thank you!

model.set$f <- with(model.set, ID)
m <- lmer(CCT ~ time*behavior, random = ~ 1|f, data = model.set)
r


Solution 1:[1]

The argument causing the error in your command is random: when using the function lme4::lmer, there is no "random" argument, the random effect is part of the main formula. The syntax you are using is specific to the function nlme::lme, which has a "random" argument to define random effects. See here for examples.

The following command should run without error:

m <- lmer(CCT ~ time * behavior + (1|f), data = model.set)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1