I try replicating a model with nine cognitive measures into three latent factors using lavaan in R. My code yields errors:
modelStr <- 'Lat1 =~ measA+measB; Lat2 =~ measC+measD'
fitResult <- runModel(modelStr, dataSet)
Any suggestions?
I try replicating a model with nine cognitive measures into three latent factors using lavaan in R. My code yields errors:
modelStr <- 'Lat1 =~ measA+measB; Lat2 =~ measC+measD'
fitResult <- runModel(modelStr, dataSet)
Any suggestions?
hey try using sem() instead of runModel, it isnt part of lavaan. also double chk your model syntax. hope that helps!
The error likely stems from using a non-existent function in the lavaan package. I recall a similar situation when I ran into issues replicating a factor model. Instead of using runModel, I resorted to the sem() function which is well-documented and handles the syntax directly. Additionally, I verified that all variables in the dataset were correctly named as per the model specification, since mismatches can cause unexpected errors. Ensuring both the function and variable names align is key to achieving a successful CFA analysis.