我已经被这个任务困了好几天了。有人可以帮我理解我做错了什么吗?我已经为每个步骤提供了路径图和标签的图片,以使我的思维过程清晰。我是 SEM 的新手,将在此处输入图像描述,感谢任何指导。
# Contininuous outcomes:
# Q1. Never tell someone the real reason you did something unless it is useful to do so: never
# Q2. The best way to handle people is to tell them what they want to hear: han
# Q3. One should take action only when sure it is morally right: moral
#4. Most people are basically good and kind: good
# Categorical variable:
# gender: gen
names(mach)[1] = "never" #Q1
names(mach)[4] = "han" #Q2
names(mach)[7] = "moral" #Q3
names(mach)[10] = "good" #Q4
names(mach)[72] = "warm" #warm, sympathetic
names(mach)[102] = "crit" #critical, quarrelsome
names(mach)[94] = "gen" #gender
#1. Multiple groups model:
mod.mg1a = "
#Variances
crit ~~ crit
warm ~~ warm
trust ~~ trust
never ~~ never
moral ~~ moral
han ~~ han
good ~~ good
#Regression/Causal Path
trust ~ warm
trust ~ crit
#Factor Loadings
trust =~ never + moral + han + good
"
fit.mg1a = lavaan(mod.mg1a,data=mach,group="gen")
summary(fit.mg1a)
mod.mg1b = "
#Variances
crit ~~ crit
warm ~~ warm
trust ~~ trust
never ~~ never
moral ~~ moral
han ~~ han
good ~~ good
#Regression/Causal Path
trust ~ warm
trust ~ crit
#Factor Loadings
trust =~ never + moral + han + good
"
fit.mg1b = lavaan(mod.mg1b,data=mach,group="gen")
summary(fit.mg1b)
anova(fit.mg1a, fit.mg1b)
----------
***Warning in lav_partable_check(lavpartable, categorical = lavoptions$categorical, :
lavaan WARNING: automatically added intercepts are set to zero:
[warm crit warm crit]
Warning in lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, :
lavaan WARNING:
Could not compute standard errors! The information matrix could
not be inverted. This may be a symptom that the model is not
identified.***
----------
***Warning in lavTestLRT(object = object, ..., model.names = NAMES) :
lavaan WARNING: some models have the same degrees of freedom***
----------
#2. Comparison model where parameters are all constrained to be equal.
fit.con = lavaan(mod.mg1a,data=mach, group="gen", group.equal=c(
"loadings","lv.covariances","intercepts","means","residuals",
"lv.variances","regressions"))
----------
***Warning in lav_partable_check(lavpartable, categorical = lavoptions$categorical, :
lavaan WARNING: automatically added intercepts are set to zero:
[warm crit warm crit]
Warning in lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, :
lavaan WARNING:
The variance-covariance matrix of the estimated parameters (vcov)
does not appear to be positive definite! The smallest eigenvalue
(= 7.438519e-15) is close to zero. This may be a symptom that the
model is not identified.***