Skip to content
Prev 17825 / 20628 Next

keeping both numerically and factor coded factors

Following up on my last mail (sorry, I was in a rush earlier today):

As you noted, for lme4::lmer() the double-bar syntax || works as
expected only after converting factor-based to vector-valued
random-effects structures, i.e., after converting factors to numeric
covariates.
There are several ways to do this conversion and the mixed() function
is certainly one of them. Note, however, that the standard formula
syntax of mixed() doesn't allow the user to drop higher-order random
effect terms before lower-order random effect terms by which I mean
dropping randomly varying slopes (e.g. by participant) for
interactions before random slopes for main effects. An alternative
would be to manually create the numeric covariates from the model
matrix. If you are interested in this option, then this [1] RPub by
Reinhold Kliegl explains how you can do this.

[1] https://rpubs.com/Reinhold/22193

Best regards,
Maarten

On Wed, Jul 31, 2019 at 11:10 AM Maarten Jung
<Maarten.Jung at mailbox.tu-dresden.de> wrote: