I’m trying to create a path diagram for a bootstrapped CFA. The boot results come as a vector, and I’m unsure how to map them visually. Below is an alternative code example:
library(lavaan)
# Define and fit a CFA model
model_str <- 'latent =~ indicator1 + indicator2 + indicator3'
fit_obj <- cfa(model_str, data = sampleData, missing = 'FIML')
# Custom extractor
extract_results <- function(mod) {
vals <- fitMeasures(mod, c('chisq', 'cfi', 'tli'))
params <- coef(mod)
c(vals, params)
}
# Perform bootstrapping
boot_model <- bootstrapLavaan(fit_obj, R = 500, iseed = 123, FUN = extract_results)
# Plot the CFA model
library(semPlot)
diagram <- semPaths(fit_obj, whatLabels = 'std', layout = 'tree')
diagram
hey, i tried averaging bootstrapped parms and then swapping them into the fit obj before plotting with semPath. not ideal but it gave me a quick workaround. might be a vibe if you wanna experiment with modifying the model directly
Generating a path diagram directly from bootstrapped values can indeed be tricky given that semPaths expects detailed object attributes. A strategy that worked for me was to recreate a fit object using the averaged bootstrapped estimates. You can compute the mean of your bootstrapped standardized coefficients and then overwrite the parameter estimates, essentially mirroring the structure semPaths requires. In my experience, verifying the stability of these estimates before plotting adds reliability to the diagram. There are also other packages like tidySEM that may offer additional flexibility for specifying custom labels and values, which might be worth exploring.
Hey, I’ve been digging around this problem too and had a thought about trying a slightly different twist. Instead of trying to directly force semPaths to read your bootstrapped values, what if you rebuild a model object after processing the bootstrapped vector? I ended up playing around with the idea of calculating either averaged or even medians for the parameters and then manually injecting those into a structure that semPaths can understand. I didn’t completely abandon using semPaths though—I still used it for the heavy lifting in generating the diagram, but with a slightly more tailored object. It makes me wonder if other plotting libraries, like qgraph, might offer additional flexibility with less fuss when dealing with custom values. What do you think about experimenting with alternative libraries? Would love to hear if anyone’s tried similar approaches or if there’s another twist that could simplify the process further 
hey, you can try merging bootstapped parames into your fit obj then call semPaths. i managed a hack by replacing some std labels with booted values. not perfect but works as a starting point