kosukeimai / mediation

R package mediation
58 stars 29 forks source link

Error in mediate function when fitting multilevel mediation analysis with crossed random factors #55

Open bamaly opened 1 year ago

bamaly commented 1 year ago

I was trying to fit a multilevel mediation analysis with crossed random factors using the mediate function from the mediation package in R. For the med.fit and out.fit models, I used lmer. However, I received the following error message:

"Error in mediate(med.fit, out.fit, treat = "condition_numfct", mediator = "attr_rating", : mediate does not support more than two levels per model."

I am not sure, but I suspect that this error may be due to the mediate function not supporting crossed random factors. Can anyone confirm this? If so, does anyone know of any alternative packages or functions that can handle multilevel mediation analyses with crossed random factors?

Thank you for any help or insights you can provide!