Hi everyone,
I'm the beginner in R and lavaan, Can anyone help me give some suggestion?
I try to run using a small sample size, (let say n=30), but the model only converges at n=55, but when I try using n=76, the model did not converge again. What should I do?
beta <- matrix(NA, nrow = 500, ncol = 4)
FIT <- matrix(NA, nrow = 500, ncol = 7)
var <- matrix(NA, nrow = 500, ncol = 15)
set.seed(12345)
for (i in 1:500){
data2 = data.f(76)
model <- '
KSI1 =~ X1 + X2 + X3
KSI2 =~ X4 + X5 + X6
KSI3 =~ X7 + X8 + X9
KSI4 =~ X10 + X11 + X12
ETA1 =~ Y1 + Y2 + Y3
# REGRESSION
ETA1 ~ KSI1 + KSI2 + KSI3 + KSI4 '
fit <- sem(model=model, data = data2)
beta[i, 1:4] = parameterEstimates (fit, ci = FALSE, standardized = TRUE)[16:19, 4]
FIT[i,1:7] = fitMeasures(fit, c("chisq","GFI", "AGFI", "RMSEA", "NFI", "NNFI", "CFI"))
var[i, 1:15] = parameterEstimates (fit, ci = FALSE, standardized = TRUE)[20:34, 4]
}
WARNING!!!
Error in fitMeasures(fit, c("chisq", "GFI", "AGFI", "RMSEA", "NFI", "NNFI", :
lavaan ERROR: fit measures not available if model did not converge