我有我想通过使用 R 中的 sem 包测试的附加模型,并且完整模型(模型 3)运行顺利。但是,后来,当我想测试变量“态度”的中介作用时,我遇到了一些麻烦。R 返回以下警告消息,我不太明白我在哪里做错了。有人可以帮我吗?太感谢了!
警告信息:
In eval(expr, envir, enclos) :
Could not compute QR decomposition of Hessian.
Optimization probably did not converge.
以检验态度的中介效应。我跑了 3 个模型,第一个和第三个模型都成功了,除了第二个模型,我删除了与态度有关的所有内容。我尽力安排问题(抱歉有点冗长)。下面的黄色问号是我正在寻找的输出。
这是我为这三个模型提供的代码。
###############################################################Model 1
#######SEM Fully mediated MODEL 1
###############################################################
factor.data<-data.frame (cbind(ECNew,HCNew, attNew, willingNew, FunctionNew, ageNew, incomeNew, KIndexNew, genderNew))
cov.matrix<-cov(na.omit(factor.data))
cfa.model1<-specifyModel()
ageNew -> Attitude, gam11
incomeNew -> Attitude, gam12
genderNew -> Attitude, gam13
KIndexNew -> Attitude, gam15
ageNew -> WTB, gam21
incomeNew -> WTB, gam22
genderNew -> WTB, gam23
KIndexNew -> WTB, gam25
EnvironmentConcern->Q18_a, ec1
EnvironmentConcern->Q18_c, ec3
EnvironmentConcern->Q18_d, ec4
EnvironmentConcern->Q18_e, ec5
HealthConcisousness->Q19_a, hc1
HealthConcisousness->Q19_b, hc2
HealthConcisousness->Q19_c, hc3
Function -> Q13_l, f3
Function -> Q13_m, f4
Function -> Q13_n, f5
Function -> Q13_o, f6
Attitude->Q15_c, a3
Attitude->Q15_d, a4
Attitude->Q15_e, a5
WTB-> Q14_d, w4
WTB-> Q14_h, w6
WTB-> Q14_i, w7
WTB-> Q14_j, w8
WTB-> Q14_k, w9
EnvironmentConcern -> Attitude, EA
HealthConcisousness -> Attitude, HA
Function -> Attitude, FA
Attitude -> WTB, AW
EnvironmentConcern <-> HealthConcisousness, ps2
EnvironmentConcern <-> Function, ps3
HealthConcisousness <-> Function, ps5
EnvironmentConcern <-> EnvironmentConcern, NA, 1
HealthConcisousness <-> HealthConcisousness,NA, 1
Function <-> Function, NA, 1
Attitude <-> Attitude, NA, 1
WTB <-> WTB, NA, 1
cfa1<-sem(cfa.model1, cov.matrix, nrow(factor.data), fixed.x=c("ageNew","incomeNew", "KIndexNew", "genderNew"))
summary(cfa1, fit.indices = c("GFI", "AGFI", "RMSEA", "NFI", "NNFI", "CFI", "RNI", "IFI", "SRMR", "AIC", "AICc", "BIC", "CAIC"))
###############################################################Model 2
#######SEM IV affects DV MODEL
###############################################################
factor.data2<-data.frame (cbind(ECNew,HCNew, willingNew, FunctionNew, ageNew, incomeNew, KIndexNew, genderNew))
cov.matrix2<-cov(na.omit(factor.data2))
cfa.model2<-specifyModel()
ageNew -> WTB, gam21
incomeNew -> WTB, gam22
genderNew -> WTB, gam23
KIndexNew -> WTB, gam25
EnvironmentConcern->Q18_a, ec1
EnvironmentConcern->Q18_c, ec3
EnvironmentConcern->Q18_d, ec4
EnvironmentConcern->Q18_e, ec5
HealthConcisousness->Q19_a, hc1
HealthConcisousness->Q19_b, hc2
HealthConcisousness->Q19_c, hc3
Function -> Q13_l, f3
Function -> Q13_m, f4
Function -> Q13_n, f5
Function -> Q13_o, f6
WTB-> Q14_d, w4
WTB-> Q14_h, w6
WTB-> Q14_i, w7
WTB-> Q14_j, w8
WTB-> Q14_k, w9
EnvironmentConcern -> WTB, EW
HealthConcisousness->WTB, HW
Function -> WTB, FW
EnvironmentConcern <-> HealthConcisousness, ps2
EnvironmentConcern <-> Function, ps3
HealthConcisousness <-> Function, ps5
EnvironmentConcern <-> EnvironmentConcern, NA, 1
HealthConcisousness <-> HealthConcisousness,NA, 1
Function <-> Function, NA, 1
WTB <-> WTB, NA, 1
cfa2<-sem(cfa.model2, cov.matrix2, nrow(factor.data2), fixed.x=c("ageNew","incomeNew","KIndexNew", "genderNew"))
summary(cfa2, fit.indices = c("GFI", "AGFI", "RMSEA", "NFI", "NNFI", "CFI", "RNI", "IFI", "SRMR", "AIC", "AICc", "BIC", "CAIC"))
###############################################################Model 3
#######SEM Fully SpecifiedMODEL
###############################################################
factor.data3<-data.frame (cbind(ECNew,HCNew, attNew, willingNew, FunctionNew, ageNew, incomeNew, KIndexNew, genderNew))
cov.matrix3<-cov(na.omit(factor.data3))
cfa.model3<-specifyModel()
ageNew -> Attitude, gam11
incomeNew -> Attitude, gam12
genderNew -> Attitude, gam13
KIndexNew -> Attitude, gam15
ageNew -> WTB, gam21
incomeNew -> WTB, gam22
genderNew -> WTB, gam23
KIndexNew -> WTB, gam25
EnvironmentConcern->Q18_a, ec1
EnvironmentConcern->Q18_c, ec3
EnvironmentConcern->Q18_d, ec4
EnvironmentConcern->Q18_e, ec5
HealthConcisousness->Q19_a, hc1
HealthConcisousness->Q19_b, hc2
HealthConcisousness->Q19_c, hc3
Function -> Q13_l, f3
Function -> Q13_m, f4
Function -> Q13_n, f5
Function -> Q13_o, f6
Attitude->Q15_c, a3
Attitude->Q15_d, a4
Attitude->Q15_e, a5
WTB-> Q14_d, w4
WTB-> Q14_h, w6
WTB-> Q14_i, w7
WTB-> Q14_j, w8
WTB-> Q14_k, w9
EnvironmentConcern -> Attitude, EA
HealthConcisousness -> Attitude, HA
Function -> Attitude, FA
EnvironmentConcern -> WTB, EW
HealthConcisousness->WTB, HW
Function -> WTB, FW
Attitude -> WTB, AW
EnvironmentConcern <-> HealthConcisousness, ps2
EnvironmentConcern <-> Function, ps3
HealthConcisousness <-> Function, ps5
EnvironmentConcern <-> EnvironmentConcern, NA, 1
HealthConcisousness <-> HealthConcisousness,NA, 1
Function <-> Function, NA, 1
Attitude <-> Attitude, NA, 1
WTB <-> WTB, NA, 1
cfa<-sem(cfa.model3, cov.matrix3, nrow(factor.data3), fixed.x=c("ageNew","incomeNew", "KIndexNew", "genderNew"))
summary(cfa, fit.indices = c("GFI", "AGFI", "RMSEA", "NFI", "NNFI", "CFI", "RNI", "IFI", "SRMR", "AIC", "AICc", "BIC", "CAIC"))