Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Error using function "reliability" (semTools) with object of lavaan.mi and categorial variables

164 views
Skip to first unread message

Sebastian85

unread,
Sep 29, 2019, 10:38:41 AM9/29/19
to lavaan
Hallo,

First of all, I would like to thank you Mr. Jorgensen for revising the reliability function for objects of type lavaan.mi. 

When using the reliability function of semTools (Version: 0.5-2) with imputed categorial data, I get the following error message. For illustration see the Example below: 


HS.model <- ' visual  =~ x1 + x2 + x3

textual =~ x4 + x5 + x6

speed   =~ x7 + x8 + x9 '



#create missings and ordinal data 

set.seed(20170110)

HSMiss <- HolzingerSwineford1939[,paste("x", 1:9, sep="")]

randomMiss <- rbinom(prod(dim(HSMiss)), 1, 0.1)

randomMiss <- matrix(as.logical(randomMiss), nrow=nrow(HSMiss))

HSMiss[randomMiss] <- NA

HSMiss.ord <- as.data.frame( lapply(HSMiss, cut, 5, labels=FALSE) )



# Imputation with mice and create list of imputations

imp<-mice(HSMiss.ord, m=5)

nImputations <- 5

impList <- list()

for (i in 1:nImputations) {
  
  impList[[i]] <- complete(imp, action = i)
  
}



#run cfa.mi

cfa.ord<-cfa.mi(HS.model, impList, estimator = "WLSMV", ordered=names(HSMiss.ord) )
reliability(cfa.ord)

Error in if (any(lower > upper)) stop("lower>upper integration limits") : 
  missing value where TRUE/FALSE needed

What does this error mean and how can it be handled? 

Thank you very much for your help!

Best regards
Sebastian


Terrence Jorgensen

unread,
Oct 2, 2019, 11:06:42 AM10/2/19
to lavaan
0.5-2 threw an error for complete ordered data, too.  Although the error message was different, this seems to have been resolved in the development version already:

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

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
Message has been deleted
0 new messages