0

I am running a random effects mediation analysis using lme4::lmer and the model converged. However, when using

FEmatrix <- coef(medmodelsummary)

to extract the fixed effects, I got the following error message:

Error in switch(chain, 1 = -10, 2 = 10) : 
EXPR must be a length 1 vector 

I am not sure what this means and can anyone give me a hint on this?

thank you.

Rui Barradas
  • 70,273
  • 8
  • 34
  • 66
  • 1
    `methods(class="merMod")` shows a `coef` method, can you post the code used to produce the object `medmodelsummary`? Is it the output of `summary(lmer_fit)`, where `lmer_fit` has the obvious meaning? – Rui Barradas Jun 04 '20 at 16:57

1 Answers1

0

How about fixef()? For example: https://rdrr.io/cran/lme4/man/fixef.html

library(lme4)    
fm2 <- lmer(Reaction ~ Days + Days2 + (1|Subject),
                data=transform(sleepstudy,Days2=Days))

fixef(fm2,add.dropped=TRUE)

Prasanna S
  • 353
  • 1
  • 10