Error using compRelSEM with lavaan.mi object

81 views
Skip to first unread message

Stephanie Kliethermes

unread,
Sep 14, 2023, 11:32:29 AM9/14/23
to lavaan

Hi lavaan group - I’ve been working my way through some psychometric analyses of a new tool we are developing in the sports sciences and I’ve been spinning my wheels a bit on an error I get when trying to obtain indicator reliability on our 3-factor CFA model using lavaan and multiply imputed datasets. I would like to rely on the compRelSEM function in SEMtools but am struggling to get output from my lavaan.mi object. As far as I can tell, my error occurs when trying to pull the variances from the @phiList.  When looking at the @phiList, it appears as though the covariance matrices are accurate for all imputations. The error is as follows:

 

Error in PHI[[block.label[b]]] <- Reduce("+", lapply(phiList, "[[", i = b))/m :

  attempt to select less than one element in OneIndex

 If I run each of the imputed datasets separately through compRelSEM I can get estimates. But I'm struggling with the pooled estimates.  Any help or guidance would be appreciated. 


# Define the CFA model

model3a <- '

  # Factor indicators

  Factor1 =~ social1 + social2 + social3 +social4 + social5 + social6

  Factor2 =~ motivation1  + motivation3  + motivation10+ motivation11+ motivation12

  Factor3 =~ physical1 + physical4+physical5  

 

  # Factor covariances

  Factor1 ~~ Factor2

  Factor1 ~~ Factor3

  Factor2 ~~ Factor3

 

# run lavaan and imputation in one step

fittedmodel <- runMI(model3a,

              data=data,

              m = 5,

              miPackage="mice",

              fun="cfa",

              estimator="DWLS",

              se="robust",

              test="scaled.shifted",

              meanstructure = TRUE)

 

#summary

summary(fittedmodel, fit.measures=TRUE, standardized=TRUE)

 

#Indicator Reliability

compRelSEM(fittedmodel, tau.eq=FALSE)

 

Error in PHI[[block.label[b]]] <- Reduce("+", lapply(phiList, "[[", i = b))/m :

  attempt to select less than one element in OneIndex

 

Terrence Jorgensen

unread,
Sep 15, 2023, 7:49:05 AM9/15/23
to lavaan
I don't have access to your data, but it works fine on the models from the ?runMI help-page examples.  The default is already tau.eq=FALSE, but I don't see what could be causing this problem.  Do you have the latest software installed?  It is probably a bug that I already fixed.

remotes::install_github("simsem/semTools/semTools")

https://github.com/simsem/semTools/wiki

Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Reply all
Reply to author
Forward
0 new messages