{"id":624,"date":"2020-02-27T20:14:43","date_gmt":"2020-02-27T11:14:43","guid":{"rendered":"https:\/\/obgyn.jp\/?p=624"},"modified":"2022-03-13T19:51:50","modified_gmt":"2022-03-13T10:51:50","slug":"tukey-kramer","status":"publish","type":"post","link":"https:\/\/obgyn.jp\/?p=624","title":{"rendered":"Python \u306b\u3088\u308b Tukey-Kramer test"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.statsmodels.org\/stable\/generated\/statsmodels.stats.multicomp.pairwise_tukeyhsd.html\" rel=\"noopener noreferrer\" target=\"_blank\">statsmodels.stats.multicomp.pairwise_tukeyhsd()<\/a> \u30b3\u30de\u30f3\u30c9\u3067 Tukey-Kramer test \u3092\u884c\u3046\u3002p \u5024\u3082\u793a\u3059\u3002<\/p>\n\n\n\n<p>Python \u3092\u8d77\u52d5\u3057\u3001\u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3092 import \u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import pandas as pd\nfrom statsmodels.stats.multicomp import pairwise_tukeyhsd<\/pre>\n\n\n\n<p>\u901a\u5e38\u306f Excel \u7b49\u3067\u4f5c\u6210\u3057\u305f CSV \u30d5\u30a1\u30a4\u30eb\u3092 pandas \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=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">data = pd.DataFrame({\"\u30c7\u30d0\u30a4\u30b9\":[\"\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\":[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=\"python\" 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\u9593\u3067\u51fa\u8840\u91cf\u306e\u5e73\u5747\u306b\u5dee\u304c\u3042\u308b\u304b\u3069\u3046\u304b\u3092 <a href=\"https:\/\/www.statsmodels.org\/stable\/generated\/statsmodels.stats.multicomp.pairwise_tukeyhsd.html\" rel=\"noopener noreferrer\" target=\"_blank\">statsmodels.stats.multicomp.pairwise_tukeyhsd()<\/a> \u30b3\u30de\u30f3\u30c9\u3067\u691c\u5b9a\u3059\u308b\u3002\u7d50\u679c\u3092\u8868\u793a\u3059\u308b\u306e\u306b print() \u30b3\u30de\u30f3\u30c9\u3060\u3051\u3067\u306f p\u5024\u304c\u793a\u3055\u308c\u306a\u3044\u304c\u3001<a href=\"https:\/\/www.statsmodels.org\/stable\/generated\/statsmodels.sandbox.stats.multicomp.TukeyHSDResults.summary.html#statsmodels.sandbox.stats.multicomp.TukeyHSDResults.summary\" rel=\"noopener noreferrer\" target=\"_blank\">summary()<\/a> \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067 p \u5024\u3082\u793a\u3055\u308c\u308b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">pairwise_tukeyhsd(data[\"\u51fa\u8840\u91cf\"], data[\"\u30c7\u30d0\u30a4\u30b9\"]).summary() #95%\u4fe1\u983c\u533a\u9593\npairwise_tukeyhsd(data[\"\u51fa\u8840\u91cf\"], data[\"\u30c7\u30d0\u30a4\u30b9\"], alpha = 0.01).summary() #99%\u4fe1\u983c\u533a\u9593<\/pre>\n\n\n\n<p>\u8a08\u7b97\u7d50\u679c\u306f\u3001R \u3067\u306e\u7d50\u679c\u3068\u306f<a href=\"http:\/\/jpktd.blogspot.com\/2013\/03\/multiple-comparison-and-tukey-hsd-or_25.html\" rel=\"noopener noreferrer\" target=\"_blank\">\u5fae\u5999\u306b\u7570\u306a\u308b<\/a>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>statsmodels.stats.multicomp.pairwise_tukeyhsd() \u30b3\u30de\u30f3\u30c9\u3067 Tukey-Kramer test \u3092\u884c\u3046\u3002p \u5024\u3082\u793a\u3059\u3002 Python \u3092\u8d77\u52d5\u3057\u3001\u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3092 impo &hellip; <a href=\"https:\/\/obgyn.jp\/?p=624\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">Python \u306b\u3088\u308b Tukey-Kramer test<\/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,36],"class_list":["post-624","post","type-post","status-publish","format-standard","hentry","category-data-science","tag-multicomp","tag-python"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/obgyn.jp\/index.php?rest_route=\/wp\/v2\/posts\/624","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=624"}],"version-history":[{"count":35,"href":"https:\/\/obgyn.jp\/index.php?rest_route=\/wp\/v2\/posts\/624\/revisions"}],"predecessor-version":[{"id":992,"href":"https:\/\/obgyn.jp\/index.php?rest_route=\/wp\/v2\/posts\/624\/revisions\/992"}],"wp:attachment":[{"href":"https:\/\/obgyn.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=624"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/obgyn.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=624"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/obgyn.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=624"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}