{"id":3300,"date":"2020-05-21T18:19:33","date_gmt":"2020-05-21T09:19:33","guid":{"rendered":"https:\/\/analysis-navi.com\/?p=3300"},"modified":"2025-06-08T18:47:09","modified_gmt":"2025-06-08T09:47:09","slug":"python%e3%81%ab%e3%82%88%e3%82%8b%e4%bb%ae%e8%aa%ac%e6%a4%9c%e5%ae%9a%e3%81%ae%e5%ae%9f%e8%a1%8c%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/analysis-navi.com\/?p=3300","title":{"rendered":"Python\u306b\u3088\u308b\u4eee\u8aac\u691c\u5b9a\u306e\u5b9f\u884c\u65b9\u6cd5"},"content":{"rendered":"\n<p>Python\u3067\u4eee\u8aac\u691c\u5b9a\u3092\u884c\u3046\u65b9\u6cd5\u3067\u3059\u3002<br>t\u691c\u5b9a\u3001\u30a6\u30a3\u30eb\u30b3\u30af\u30bd\u30f3\u306e\u7b26\u53f7\u9806\u4f4d\u691c\u5b9a\u3001\u30a6\u30a3\u30eb\u30b3\u30af\u30bd\u30f3\u306e\u9806\u4f4d\u548c\u691c\u5b9a\uff08\u30de\u30f3\u30fb\u30db\u30a4\u30c3\u30c8\u30cb\u30fc\u306eU\u691c\u5b9a\uff09\u3001\u30ab\u30a4\u4e8c\u4e57\u691c\u5b9a\u306b\u3064\u3044\u3066\u3054\u7d39\u4ecb\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3069\u3046\u3044\u3046\u6642\u306b\u3069\u306e\u624b\u6cd5\u3092\u4f7f\u3048\u3070\u826f\u3044\u306e\u304b\u306b\u3064\u3044\u3066\u306f\u3001<a href=\"https:\/\/analysis-navi.com\/?p=2472\">\u300c\u4eee\u8aac\u691c\u5b9a\u306e\u4f7f\u3044\u5206\u3051\u65b9\u300d\u306e\u8a18\u4e8b<\/a>\u306b\u8a73\u3057\u304f\u6574\u7406\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u7528\u3059\u308b\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f<\/h2>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u3001\u3068\u3042\u308b\u30af\u30e9\u30b9\u306e\u4f53\u529b\u6e2c\u5b9a\u306e\u7d50\u679c\u3092\u4f7f\u3044\u3001\u69d8\u3005\u306a\u624b\u6cd5\u3067\u300c\u6709\u610f\u5dee\u300d\u304c\u3042\u308b\u304b\u8abf\u3079\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1300\" height=\"902\" src=\"https:\/\/analysis-navi.com\/wp-content\/uploads\/2020\/05\/16b5b6e333db1cdee8f9bb732aaf1dbf.png\" alt=\"\" class=\"wp-image-3329\" srcset=\"https:\/\/analysis-navi.com\/wp-content\/uploads\/2020\/05\/16b5b6e333db1cdee8f9bb732aaf1dbf.png 1300w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2020\/05\/16b5b6e333db1cdee8f9bb732aaf1dbf-576x400.png 576w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2020\/05\/16b5b6e333db1cdee8f9bb732aaf1dbf-300x208.png 300w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2020\/05\/16b5b6e333db1cdee8f9bb732aaf1dbf-768x533.png 768w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2020\/05\/16b5b6e333db1cdee8f9bb732aaf1dbf-1024x710.png 1024w\" sizes=\"(max-width: 1300px) 100vw, 1300px\" \/><\/figure>\n\n\n\n\n\n\n\n<p>\u300c\u53cd\u5fa9\u6a2a\u8df3\u3073\u300d\u3068\u300c\u8155\u7acb\u3066\u4f0f\u305b\u300d\u306f2\u56de\u3065\u3064\u3002<br>\u300c\u30d0\u30af\u8ee2\u300d\u306f\u3001\u3067\u304d\u308b\u304b\u3067\u304d\u306a\u3044\u304b\u3060\u3051\u8abf\u3079\u305f\u5f62\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br>\u203b\u666e\u901a\u3001\u4f53\u529b\u6e2c\u5b9a\u3067\u30d0\u30af\u8ee2\u306a\u3093\u3066\u3084\u308a\u307e\u305b\u3093\u304c\u3001\u4f8b\u984c\u306a\u306e\u3067\u3054\u5bb9\u8d66\u3092\u30fb\u30fb\u30fb<\/p>\n\n\n\n<p>\u307e\u305f\u3001\u4eca\u56de\u306f\u3001\u3059\u3079\u3066<strong><span style=\"background-color: #87cefa;\">scipy\u30e9\u30a4\u30d6\u30e9\u30ea\u306estats\u30af\u30e9\u30b9\u3092\u4f7f\u7528<\/span><\/strong>\u3057\u3066\u3044\u304d\u307e\u3059\u306e\u3067\u3001\u305d\u308c\u3082\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import pandas as pd\nimport numpy as np\nfrom scipy import stats\n\ndf = pd.read_csv(\"\u4f53\u529b\u6e2c\u5b9a.csv\",index_col=\"\u540d\u524d\")<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">t\u691c\u5b9a<\/h2>\n\n\n\n<p>\u307e\u305a\u306f\u53cd\u5fa9\u6a2a\u8df3\u3073\u306e\u7d50\u679c\u306b\u7740\u76ee\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br>\u4e00\u822c\u7684\u306b\u3001<strong><span style=\"background-color: #87cefa;\">\u591a\u304f\u306e\u4f53\u529b\u6e2c\u5b9a\u30c7\u30fc\u30bf\u306f\u6b63\u898f\u5206\u5e03\u306b\u5f93\u3063\u3066\u3044\u308b\u3088\u3046\u306a\u306e\u3067\u3001t\u691c\u5b9a\u3092\u9069\u7528<\/span><\/strong>\u3057\u307e\u3059\u3002<br>\uff08\u3088\u308a\u53b3\u5bc6\u306b\u3084\u308b\u306a\u3089\u3001\u6b63\u898f\u5206\u5e03\u304b\u3069\u3046\u304b\u306e\u691c\u5b9a\u3092\u5b9f\u65bd\u3057\u3066\u3001t\u691c\u5b9a\u304c\u76f8\u5fdc\u3057\u3044\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\u3057\u3066\u304b\u3089\u5b9f\u884c\u3059\u308b\u65b9\u304c\u826f\u3044\u3067\u3057\u3087\u3046\u3002\uff09<\/p>\n\n\n\n<p>t\u691c\u5b9a\u306fExcel\u3067\u3082\u51fa\u6765\u307e\u3059\u306e\u3067\u3001\u305d\u3061\u3089\u306f<a href=\"https:\/\/analysis-navi.com\/?p=1087\">\u5225\u306e\u8a18\u4e8b<\/a>\u306b\u6574\u7406\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/analysis-navi.com\/?p=1087\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">1\u5909\u6570\u306et\u691c\u5b9a<\/h3>\n\n\n\n<p>\u3053\u306e\u30af\u30e9\u30b9\u306e\u53cd\u5fa9\u6a2a\u8df3\u3073\u306e\u56de\u6570\u304c\u3001\u4e00\u822c\u7684\u306a\u4e16\u9593\u306e\u5e73\u5747\u56de\u6570\u3068\u7570\u306a\u3063\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u8abf\u3079\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br>\u4e00\u822c\u7684\u306a\u53cd\u5fa9\u6a2a\u8df3\u3073\u306e\u56de\u6570\u304c55\u56de\u3067\u3042\u308b\u3068\u3057\u305f\u6642\u3001\u3053\u306e\u30af\u30e9\u30b9\b\u306f\u300c\u4e00\u822c\u7684\u306a\u56de\u6570\u300d\u3068\u6bd4\u3079\u3066\u6709\u610f\u5dee\u304c\u3042\u308b\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306a\u30011\u5909\u6570\u306et\u691c\u5b9a\u306b\u306f<strong>ttest_1samp<\/strong>\u95a2\u6570\u304c\u4f7f\u3048\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">stats.ttest_1samp(df[\"\u53cd\u5fa9\u6a2a\u8df3\u3073(1\u56de\u76ee)\"], popmean=55)<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Ttest_1sampResult(statistic=0.3676073110469039, pvalue=0.7172290978369188)<\/pre>\n\n\n\n<p>p\u5024\u306f\u7d040.72\u3068\u3044\u3046\u3053\u3068\u3067\u30012\u3064\u306e\u5909\u6570\u306b<strong>\u300c\u6709\u610f\u5dee\u304c\u3042\u308b\u3068\u306f\u3044\u3048\u306a\u3044\u300d<\/strong>\u3068\u3044\u3046\u7d50\u679c\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3061\u306a\u307f\u306b\u3001<strong><span style=\"background-color: #87cefa;\">\u3053\u306e\u95a2\u6570\u3067\u5f97\u3089\u308c\u308bp\u5024\u306f\u4e21\u5074\u691c\u5b9a\u306b\u3088\u308b\u3082\u306e<\/span><\/strong>\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br>\u7247\u5074\u691c\u5b9a\u306b\u3088\u308bp\u5024\u304c\u6b32\u3057\u3051\u308c\u3070\u3001\u3053\u306e\u5024\u3092\u534a\u5206\u306b\u3059\u308c\u3070\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"concept-box2\"><span class=\"box-title\">\u6ce8\u610f\u70b9<\/span>\n<p>\u6709\u610f\u5dee\u304c\u6b32\u3057\u3044\u304b\u3089\u3068\u3044\u3063\u3066\u52dd\u624b\u306b\u7247\u5074\u691c\u5b9a\u306b\u3057\u3066\u306f\u3044\u3051\u307e\u305b\u3093\u3002\u4f8b\u3048\u3070\u3001\u300c\u3053\u306e\u30af\u30e9\u30b9\u306f\u4e00\u822c\u5e73\u5747\u3088\u308a\u9ad8\u3044\u4e8b\u306f\u5206\u304b\u3063\u3066\u3044\u308b\u300d\u3068\u3044\u3046\u3088\u3046\u306b\u5927\u5c0f\u95a2\u4fc2\u304c\u6c7a\u307e\u3063\u3066\u3044\u308b\u5834\u5408\u306f\u7247\u5074\u691c\u5b9a\u3067OK\u3067\u3059\u304c\u3001\u300c\u3069\u3061\u3089\u304c\u5927\u304d\u3044\u304b\u5206\u304b\u3089\u306a\u3044\u300d\u306a\u3089\u4e21\u5074\u691c\u5b9a\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u5bfe\u5fdc\u3059\u308b2\u5909\u6570\u306et\u691c\u5b9a<\/h3>\n\n\n\n<p>\u7d9a\u3044\u3066\u306f\u3001\u53cd\u5fa9\u6a2a\u8df3\u3073\u306f1\u56de\u76ee\u30682\u56de\u76ee\u3067\u3067\u304d\u308b\u56de\u6570\u306f\u5909\u308f\u308b\u306e\u304b\u8abf\u3079\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br>2\u56de\u76ee\u306e\u65b9\u304c\u75b2\u308c\u3066\u56de\u6570\u304c\u6e1b\u308b\u306e\u304b\u3001\u3080\u3057\u308d\u8eab\u4f53\u304c\u6163\u308c\u3066\u5897\u3048\u308b\u306e\u304b\u3001\u305d\u308c\u3068\u30822\u56de\u304f\u3089\u3044\u3067\u306f\u5909\u308f\u3089\u306a\u3044\u306e\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306a\u5bfe\u5fdc\u3059\u308b2\u5909\u6570\u306et\u691c\u5b9a\u306b\u306f<strong>ttest_rel<\/strong>\u95a2\u6570\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">stats.ttest_rel(df[\"\u53cd\u5fa9\u6a2a\u8df3\u3073(1\u56de\u76ee)\"], df[\"\u53cd\u5fa9\u6a2a\u8df3\u3073(2\u56de\u76ee)\"])<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Ttest_relResult(statistic=3.0455242459636036, pvalue=0.006654790139035558)<\/pre>\n\n\n\n<p>p\u5024\u306f\u7d040.001\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3053\u3061\u3089\u306f\u6709\u610f\u5dee\u304c\u3042\u308b\u3068\u8a00\u3048\u305d\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5bfe\u5fdc\u3057\u306a\u30442\u5909\u6570\u306et\u691c\u5b9a<\/h3>\n\n\n\n<p>\u304a\u6b21\u306f\u3001\u3067\u304d\u308b\u56de\u6570\u304c\u7537\u5973\u3067\u7570\u306a\u308b\u306e\u304b\u8abf\u3079\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br>\u4eba\u6570\u304c\u9055\u3046\u306e\u3067\u3001\u5bfe\u5fdc\u7121\u3057\u306et\u691c\u5b9a\u3092\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u5bfe\u5fdc\u306a\u3057\u306et\u691c\u5b9a\u306b\u306f<strong>ttest_ind<\/strong>\u95a2\u6570\u3092\u4f7f\u3044\u307e\u3059\u3002<br>\u6570\u5024\u306f\u3068\u308a\u3042\u3048\u305a1\u56de\u76ee\u306e\u3082\u306e\u3092\u4f7f\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">stats.ttest_ind(df[df[\"\u6027\u5225\"]==\"\u7537\u6027\"][\"\u53cd\u5fa9\u6a2a\u8df3\u3073(1\u56de\u76ee)\"], df[df[\"\u6027\u5225\"]==\"\u5973\u6027\"][\"\u53cd\u5fa9\u6a2a\u8df3\u3073(1\u56de\u76ee)\"])<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Ttest_indResult(statistic=1.4684577698871681, pvalue=0.15923896868245274)<\/pre>\n\n\n\n<p>\u307e\u305f\u3001\u5bfe\u5fdc\u306e\u306a\u3044t\u691c\u5b9a\u3067\u306f2\u3064\u306e\u5909\u6570\u306e\u5206\u6563\u304c\u540c\u7a0b\u5ea6\u304b\u3001\u7570\u306a\u308b\u306e\u304b\u306b\u3088\u3063\u3066\u9069\u5207\u306a\u65b9\u6cd5\u304c\u7570\u306a\u308a\u307e\u3059\u3002<br>\u540c\u7a0b\u5ea6\u306e\u5834\u5408\u306f\u305d\u306e\u307e\u307e\u4f7f\u3048\u3070OK\u3067\u3059\u304c\u3001\u7570\u306a\u308b\u5834\u5408\u306f\u3001\u5f15\u6570\u306b<strong>\u300cequal_var=False\u300d<\/strong>\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<br>\u5206\u6563\u304c\u540c\u7a0b\u5ea6\u3068\u898b\u306a\u305b\u308b\u304b\u3069\u3046\u304b\u306b\u306f\u6b21\u306b\u7d39\u4ecb\u3059\u308bF\u691c\u5b9a\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">F\u691c\u5b9a<\/h2>\n\n\n\n<p>2\u3064\u306e\u5909\u6570\u306e\u5206\u6563\u304c\u540c\u7a0b\u5ea6\u304b\u3001\u7570\u306a\u308b\u306e\u304b\u3092\u7d71\u8a08\u7684\u306b\u8abf\u3079\u308b\u306b\u306fF\u691c\u5b9a\u3092\u3057\u307e\u3059\u3002<br>\u3053\u308c\u306b\u306f<strong>bartlett<\/strong>\u95a2\u6570\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">stats.bartlett(df[df[\"\u6027\u5225\"]==\"\u7537\u6027\"][\"\u53cd\u5fa9\u6a2a\u8df3\u3073(1\u56de\u76ee)\"], df[df[\"\u6027\u5225\"]==\"\u5973\u6027\"][\"\u53cd\u5fa9\u6a2a\u8df3\u3073(1\u56de\u76ee)\"])<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">BartlettResult(statistic=1.5881897459271868, pvalue=0.2075849593836162)<\/pre>\n\n\n\n<p>p\u5024\u306f\u7d040.208\u3068\u3044\u3046\u3053\u3068\u3067\u30012\u3064\u306e\u5909\u6570\u306e\u5206\u6563\u306b\u300c\u6709\u610f\u5dee\u304c\u3042\u308b\u3068\u306f\u3044\u3048\u306a\u3044\u300d\u30fb\u30fb\u30fb\u3064\u307e\u308a<strong><span style=\"background-color: #87cefa;\">\u5206\u6563\u306f\u540c\u7a0b\u5ea6\u3068\u8003\u3048\u3089\u308c\u308b<\/span><\/strong>\u3068\u51fa\u307e\u3057\u305f\u3002<br>\u3088\u3063\u3066\u3001\u5148\u307b\u3069\u306et\u691c\u5b9a\u306e\u5f15\u6570\u306bequal_var=False\u306f\u4e0d\u8981\u3060\u3063\u305f\u3068\u3044\u3046\u4e8b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30a6\u30a3\u30eb\u30b3\u30af\u30bd\u30f3\u306e\u9806\u4f4d\u7b26\u53f7\u691c\u5b9a<\/h2>\n\n\n\n<p>\u3055\u3066\u3001\u304a\u6b21\u306f\u8155\u7acb\u3066\u4f0f\u305b\u306b\u3064\u3044\u3066\u30011\u56de\u76ee\u30682\u56de\u76ee\u3067\u56de\u6570\u306f\u5909\u308f\u308b\u306e\u304b\u8abf\u3079\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br>\u8155\u7acb\u3066\u4f0f\u305b\u306f\u53cd\u5fa9\u6a2a\u8df3\u3073\u3068\u306f\u5c11\u3057\u50be\u5411\u304c\u9055\u3044\u307e\u3059\u3002<br>\u5b9f\u969b\u306b\u30c7\u30fc\u30bf\u3092\u898b\u3066\u308f\u304b\u308b\u3088\u3046\u306b\u30011\u56de\u3082\u51fa\u6765\u306a\u3044\u4eba\u3082\u591a\u304f\u3001\u3067\u304d\u308b\u4eba\u306f\u3081\u3061\u3083\u304f\u3061\u3083\u3067\u304d\u305f\u308a\u3057\u307e\u3059\u3002<br>\u3088\u3063\u3066\u3001\u3053\u308c\u306f<strong><span style=\"background-color: #87cefa;\">\u6b63\u898f\u5206\u5e03\u3068\u307f\u306a\u305b\u305d\u3046\u306b\u3042\u308a\u307e\u305b\u3093\u3002<\/span><\/strong><\/p>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u300c\u5bfe\u5fdc\u3059\u308b\u30c7\u30fc\u30bf\u300d\u3067\u3001\u304b\u3064\u6b63\u898f\u5206\u5e03\u3092\u4eee\u5b9a\u3067\u304d\u306a\u3044\u6642\u306b\u306f<strong><span style=\"background-color: #87cefa;\">\u30ce\u30f3\u30d1\u30e9\u30e1\u30c8\u30ea\u30c3\u30af\u691c\u5b9a\u306e\u300c\u30a6\u30a3\u30eb\u30b3\u30af\u30bd\u30f3\u306e\u9806\u4f4d\u7b26\u53f7\u691c\u5b9a\u300d<\/span><\/strong>\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u3061\u3089\u306fstats\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u7528\u610f\u3055\u308c\u3066\u3044\u308b<strong>wilcoxon<\/strong>\u95a2\u6570\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">stats.wilcoxon(df[\"\u8155\u7acb\u3066\u4f0f\u305b(1\u56de\u76ee)\"], df[\"\u8155\u7acb\u3066\u4f0f\u305b(2\u56de\u76ee)\"])<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">WilcoxonResult(statistic=5.0, pvalue=0.020889731442320328)<\/pre>\n\n\n\n<p>p\u5024\u306f\u7d040.021\u30fb\u30fb\u30fb\u3064\u307e\u308a\u6709\u610f\u5dee\u304c\u3042\u308b\u3088\u3046\u3067\u3059\u3002<br>wilcoxon\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u5f15\u6570<strong>alternative=&#8217;greater&#8217;<\/strong>\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u306b\u3088\u308a\u7247\u5074\u691c\u5b9a\u306e\u7d50\u679c\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30a6\u30a3\u30eb\u30b3\u30af\u30bd\u30f3\u306e\u9806\u4f4d\u548c\u691c\u5b9a<\/h2>\n\n\n\n<p>\u3067\u306f\u3001\u8155\u7acb\u3066\u4f0f\u305b\u306e\u3067\u304d\u308b\u56de\u6570\u304c\u7537\u5973\u3067\u7570\u306a\u308b\u306e\u304b\u8abf\u3079\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br>\u30c7\u30fc\u30bf\u6570\u304c\u7570\u306a\u308b\u306e\u3067\u30a6\u30a3\u30eb\u30b3\u30af\u30bd\u30f3\u306e\u9806\u4f4d\u7b26\u53f7\u691c\u5b9a\u306f\u4f7f\u3048\u307e\u305b\u3093\u3002<br>\u3053\u3046\u3044\u3063\u305f\u5bfe\u5fdc\u306e\u306a\u3044\u5834\u5408\u306f\u3001<strong><span style=\"background-color: #87cefa;\">\u30a6\u30a3\u30eb\u30b3\u30af\u30bd\u30f3\u306e\u9806\u4f4d\u548c\u691c\u5b9a\uff08\u30de\u30f3\u30fb\u30db\u30a4\u30c3\u30c8\u30cb\u30fc\u306eU\u691c\u5b9a\uff09<\/span><\/strong>\u3092\u7528\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>stats\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u7528\u610f\u3055\u308c\u3066\u3044\u308b<strong>mannwhitneyu<\/strong>\u95a2\u6570\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">stats.mannwhitneyu(df[df[\"\u6027\u5225\"]==\"\u7537\u6027\"][\"\u8155\u7acb\u3066\u4f0f\u305b(1\u56de\u76ee)\"], df[df[\"\u6027\u5225\"]==\"\u5973\u6027\"][\"\u8155\u7acb\u3066\u4f0f\u305b(1\u56de\u76ee)\"])<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">MannwhitneyuResult(statistic=76.0, pvalue=0.015249132623633525)<\/pre>\n\n\n\n<p>\u540c\u69d8\u306b\u3001\u7247\u5074\u691c\u5b9a\u306b\u3057\u305f\u3044\u5834\u5408\u306f\u5f15\u6570<strong>alternative=&#8217;greater&#8217;<\/strong>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30ab\u30a4\u4e8c\u4e57\u691c\u5b9a<\/h2>\n\n\n\n<p>\u30d0\u30af\u8ee2\u304c\u3067\u304d\u308b\u304b\u3069\u3046\u304b\u3001\u7537\u5973\u3067\u7570\u306a\u308b\u306e\u304b\u8abf\u3079\u307e\u3057\u3087\u3046\u3002<br>\u3053\u306e\u3088\u3046\u306b\u3001\u6570\u5024\u3067\u306f\u306a\u304f<strong><span style=\"background-color: #87cefa;\">\u300c\u3067\u304d\u308b\uff0f\u3067\u304d\u306a\u3044\u300d\u306e\u3088\u3046\u306a\u30ab\u30c6\u30b4\u30ea\u30c7\u30fc\u30bf\u306e\u6642\u306f\u3053\u308c\u307e\u3067\u306e\u691c\u5b9a\u306f\u9069\u7528\u3067\u304d\u306a\u3044\u306e\u3067\u3001\u4ee3\u308f\u308a\u306b\u30ab\u30a4\u4e8c\u4e57\u691c\u5b9a\u3092\u4f7f\u3044\u307e\u3059\u3002<\/span><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">crosstab = pd.crosstab(df[\"\u6027\u5225\"],df[\"\u30d0\u30af\u8ee2\"])\nstats.chi2_contingency(crosstab)<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">(0.27777777777777773, 0.5981614526835279, 1, array([[6., 2.],[9., 3.]]))<\/pre>\n\n\n\n<p>\u30ab\u30a4\u4e8c\u4e57\u691c\u5b9a\u306f\u3001\u4eca\u307e\u3067\u306e\u3084\u308a\u65b9\u3068\u306f\u5c11\u3057\u9055\u3044\u307e\u3059\u3002<br>\u307e\u305a\u3001pandas\u306e<strong>crosstab<\/strong>\u30e1\u30bd\u30c3\u30c9\u3067\u30af\u30ed\u30b9\u96c6\u8a08\u3092\u884c\u3044\u307e\u3059\u3002<br>\u305d\u306e\u30af\u30ed\u30b9\u96c6\u8a08\u8868\u306b\u5bfe\u3057\u3066<strong>chi2_contingency<\/strong>\u30e1\u30bd\u30c3\u30c9\u3092\u9069\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u7d50\u679c\u306f\u30ab\u30a4\u4e8c\u4e57\u5024\u3001p\u5024\u3001\u81ea\u7531\u5ea6\u3001\u671f\u5f85\u5ea6\u6570\u30fb\u30fb\u30fb\u306e\u9806\u756a\u306b\u53d6\u5f97\u3055\u308c\u307e\u3059\u3002<br>\u3064\u307e\u308a\u3001p\u5024\u306f\u7d040.598\u306a\u306e\u3067\u3001\u7537\u5973\u9593\u3067\u30d0\u30af\u8ee2\u304c\u51fa\u6765\u308bor\u51fa\u6765\u306a\u3044\u306b\u306f\u6709\u610f\u5dee\u304c\u3042\u308b\u3068\u306f\u3044\u3048\u306a\u3044\u3001\u3068\u3044\u3046\u7d50\u679c\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u3055\u3044\u3054\u306b<\/h2>\n\n\n\n<p>\u4eee\u8aac\u691c\u5b9a\u3067\u6709\u610f\u5dee\u3092\u51fa\u3057\u305f\u3044\u3068\u3044\u3063\u3066\u3082\u3001\u30c7\u30fc\u30bf\u306b\u3088\u308a\u9069\u5207\u306a\u65b9\u6cd5\u306f\u9055\u3063\u3066\u304d\u307e\u3059\u3002<br>\u304d\u3061\u3093\u3068\u9069\u5207\u306a\u624b\u6cd5\u3092\u9078\u629e\u3057\u3066\u3001\u305d\u3057\u3066\u3069\u306e\u65b9\u6cd5\u3092\u4f7f\u3046\u3053\u3068\u306b\u306a\u3063\u3066\u3082\u8ff7\u308f\u305a\u306b\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u6e96\u5099\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python\u3067\u4eee\u8aac\u691c\u5b9a\u3092\u884c\u3046\u65b9\u6cd5\u3067\u3059\u3002t\u691c\u5b9a\u3001\u30a6\u30a3\u30eb\u30b3\u30af\u30bd\u30f3\u306e\u7b26\u53f7\u9806\u4f4d\u691c\u5b9a\u3001\u30a6\u30a3\u30eb\u30b3\u30af\u30bd\u30f3\u306e\u9806\u4f4d\u548c\u691c\u5b9a\uff08\u30de\u30f3\u30fb\u30db\u30a4\u30c3\u30c8\u30cb\u30fc\u306eU\u691c\u5b9a\uff09\u3001\u30ab\u30a4\u4e8c\u4e57\u691c\u5b9a\u306b\u3064\u3044\u3066\u3054\u7d39\u4ecb\u3057\u3066\u3044\u307e\u3059\u3002 \u3069\u3046\u3044\u3046\u6642\u306b\u3069\u306e\u624b\u6cd5\u3092\u4f7f\u3048\u3070\u826f\u3044\u306e\u304b\u306b\u3064\u3044\u3066\u306f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4973,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"swell_btn_cv_data":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[129],"tags":[131,134],"class_list":["post-3300","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-study","tag-stats","tag-python"],"_links":{"self":[{"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/posts\/3300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3300"}],"version-history":[{"count":9,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/posts\/3300\/revisions"}],"predecessor-version":[{"id":5030,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/posts\/3300\/revisions\/5030"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/media\/4973"}],"wp:attachment":[{"href":"https:\/\/analysis-navi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}