Skip to content
Prev 17824 / 20628 Next

keeping both numerically and factor coded factors

Dear Elisa,

if you just want use the RePsychLing::rePCA() function on objects
return by the afex::mixed() function, you can simply set the *return*
argument of the mixed() function to "merMod". This will work, but -
somewhat counter-intuitively - make the mixed() function return an
object of class lmerModLmerTest as mixed(), by default, uses
lmerTest::lmer() for its calculations.
If you really need a merMod object, then you need to set
afex_options(lmer_function = "lme4") before calling mixed().

library("afex")
library("RePsychLing")

d <- lme4::sleepstudy
d$Days <- cut(d$Days, breaks = 2, labels = c("first_half", "second_half"))

set_sum_contrasts()

# optional: make mixed() return a merMod object
# afex_options(lmer_function = "lme4")

m1 <- mixed(formula = Reaction ~ Days + (Days || Subject),
                     data = d,
                     expand_re = TRUE,
                     return = "merMod")

summary(rePCA(m1))

Best regards,
Maarten

On Wed, Jul 31, 2019 at 10:14 AM MONACO Elisa via R-sig-mixed-models
<r-sig-mixed-models at r-project.org> wrote:
On Wed, Jul 31, 2019 at 10:14 AM MONACO Elisa via R-sig-mixed-models
<r-sig-mixed-models at r-project.org> wrote: