yrosseel / lavaan

an R package for structural equation modeling and more
http://lavaan.org
439 stars 100 forks source link

EFA factors and bootstrapped inference #376

Open FlorianScharf opened 3 months ago

FlorianScharf commented 3 months ago

Hello there,

I have discovered a bug when using bootstrapped inference in combination with exploratory factors (ESEM). I attach a minimal example to reproduce the problem. I confirmed that it is still present in the most recent developer version.

There are two symptoms: (1) the bootstrapped standard errors are suspicious it looks as if the first loading of factor 2 is fixed (2) when trying to get CIs, an error occurs

My suspicion is that what is actually bootstrapped are the unrotated loadings (because in the initial solution, the first loading of f2 is indeed fixed at zero due to the echelon constraint).

I am not sure if this is intended behavior in the sense that we do not support bootstrapped ESEMs or if it is an honest bug. In either case, I am happy to have a look at it after my holiday in September (just let me know). But as an urgent fix, I think we should not allow users to use exploratory factors with boostrap and throw an error.

Best, Florian

Example_Bootstrap.R.zip

yrosseel commented 2 months ago

I certainly never tested ESEM + bootstrap, so it is very likely that something is not quite OK there. If you would find the time to look at it after your holidays, I would be grateful (as I hardly find time to work on lavaan these days).