{"id":518,"date":"2020-02-19T23:00:29","date_gmt":"2020-02-19T14:00:29","guid":{"rendered":"https:\/\/obgyn.jp\/?p=518"},"modified":"2022-03-13T19:56:09","modified_gmt":"2022-03-13T10:56:09","slug":"r-kruskal-wallis-anova","status":"publish","type":"post","link":"https:\/\/obgyn.jp\/?p=518","title":{"rendered":"R \u306b\u3088\u308b Kruskal-Wallis test \u3068 ANOVA"},"content":{"rendered":"\n<p><a href=\"https:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/stats\/html\/kruskal.test.html\" rel=\"noopener noreferrer\" target=\"_blank\">kruskal.test()<\/a> \u30b3\u30de\u30f3\u30c9\u3067 Kruskal-Wallis test \u3092\u884c\u3046\u3002\u307e\u305f\u3001<a href=\"https:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/stats\/html\/oneway.test.html\" rel=\"noopener noreferrer\" target=\"_blank\">oneway.test()<\/a> \u30b3\u30de\u30f3\u30c9\u3067 one-way ANOVA \uff08\u4e00\u5143\u914d\u7f6e\u5206\u6563\u5206\u6790\uff09\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<\/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(\u30c7\u30d0\u30a4\u30b9 = c(\"\u30c7\u30d0\u30a4\u30b9 A\",\"\u30c7\u30d0\u30a4\u30b9 B\",\"\u30c7\u30d0\u30a4\u30b9 A\",\"\u30c7\u30d0\u30a4\u30b9 A\",\"\u30c7\u30d0\u30a4\u30b9 C\",\"\u30c7\u30d0\u30a4\u30b9 C\",\"\u30c7\u30d0\u30a4\u30b9 B\",\"\u30c7\u30d0\u30a4\u30b9 C\",\"\u30c7\u30d0\u30a4\u30b9 A\",\"\u30c7\u30d0\u30a4\u30b9 A\"), \u51fa\u8840\u91cf = c(30,20,5,5,100,80,10,60,10,25))<\/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=\"r\" 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>\u30c7\u30d0\u30a4\u30b9\u306b\u3088\u3063\u3066\u51fa\u8840\u91cf\u306b\u504f\u308a\u304c\u3042\u308b\u304b\u3069\u3046\u304b\u3092 <a href=\"https:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/stats\/html\/kruskal.test.html\" rel=\"noopener noreferrer\" target=\"_blank\">kruskal.test()<\/a> \u30b3\u30de\u30f3\u30c9\u3001<a href=\"https:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/stats\/html\/oneway.test.html\" rel=\"noopener noreferrer\" target=\"_blank\">oneway.test()<\/a> \u30b3\u30de\u30f3\u30c9\u3067\u691c\u5b9a\u3059\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=\"\">kruskal.test(\u51fa\u8840\u91cf ~ \u30c7\u30d0\u30a4\u30b9, data = data) #Kruskal-Wallis test\noneway.test(\u51fa\u8840\u91cf ~ \u30c7\u30d0\u30a4\u30b9, data = data) #one-way ANOVA \uff08Welch \u62e1\u5f35\uff09\noneway.test(\u51fa\u8840\u91cf ~ \u30c7\u30d0\u30a4\u30b9, data = data, var = T) #\u901a\u5e38\u306e one-way ANOVA<\/pre>\n\n\n\n<p><a href=\"https:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/stats\/html\/aov.html\" rel=\"noopener noreferrer\" target=\"_blank\">aov()<\/a> \u30b3\u30de\u30f3\u30c9\u3084\u3001<a href=\"https:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/stats\/html\/anova.html\" rel=\"noopener noreferrer\" target=\"_blank\">anova()<\/a> \u30b3\u30de\u30f3\u30c9\u3067\u3082 one-way ANOVA \u306e\u8a08\u7b97\u304c\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=\"\">summary(aov(\u51fa\u8840\u91cf ~ \u30c7\u30d0\u30a4\u30b9, data = data))\nanova(lm(\u51fa\u8840\u91cf ~ \u30c7\u30d0\u30a4\u30b9, data = data))<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>kruskal.test() \u30b3\u30de\u30f3\u30c9\u3067 Kruskal-Wallis test \u3092\u884c\u3046\u3002\u307e\u305f\u3001oneway.test() \u30b3\u30de\u30f3\u30c9\u3067 one-way ANOVA \uff08\u4e00\u5143\u914d\u7f6e\u5206\u6563\u5206\u6790\uff09\u3092\u884c\u3046\u3002 \u901a\u5e38\u306f Excel \u7b49\u3067\u4f5c &hellip; <a href=\"https:\/\/obgyn.jp\/?p=518\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">R \u306b\u3088\u308b Kruskal-Wallis test \u3068 ANOVA<\/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":[20,37],"class_list":["post-518","post","type-post","status-publish","format-standard","hentry","category-data-science","tag-multicomp","tag-r"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/obgyn.jp\/index.php?rest_route=\/wp\/v2\/posts\/518","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=518"}],"version-history":[{"count":12,"href":"https:\/\/obgyn.jp\/index.php?rest_route=\/wp\/v2\/posts\/518\/revisions"}],"predecessor-version":[{"id":1047,"href":"https:\/\/obgyn.jp\/index.php?rest_route=\/wp\/v2\/posts\/518\/revisions\/1047"}],"wp:attachment":[{"href":"https:\/\/obgyn.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/obgyn.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/obgyn.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}