[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-sig-mixed-models
Subject:    [R-sig-ME] R-sig-mixed-models mailing list submissions: Crossed Random Factors Mediation
From:       <basil.maly () unibe ! ch>
Date:       2023-07-04 13:02:42
Message-ID: GV0P278MB1144CC466BD9BA2709B5E415E82EA () GV0P278MB1144 ! CHEP278 ! PROD ! OUTLOOK ! COM
[Download RAW message or body]

Dear colleagues

I would like to calculate a multilevel mediation using a linear multilevel model with \
crossed random factors. The code for the model is as follows:

### R-Code:

model <- lmer(outcome ~ condition + rating + (1|id) + (1|stimulusid), data = dat, \
REML = TRUE)


I am not aware of any mediation package in R that can compute mediation with crossed \
random factors. Also, Lavaan does not support models with crossed random factors. \
Therefore, I aimed to implement the indirect effect test with BootMer by myself. I \
would like to use the semi-parametric bootstrapping. This is my attempt so far:

### R-Code:
function_indirect_effect <- function(x) {
                                                                 \
fixef(x)[2]*fixef(x)[3] }

boots <- bootMer(model,
               FUN = function_indirect_effect,
               use.u = FALSE,
type = "parametric",
nsim = 1000)

boots <- bootMer(model,
               FUN = function_indirect_effect,
               use.u = TRUE,
type = "semiparametric",
nsim = 1000)

However, the semi-parametric bootstrapping does not work, and only NAs are produced \
(“Warning: some bootstrap runs failed (1000/1000)”). The problem is probably the \
simulation of the random effects (‘use.u = TRUE’), since parametric bootstrapping \
doesn't work in this case either.


Does anyone have a hint what this could be due to and how I could fix the? Or does \
anyone know another way/package to compute and test the indirect effect?

Thanks for your time and kind regards,
Basil Maly

	[[alternative HTML version deleted]]



_______________________________________________
R-sig-mixed-models@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic