R 中具有 2 因子模型的 lavaan 纵向不变性 CFA

lavaan longitudinal invariance CFA with a 2-factor model in R

我使用longInvariance函数评估区间数据两个时间点之间的纵向不变性;我想知道正确的 lavaan/semTools 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.

我想你也在 lavaan Google group 上问过你的问题。

因为它在那里被回答并写在 semTools documentation 中,semTools 只提供 longInvariance() 一个单一的尺度。如果您有两个秤,则需要手动指定型号。