I tested the measurement model as the first step of my structural equation approach using the R-lavaan package.
Everything works out fine, but when I try to inspect the modindices of that measurement model I get an error message that I do not seem to be able to solve:
rosiesTAM_measurement<- '
#measurement model
PEoU =~ 1*TAM_PEoU_1 + TAM_PEoU_2 + TAM_PEoU_3 + TAM_PEoU_4
PU =~ 1*TAM_PU_1 + TAM_PU_2 + TAM_PU_3 + TAM_PU_4
E =~ 1*TAM_E_1 + TAM_E_2 + TAM_E_3 + TAM_E_4
SI =~ 1*TAM_SI_1 + TAM_SI_2 + TAM_SI_3
#residual variances
TAM_SS ~~ TAM_SS
PEoU ~~ PEoU
PU ~~ PU
E ~~ E
SI ~~ SI
TAM_SS ~~ PEoU
TAM_SS ~~ PU
TAM_SS ~~ E
TAM_SS ~~ SI
PEoU ~~ PU
PEoU ~~ E
PEoU ~~ SI
PU ~~ E
PU ~~ SI
E ~~ SI
'
#fit the model
rosiesTAM_measurement_fit <- cfa(rosiesTAM_measurement_fam_class4, data = rosie_fscores)
#print summary
summary(rosiesTAM_measurement_fit, standardized = T, fit.measures = T)
#visualize measurement model
semPaths(rosiesTAM_measurement_fit)
#check modindices
modindices(rosiesTAM_measurement_fit, sort = TRUE)
Error in tmp[cbind(REP$row[idx], REP$col[idx])] <- lavpartable$free[idx] :
NAs are not allowed in subscripted assignments
The variables relevant for the SEM do not entail any missing values. I do not understand why R does not want to run the modindices command. The measurement model fit is close to be acceptable (sample size was realtively low with N = 183):
- Chi-Square: 0
- CFI: 0.938
- RMSEA: 0.088
- SRMR: 0.084
I appreciate your help, thanks in advance.
The problem was solved! The issue laid in the manifest (observed) variable TAM_SS. When removing this variable from the measurement model, modification indices could be inspected.