我想使用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"))