yrosseel / lavaan

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

Error in CRMR calculation #121

Closed bwiernik closed 5 years ago

bwiernik commented 5 years ago

In https://github.com/yrosseel/lavaan/blob/c4d53f724f5cdad988028c20897acc8896ca1536/R/lav_fit_measures.R#L1077

CRMR is computed with lower.tri(R.cor, diag = TRUE), but the diagonal of R.cor is all zeroes by constraint. I believe that it should be diag=FALSE here and elsewhere where CRMR is calculated.

cf. https://www.tandfonline.com/doi/full/10.1080/10705511.2017.1389611?scroll=top&needAccess=true

yrosseel commented 5 years ago

Sure, it would be cleaner. I will not change this now, as including the (zero) diagonal or not makes no difference, but mostly because this chunk of code will be replaced soon, by extracting all rmr/srmr/crmr values from the (new) lav_residual_summary() function.