Я использую функцию longInvariance для определения продольной инвариантности между двумя временными точками для интервальных данных; и мне интересно, как должен выглядеть правильный Raw-код lavaan/semTools. Это работает, когда я смотрю на один фактор за раз; но он генерирует ошибку при изучении двухфакторной модели.лавановская продольная инвариантность CFA с 2-факторной моделью в R
Пример кода для одного фактора ниже:
model.oneFactor <- '
Factor1T1 =~ Item1 + Item2 + Item3
Factor1T2 =~ Item1t2 + Item2t2 + Item3t2
'
# Create list of variables
var1 <- c("Item1", "Item2", "Item3")
var2 <- c("Item1t2", "Item2t2", "Item3t2")
constrainedVar <- list(var1, var2)
# Invariance of the same factor across timepoints
longInvariance(model.oneFactor, auto=1, constrainAuto=TRUE, varList=constrainedVar, data=data, estimator="MLM", strict=TRUE)
Однако при добавлении второго фактора в модели генерирует ошибку. Пример кода для двухфакторной модели ниже:
model.twoFactor <- '
Factor1T1 =~ Item1 + Item2 + Item3
Factor2T1 =~ Item4 + Item5 + Item6 + Item7
Factor1T2 =~ Item1t2 + Item2t2 + Item3t2
Factor2T2 =~ Item4t2 + Item5t2 + Item6t2 + Item7t2
'
# Create list of variables
var1 <- c("Item1", "Item2", "Item3", "Item4", "Item5", "Item6", "Item7")
var2 <- c("Item1t2", "Item2t2", "Item3t2", "Item4t2", "Item5t2", "Item6t2", "Item7t2")
constrainedVar <- list(var1, var2)
# Invariance of the same factor across timepoints
longInvariance(model.twoFactor, auto=1, constrainAuto=TRUE, varList=constrainedVar, data=data, estimator="MLM", strict=TRUE)
Сформированный ошибка:
Error in longInvariance(model.twoFactor, auto = 1, constrainAuto = TRUE, :
The factor names of the same element of the 'varList' are not the same.
Спасибо!