我正在尝试使用lavaan
cfa()
函数运行CFA (这是我一生中第一次需要使用CFA,所以请原谅我)。但是,我的模型根本没有运行,给出了错误:
Error in lav_samplestats_icov(COV = cov[[g]], ridge = 1e-05, x.idx = x.idx[[g]], :
lavaan ERROR: sample covariance matrix is not positive-definite
因为它是一个庞大的数据集,并且由于操作的性质,一个可重复的示例将不会有任何帮助。相反,我会说出我得到的:230个38个变量的观测结果。起初,我的一些变量是顺序的,其余的都是比率。不过,我已经使用scale(data, center = TRUE, scale = TRUE)
对它们进行了缩放和中心化。我已经检查过了,并且有:数据集中没有NAs,变量之间没有关联> 0.9。
我的模型看起来是这样的:
online_questionnaire_cfa_full <- '
duration_experience =~ years_experience
intensity_diversity =~ entropy + family_general + auditory_ratio + visual_ratio +
hobbies + friends + home + social_activities + neighbours +
texting + emailing + social_media +
movies + tv + internet_browsing + reading +
shopping + work + school + notes
environm3 =~ environm3 + factor1_3 + factor2_3
environm2 =~ environm2
environm1 =~ environm1
US =~ factor1 + factor2 + factor3
CS =~ factor4 + factor5 + factor6 +
+ family_other + friends_other + social_media_other
proficiency =~ auditory_prof_ratio + visual_prof_ratio
#set as single indicators
years_experience~~0*years_experience
environm2~~0*environm2
environm1~~0*environm1
#correlate error variances
factor4 ~~ factor5
friends_other ~~ social_media_other
friends ~~ social_activities
movies ~~ tv
factor1 ~~ factor2
entropy ~~ home
auditory_ratio ~~ home
emailing ~~ internet_browsing
family_general ~~ visual_ratio
family_general ~~ auditory_prof_ratio
movies ~~ visual_prof_ratio
auditory_ratio ~~ visual_ratio
visual_ratio ~~ reading
texting ~~ visual_prof_ratio
hobbies ~~ social_activities
friends ~~ texting
emailing ~~ healthcare
factor1_3 ~~ factor2_3
factor1_3 ~~ factor1
factor1_3 ~~ factor2`
#fit the model above:
fit_online_questionnaire_cfa_full <- cfa(online_questionnaire_cfa_full, estimator = "MLM",
data = online_questionnaire_cfa_scaled, std.lv = TRUE)
根据我从其他问题和答案中所读到的,问题必须在我的数据中,而不是在模型中,因为模型甚至无法运行。你能告诉我一些可能的问题以及如何检查这些问题吗?任何帮助都将受到高度重视。
发布于 2022-10-12 18:17:30
回顾我所做的事情,我的模型似乎太复杂了。我试图简化误差协方差结构,以及固定的因素。但真正有帮助的是少了一个潜在变量。因此,答案是将一些潜在变量(那些理论上有意义的变量组合在一起)进行简化和折叠。
https://stackoverflow.com/questions/73451214
复制相似问题