所以我今天开始使用 lavaan 和 sem() 。与几个构造/潜在变量和一个回归模型配合得很好。然而,lavaan 现在失败了。即使当我尝试从回归模型中删除新变量时,我仍然收到此错误:
'''
Warning message:
lavaan->lav_lavaan_step11_estoptim():
Model estimation FAILED! Returning starting values
'''
这可能是什么原因造成的? 输出结果:
dput(head(data2))
structure(list(everlied = c(0, 0, 0, 0, 0, 0), Buswebsite = c(3,
1, 4, 1, 3, 3), BusFacebookpage = c(3, 2, 4, 2, 3, 3),
periodicals = c(3, 2, 4, 3, 3, 3), internetsearch = c(3, 4, 4, 2,
4, 4), googlebuslisting = c(3, 5, 5, 3, 3, 3),
internetdiscussforum = c(3, 3, 4, 4, 3, 4), consumerratingssite =
c(3,4, 5, 2, 4, 4), friends = c(5, 4, 5, 3, 4, 5), family = c(5,
5, 5, NA, 4, 5), doctors = c(4, 4, 5, 3, 4, 4), politicians =
c(3,1, 1, 3, 1, 1), salespeople = c(3, 2, 1, 3, 2, 1), like =
c(3, 2, 2, 3, 2, 1), newimmigrants = c(3, 3, 2, 2, 3, 1),
businessowners = c(3, 2, 2, 3, 3, 1), celebrities = c(3, 3, 1, 2,
3, 1), commercialactors = c(3, 2, 1, 2, 3, 1), religious = c(4,
4, 4, 2, 4, 1), socmediainfluencers = c(3, 3, 1, 4, 3, 1),
teachers = c(4, 4, 4, 3, 4, 1), gender = c(0, 0, 0, 1, 0, 0), age
= c(5, 5, 3, 3, 3, 2), education = c(4, 2, 3, 4, 5, 3), income =
c(3, 2, 2, 2, 3, 4), region = c(3, 3, 7, 7, 3, 7)), row.names =
c(NA, -6L), class = c("tbl_df", "tbl", "data.frame"))
我的模型非常驯服。观察到的结果变量是有序的(它是李克特量表值)。人口统计的预测变量是分类的。其余变量也是有序的。我第一次尝试时,我只使用了前两个潜在变量。巧合的是,我本身找不到任何有关此错误的信息,但找到了一篇提到方差的帖子。我确实尝试插入 auto.var = TRUE 但这没有帮助。
这就是我所拥有的。
`
model <- '
+ person =~ family + friends
+ demographic =~ age + gender + income + education +
region
+ instit =~ doctors+politicians+religious+businessowners
+ soc =~ salespeople + celebrities + commercialactors +
socmediainfluencers + newimmigrants
+ info =~ Buswebsite + BusFacebookpage + periodicals +
internetsearch + googlebuslisting + internetdiscussforum +
consumerratingssite
+ like ~ person + demographic + instit + soc + info
+ '
> model_out <- sem(model, data=dat2)
谢谢你
所以,在尝试了几次之后,我决定巩固一些潜在变量。看来 lavaan/sem 不喜欢超过 4 个结构。与 4 个潜在变量完美配合。