I am not 100% certain how the value of "estimator" translates to other options. If I read the document correctly, then setting the "estimator" to "MLR" will set "estimator" to "ML", "test" to "yuan.bentler.mplus", and "se" to "robust.cluster."
Therefore, one possible way to do that in one single call to sem is setting the arguments as below:
# Example adapted from
https://lavaan.ugent.be/tutorial/mediation.htmloptions(width = 132)
library(lavaan)
set.seed(1234)
X <- rnorm(100)
M <- 0.5*X + rnorm(100)
Y <- 0.7*M + rnorm(100)
Data <- data.frame(X = X, Y = Y, M = M)
model <- ' # mediator
M ~ a*X
Y ~ b*M
# indirect effect (a*b)
ab := a*b
'
fit_mlr <- sem(model, Data, estimator = "MLR")
set.seed(4143)
fit_boot <- sem(model, Data, estimator = "ML", se = "bootstrap")
set.seed(4143)
fit_boot_mlr <- sem(model, Data, estimator = "ML", test = "yuan.bentler.mplus", se = "bootstrap")
summary(fit_mlr)
summary(fit_boot)
summary(fit_boot_mlr)
# The following two sets of SEs should be identical (bootstrapping SEs)
parameterEstimates(fit_boot, boot.ci.type = "perc")$se
parameterEstimates(fit_boot_mlr, boot.ci.type = "perc")$se
# The following output should have SEs different from those above (ML SE)
parameterEstimates(fit_mlr)$se
# The following two outputs should have the same p-values (scaled)
anova(fit_mlr)
anova(fit_boot_mlr)
# The following output should have a different p-value (unscaled)
anova(fit_boot)
```
I tested this only for a single-level single-group model. Not sure if this also works for more complicated models.