{"id":561,"date":"2017-07-03T16:02:11","date_gmt":"2017-07-03T08:02:11","guid":{"rendered":"https:\/\/www.beneplot.com\/?p=561"},"modified":"2020-07-23T15:14:38","modified_gmt":"2020-07-23T07:14:38","slug":"%e9%aa%8c%e8%af%81%e6%80%a7%e5%9b%a0%e5%ad%90%e5%88%86%e6%9e%90confirmatory-factor-analysis-r-%e8%af%ad%e5%8f%a5","status":"publish","type":"post","link":"https:\/\/www.beneplot.com\/?p=561","title":{"rendered":"\u9a8c\u8bc1\u6027\u56e0\u5b50\u5206\u6790(Confirmatory Factor Analysis) &#8211; R \u8bed\u53e5"},"content":{"rendered":"<h3>\u56e0\u5b50\u5206\u6790(factor analysis)\u53ef\u5206\u4e3a\u63a2\u7d22\u6027\u56e0\u5b50\u5206\u6790\u6cd5(Exploratory Factor Analysis\uff0cEFA)\u548c\u9a8c\u8bc1\u6027\u56e0\u5b50\u5206\u6790(Confirmatory Factor Analysis\uff0cCFA)\u4e24\u7c7b\uff0c\u501f\u52a9SPSS\u53ea\u80fd\u8fdb\u884c\u63a2\u7d22\u6027\u56e0\u5b50\u5206\u6790\u3002\u5728R\u4e2d\uff0c\u901a\u8fc7lavaan\u5305(Latent Variable Analysis Package)\u53ef\u4ee5\u8fdb\u884c\u9a8c\u8bc1\u6027\u56e0\u5b50\u5206\u6790\uff0c\u672c\u6587\u5c06\u4ee5\u4e00\u4e2a\u7b80\u5355\u7684\u5206\u6790\u4f8b\u5b50\uff0c\u8bb2\u8ff0\u5982\u4f55\u7528R\u8fdb\u884cCFA\u3002<\/h3>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">#####################################################################<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">library(readxl) #####\u8f7d\u5165\u53ef\u4ee5\u8bfb\u53d6EXCEL\u6587\u4ef6\u7684\u5305####<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">data = read_excel(\"C:\/...\/data.xlsx\") #####\u8bfb\u53d6EXCEL\u6570\u636e\u6587\u4ef6#####<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">library(lavaan) #####\u8f7d\u5165lavaan\u5305#####<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">#####\u5047\u8bbe\u9700\u8981\u9a8c\u8bc1\u7684\u6a21\u578b\u67094\u4e2a\u7ef4\u5ea6\uff0c\u6bcf\u4e2a\u7ef4\u5ea6\u5206\u522b\u6709\u4e94\u9053\u9898\uff0c\u6784\u5efaCFA\u6a21\u578b########<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">HS.model = ' D1 =~ Q01 + Q02 + Q03 + Q04 + Q05\u00a0\u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">D2 =~ Q06 + Q07 + Q08 + Q09 + Q10\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">D3 =~ Q11 + Q12 + Q13 + Q14 + Q15<\/span><\/code><\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">D4 =~ Q16 + Q17 + Q18 + Q19 + Q20 '\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">fit = cfa(HS.model, data=data, sample.cov = TRUE)\u00a0 ####\u8fdb\u884c\u9a8c\u8bc1\u6027\u56e0\u5b50\u5206\u6790##<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">fitMeasures(fit)\u00a0 #\u63d0\u53d6\u5404\u62df\u5408\u6307\u6807#<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">fitMeasures(fit, c(\"chisq\",\"df\",\"pvalue\",\"rmr\",\"rmsea\",\"gfi\",\"agfi\",\"nfi\",\"rfi\",\"ifi\",\"tli\",\"cfi\")) ##\u63d0\u53d6\u7279\u5b9a\u7684\u5206\u6790\u7ed3\u679c###<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">summary(fit, standardized = TRUE, fit.measures=TRUE, modindices = TRUE) #\u63d0\u53d6\u5404\u9879\u6307\u6807#<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">parameterEstimates(fit)\u00a0 \u00a0#\u63d0\u53d6\u672a\u6807\u51c6\u5316\u5404\u56e0\u5b50\u8f7d\u8377#<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">standardizedSolution(fit)\u00a0 #\u63d0\u53d6\u6807\u51c6\u5316\u5404\u56e0\u5b50\u8f7d\u8377#<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">fitted(fit)\u00a0 \u00a0#\u63d0\u53d6\u534f\u65b9\u5dee\u77e9\u9635#<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">inspectSampleCov(HS.model, data=data) #\u63d0\u53d6\u6837\u672c\u534f\u65b9\u5dee\u77e9\u9635#<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">lavInspect(fit, \"cov.all\")\u00a0 \u00a0 #\u63d0\u53d6\u6240\u6709\u5143\u7d20\u7684\u534f\u65b9\u5dee\u77e9\u9635#<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">lavInspect(fit, \"cor.all\")\u00a0 \u00a0 #\u63d0\u53d6\u6240\u6709\u5143\u7d20\u7684\u76f8\u5173\u77e9\u9635#<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">resid(fit, type=\"standardized\")\u00a0 \u00a0#\u63d0\u53d6\u6807\u51c6\u5316\u7684\u6b8b\u5dee\u77e9\u9635#<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">modindices(fit)\u00a0#\u63d0\u53d6\u4fee\u6b63\u6307\u6570#<\/span><\/code><\/div>\n<div>\u00a0<\/div>\n<div>\u00a0<\/div>\n<div><code><span style=\"font-family: 'times new roman', times, serif; font-size: 16px;\">###########END#################<\/span><\/code><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u56e0\u5b50\u5206\u6790(factor analysis)\u53ef\u5206\u4e3a\u63a2\u7d22\u6027\u56e0\u5b50\u5206\u6790\u6cd5(Exploratory Factor Ana [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.beneplot.com\/?p=561\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u9a8c\u8bc1\u6027\u56e0\u5b50\u5206\u6790(Confirmatory Factor Analysis) - R \u8bed\u53e5 - Beneplot\" \/>\n<meta property=\"og:description\" content=\"\u56e0\u5b50\u5206\u6790(factor analysis)\u53ef\u5206\u4e3a\u63a2\u7d22\u6027\u56e0\u5b50\u5206\u6790\u6cd5(Exploratory Factor Ana [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.beneplot.com\/?p=561\" \/>\n<meta property=\"og:site_name\" content=\"Beneplot\" \/>\n<meta property=\"article:published_time\" content=\"2017-07-03T08:02:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-07-23T07:14:38+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.beneplot.com\/#website\",\"url\":\"https:\/\/www.beneplot.com\/\",\"name\":\"Beneplot\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.beneplot.com\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-CN\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.beneplot.com\/?p=561#webpage\",\"url\":\"https:\/\/www.beneplot.com\/?p=561\",\"name\":\"\\u9a8c\\u8bc1\\u6027\\u56e0\\u5b50\\u5206\\u6790(Confirmatory Factor Analysis) - R \\u8bed\\u53e5 - Beneplot\",\"isPartOf\":{\"@id\":\"https:\/\/www.beneplot.com\/#website\"},\"datePublished\":\"2017-07-03T08:02:11+00:00\",\"dateModified\":\"2020-07-23T07:14:38+00:00\",\"author\":{\"@id\":\"https:\/\/www.beneplot.com\/#\/schema\/person\/ea14f85ae789ceaaa712ceee1dd1f95b\"},\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.beneplot.com\/?p=561\"]}]},{\"@type\":[\"Person\"],\"@id\":\"https:\/\/www.beneplot.com\/#\/schema\/person\/ea14f85ae789ceaaa712ceee1dd1f95b\",\"name\":\"beneplot\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.beneplot.com\/#personlogo\",\"inLanguage\":\"zh-CN\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/15d96ce801cfddbd59ef2b0d986cd9b1?s=96&r=g\",\"caption\":\"beneplot\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/posts\/561"}],"collection":[{"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=561"}],"version-history":[{"count":14,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/posts\/561\/revisions"}],"predecessor-version":[{"id":667,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=\/wp\/v2\/posts\/561\/revisions\/667"}],"wp:attachment":[{"href":"https:\/\/www.beneplot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.beneplot.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}