3
longInvariance 함수를 사용하여 간격 데이터의 두 시간 지점 간 종단 불변성을 확인합니다. 올바른 lavaan/semTools R 코드가 어떻게 생겼는지 궁금합니다. 한 번에 하나의 요소를 살펴볼 때 작동합니다. 2 요소 모델을 검사 할 때 오류가 발생합니다. 아래 한 인자lavaan 종 방향 불변량 2 요소 모델을 사용하는 CFA 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.
감사합니다!