I was rerunning some old code that used to work (up to version 0.6.12), but now fails (from 0.6.13). It estimates a mediation model and then bootstraps confidence intervals – but with estimator = MLR and missing = direct, that fails with an Error in colSums … see below. Note that this is not dependent on mtcars – I get the same with rnorm data etc. Note that this works when the estimator is ML or missing not set.
With lavaan from 0.6-13 (including current CRAN version)
library(groundhog)
#> Attached: 'Groundhog' (Version: 3.0.0)
#> Tips and troubleshooting: https://groundhogR.com
groundhog.library("lavaan", "2023-01-31", tolerate.R.version='4.3.0')
#> This is lavaan 0.6-13
#> lavaan is FREE software! Please report any bugs.
#> [36mSuccessfully attached 'lavaan_0.6-13'[0m
df <- data.frame(X = mtcars$wt, M1 = mtcars$cyl, M2 = mtcars$am, Y = mtcars$mpg)
mod <- " #Mediators
M1 ~ a*X
M2 ~ b*X
#Outcome
Y ~ cdash*X + aa*M1 + bb*M2"
# Fails
fit <- lavaan::sem(mod, df, estimator = "MLR",
missing = "direct")
out <- lavaan::bootstrapLavaan(fit, R = 10)
#> Error in colSums(S): 'x' must be an array of at least two dimensions
I was rerunning some old code that used to work (up to version 0.6.12), but now fails (from 0.6.13). It estimates a mediation model and then bootstraps confidence intervals – but with estimator = MLR and missing = direct, that fails with an Error in colSums … see below. Note that this is not dependent on mtcars – I get the same with rnorm data etc. Note that this works when the estimator is ML or missing not set.
With lavaan from 0.6-13 (including current CRAN version)
Up until lavaan 0.6-12, it works.