Skip to content
Prev 19086 / 20628 Next

lmer code for multiple random slopes

Dear Peter, Dear All,

The error doesn't say 78 variance components, it says 78 random effects. There are 26 groups in this dataset and you are estimating random intercepts and two sets of random slopes. Hence, there are 3*26 = 78 random effects that are in this model. But the dataset has only 74 rows. This is a check built into lmer() to avoid fitting overly complex models for a given dataset. You can disable this check with (also, use REML=FALSE, not "False"):

M2 <- lmer(Response ~ P + A + (P + A | Group), REML=FALSE, data=Trial, control=lmerControl(check.nobs.vs.nRE="ignore"))

Then it will run and this is the same model as fitted with:

M2n <- lme( Response ~ P + A, random = ~ P + A | Group, data=Trial, method="ML")

The results differ somewhat though, because both packages handle such ill-defined problems in different ways.

Best,
Wolfgang
Message-ID: <e0894da27f994e64863768033e5c4989@UM-MAIL3214.unimaas.nl>
In-Reply-To: <CIYTFe7RNWpkAwUyuCM71pFEfhP-gPVj0OcD-UjLX0LbfzrRbySwMeVxASDMGs6D3aOxqydPUAg1NbZJar32LOtM42U-ZY-03eCCB7JbkUg=@protonmail.com>