alexanderrobitzsch / sirt

Supplementary Item Response Theory Models
https://alexanderrobitzsch.github.io/sirt/
22 stars 11 forks source link

bug: cfa_meas_inv() returns incorrect mod_pi lavaan-object (not so for mod_mi) #19

Closed mbluemke closed 2 years ago

mbluemke commented 2 years ago

File Name: cfa_meas_inv.R

File Version: 0.157

Given the programming code and variable/object assignment in the function cfa_meas_inv(), the end of line 67 should return "mod_mi=mod0, mod_pi=mod2" as part of the list object, rather than "mod_mi=mod0, mod_pi=mod1" as is currently the case.

Explanation: During the "while (free)"-loop, the objects partable1 and mimod1 get updated until hitting the final (tested) partial MI model. However, the last lavaan-object is not stored in object mod1, but in mod2 (see line 50). Thus, returning mod_pi as mod1 at the end of the function returns the full MI model (mod1 = mod_mi; see line 26) rather than the last (tested/accepted) partial MI model (mod2 = mod_pi).

Consequently, when comparing the model parameters via pars_mi and pars_pi, any model differences are evident (and the function appears functional). However, when further exploring model fit and model parameters straight from the returned lavaan-object mod_pi - e.g., with summary(mod$mod_pi, standardized = TRUE, fit.measures = TRUE - , then the reported mod_pi is incorrectly identical to mod_mi.

mb

alexanderrobitzsch commented 2 years ago

Thanks for reporting. I have fixed the issue in sirt 3.13-11.