{"id":664,"date":"2020-06-10T23:00:40","date_gmt":"2020-06-10T14:00:40","guid":{"rendered":"https:\/\/obgyn.jp\/?p=664"},"modified":"2022-03-13T19:56:09","modified_gmt":"2022-03-13T10:56:09","slug":"r-pca-fa","status":"publish","type":"post","link":"https:\/\/obgyn.jp\/?p=664","title":{"rendered":"R \u306b\u3088\u308b\u4e3b\u6210\u5206\u5206\u6790\u3068\u56e0\u5b50\u5206\u6790"},"content":{"rendered":"\n<p><a href=\"https:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/stats\/html\/prcomp.html\" rel=\"noopener noreferrer\" target=\"_blank\">prcomp()<\/a> \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3044\u3001\u4e3b\u6210\u5206\u5206\u6790\u3092\u884c\u3046\u3002\u307e\u305f\u3001<a href=\"https:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/stats\/html\/factanal.html\" rel=\"noopener noreferrer\" target=\"_blank\">factanal()<\/a> \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3044\u3001\u56e0\u5b50\u5206\u6790\u3092\u884c\u3046\u3002<\/p>\n\n\n\n<p>\u901a\u5e38\u306f Excel \u7b49\u3067\u4f5c\u6210\u3057\u305f CSV \u30d5\u30a1\u30a4\u30eb\u3092 R \u306b\u8aad\u307f\u8fbc\u3093\u3067\u5206\u6790\u3059\u308b\u3002\u3057\u304b\u3057\u3001\u3053\u3053\u3067\u306f\u4fbf\u5b9c\u7684\u306b\u4ee5\u4e0b\u306e\u7c21\u5358\u306a\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u3092\u4f5c\u6210\u3057\u3001data \u3068\u3044\u3046\u5909\u6570\u306b\u683c\u7d0d\u3057\u3066\u304a\u304f\u3002\u30c7\u30fc\u30bf\u304c\u6570\u5024\u30c7\u30fc\u30bf\u306e\u307f\u306e\u5834\u5408\u3001\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u3092\u884c\u5217\u306b\u5909\u63db\u3057\u306a\u304f\u3066\u3082\u305d\u306e\u307e\u307e\u5206\u6790\u3067\u304d\u308b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"r\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">data = data.frame(\u624b\u8853\u6642\u9593 = c(60,50,100,90,30,40,80,90), \u51fa\u8840\u91cf = c(15,100,90,20,18,20,120,90), \u7d50\u7d2e\u5931\u6557\u56de\u6570 = c(0,1,2,3,2,1,5,1))<\/pre>\n\n\n\n<p>data \u306e\u5185\u5bb9\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">data<\/pre>\n\n\n\n<p><a href=\"https:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/stats\/html\/prcomp.html\" rel=\"noopener noreferrer\" target=\"_blank\">prcomp()<\/a> \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3044\u3001\u4e3b\u6210\u5206\u5206\u6790\u3092\u884c\u3046\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"r\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">PCA = prcomp(data, scale = TRUE) #scale = TRUE \u3067\u30c7\u30fc\u30bf\u3092\u6a19\u6e96\u5316\nPCA #\u56fa\u6709\u30d9\u30af\u30c8\u30eb\u306e\u8868\u793a\nsummary(PCA) #\u5bc4\u4e0e\u7387\u3001\u7d2f\u7a4d\u5bc4\u4e0e\u7387\u306e\u8868\u793a\nPCA$x #\u4e3b\u6210\u5206\u5f97\u70b9\u306e\u8868\u793a\nbiplot(PCA) #\u7d50\u679c\u306e\u56f3\u793a<\/pre>\n\n\n\n<p><a href=\"https:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/stats\/html\/princomp.html\" rel=\"noopener noreferrer\" target=\"_blank\">princomp()<\/a> \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u3082\u3001\u4e3b\u6210\u5206\u5206\u6790\u3092\u884c\u3048\u308b\u304c\u3001<a href=\"http:\/\/tmats.net\/?p=2785\" rel=\"noopener noreferrer\" target=\"_blank\">prcomp()<\/a>\u30b3\u30de\u30f3\u30c9\u3068\u306f\u7d50\u679c\u304c\u5fae\u5999\u306b\u7570\u306a\u308b\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/stats\/html\/cor.html\" rel=\"noopener noreferrer\" target=\"_blank\">cor()<\/a> \u30b3\u30de\u30f3\u30c9\u3068<a href=\"https:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/base\/html\/eigen.html\" rel=\"noopener noreferrer\" target=\"_blank\">eigen()<\/a> \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u56fa\u6709\u5024\u3068\u56fa\u6709\u30d9\u30af\u30c8\u30eb\u3092\u8868\u793a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u308b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"r\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">eigen(cor(data))$values #\u56fa\u6709\u5024\neigen(cor(data))$vectors #\u56fa\u6709\u30d9\u30af\u30c8\u30eb<\/pre>\n\n\n\n<p><a href=\"https:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/stats\/html\/factanal.html\" target=\"_blank\" rel=\"noopener noreferrer\">factanal()<\/a> \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3044\u3001\u56e0\u5b50\u5206\u6790\u3092\u884c\u3046\u3002\u3053\u3053\u3067\u306f\u56e0\u5b50\u6570\u306f 1\u3068\u3057\u3066\u3044\u308b\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u3067 Varimax \u56de\u8ee2\u304c\u9078\u629e\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"r\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">factanal(data,1) <\/pre>\n","protected":false},"excerpt":{"rendered":"<p>prcomp() \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3044\u3001\u4e3b\u6210\u5206\u5206\u6790\u3092\u884c\u3046\u3002\u307e\u305f\u3001factanal() \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3044\u3001\u56e0\u5b50\u5206\u6790\u3092\u884c\u3046\u3002 \u901a\u5e38\u306f Excel \u7b49\u3067\u4f5c\u6210\u3057\u305f CSV \u30d5\u30a1\u30a4\u30eb\u3092 R \u306b\u8aad\u307f\u8fbc\u3093\u3067\u5206\u6790\u3059\u308b\u3002\u3057\u304b\u3057\u3001\u3053\u3053\u3067\u306f\u4fbf\u5b9c\u7684\u306b\u4ee5 &hellip; <a href=\"https:\/\/obgyn.jp\/?p=664\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">R \u306b\u3088\u308b\u4e3b\u6210\u5206\u5206\u6790\u3068\u56e0\u5b50\u5206\u6790<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[18,37],"class_list":["post-664","post","type-post","status-publish","format-standard","hentry","category-data-science","tag-multivariate","tag-r"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/obgyn.jp\/index.php?rest_route=\/wp\/v2\/posts\/664","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/obgyn.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/obgyn.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/obgyn.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/obgyn.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=664"}],"version-history":[{"count":8,"href":"https:\/\/obgyn.jp\/index.php?rest_route=\/wp\/v2\/posts\/664\/revisions"}],"predecessor-version":[{"id":1019,"href":"https:\/\/obgyn.jp\/index.php?rest_route=\/wp\/v2\/posts\/664\/revisions\/1019"}],"wp:attachment":[{"href":"https:\/\/obgyn.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/obgyn.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=664"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/obgyn.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}