﻿{"id":839,"date":"2012-10-30T16:37:37","date_gmt":"2012-10-30T07:37:37","guid":{"rendered":"http:\/\/fujiitoshiki.com\/improvesociety\/?p=839"},"modified":"2014-08-08T05:29:40","modified_gmt":"2014-08-07T20:29:40","slug":"how-to-calculate-fishers-exact-test-with-logarithm","status":"publish","type":"post","link":"https:\/\/www.fujiitoshiki.com\/improvesociety\/?p=839","title":{"rendered":"How to calculate Fisher&#8217;s exact test with logarithm?"},"content":{"rendered":"<div class=\"theContentWrap-ccc\"><p> Chi-square test is known to compare between ratios with two-by-two table. But you couldn&#8217;t use chi-square test if total number was smaller than 20 or expected value was smaller than 5.<\/p>\n<p> Even if you couldn&#8217;t use chi-square test, you could use Fisher&#8217;s exact test and calculate accurate p-value. Although the test has reliability, it requires huge amount of calculation with factorial function and software may overflow. You would easily calculate it with conversion to the logarithm first. Next, you could add or subtract the logarithm. At last, you could convert the result to the power of e, the base of natural logarithm. <\/p>\n<table border=\"0\" align=\"left\">\n<tbody>\n<tr style=\"background-color: #a9a9a9;\">\n<td style=\"background-color: #a9a9a9;\">\u00a0<\/td>\n<td align=\"center\" valign=\"middle\"><strong><span style=\"font-size: small; font-family: georgia, palatino; color: #ffffff;\">TRUE<\/span><\/strong><\/td>\n<td align=\"center\" valign=\"middle\"><strong><span style=\"font-size: small; font-family: georgia, palatino; color: #ffffff;\">FALSE<\/span><\/strong><\/td>\n<td style=\"background-color: #a9a9a9;\" align=\"center\" valign=\"middle\"><span style=\"font-size: small; font-family: georgia, palatino; color: #ffffff;\">Marginal total<\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"background-color: #a9a9a9;\"><strong><span style=\"font-size: small; font-family: georgia, palatino; color: #ffffff;\">POSITIVE<\/span><\/strong><\/td>\n<td align=\"center\" valign=\"middle\"><span style=\"font-size: small; font-family: georgia, palatino;\">a<\/span><\/td>\n<td align=\"center\" valign=\"middle\"><span style=\"font-family: georgia, palatino; font-size: small;\"><span style=\"line-height: 19px;\">b<\/span><\/span><\/td>\n<td style=\"background-color: #a9a9a9;\" align=\"center\" valign=\"middle\"><span style=\"font-size: small; font-family: georgia, palatino; color: #ffffff;\">a + b<\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"background-color: #a9a9a9;\"><strong><span style=\"font-size: small; font-family: georgia, palatino; color: #ffffff;\">NEGATIVE<\/span><\/strong><\/td>\n<td align=\"center\" valign=\"middle\"><span style=\"font-size: small; font-family: georgia, palatino;\">c<\/span><\/td>\n<td align=\"center\" valign=\"middle\"><span style=\"font-size: small; font-family: georgia, palatino;\">d<\/span><\/td>\n<td style=\"background-color: #a9a9a9;\" align=\"center\" valign=\"middle\"><span style=\"font-size: small; font-family: georgia, palatino; color: #ffffff;\">c + d<\/span><\/td>\n<\/tr>\n<tr style=\"background-color: #a9a9a9;\">\n<td style=\"background-color: #a9a9a9;\"><span style=\"font-size: small; font-family: georgia, palatino; color: #ffffff;\">Marginal total<\/span><\/td>\n<td align=\"center\" valign=\"middle\"><span style=\"font-size: small; font-family: georgia, palatino; color: #ffffff;\">a + c<\/span><\/td>\n<td align=\"center\" valign=\"middle\"><span style=\"font-size: small; font-family: georgia, palatino; color: #ffffff;\">b + d<\/span><\/td>\n<td align=\"center\" valign=\"middle\"><span style=\"font-size: small; font-family: georgia, palatino; color: #ffffff;\">N<\/span>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img src='https:\/\/s0.wp.com\/latex.php?latex=%5Cdisplaystyle+%5Cbegin%7Barray%7D+%7Brcl%7D+P+%26%3D%26+%5Cfrac%7B%28a%2Bb%29%21%28c%2Bd%29%21%28a%2Bc%29%21%28b%2Bd%29%21%7D%7BN%21a%21b%21c%21d%21%7D%5Cvspace%7B0.2in%7D%5C%5C%26%3D%26+%5Cexp+%5Cleft%5B+LN+%5Cleft%28+%5Cfrac%7B%28a%2Bb%29%21%28c%2Bd%29%21%28a%2Bc%29%21%28b%2Bd%29%21%7D%7BN%21a%21b%21c%21d%21%7D+%5Cright%29+%5Cright%5D%5Cvspace%7B0.2in%7D%5C%5C+%26%3D%26+%5Cexp+%5B+LN%28%28a%2Bb%29%21%29+%2B+LN%28%28c%2Bd%29%21%29+%2B+LN%28%28a%2Bc%29%21%29+%2B+LN%28%28b%2Bd%29%21%29%5Cvspace%7B0.2in%7D%5C%5C%26+%26+-+LN%28N%21%29+-+LN%28a%21%29+-+LN%28b%21%29+-+LN%28c%21%29+-+LN%28d%21%29+%5D%5Cend%7Barray%7D&#038;bg=T&#038;fg=000000&#038;s=0' alt='\\displaystyle \\begin{array} {rcl} P &amp;=&amp; \\frac{(a+b)!(c+d)!(a+c)!(b+d)!}{N!a!b!c!d!}\\vspace{0.2in}\\\\&amp;=&amp; \\exp \\left[ LN \\left( \\frac{(a+b)!(c+d)!(a+c)!(b+d)!}{N!a!b!c!d!} \\right) \\right]\\vspace{0.2in}\\\\ &amp;=&amp; \\exp [ LN((a+b)!) + LN((c+d)!) + LN((a+c)!) + LN((b+d)!)\\vspace{0.2in}\\\\&amp; &amp; - LN(N!) - LN(a!) - LN(b!) - LN(c!) - LN(d!) ]\\end{array}' title='\\displaystyle \\begin{array} {rcl} P &amp;=&amp; \\frac{(a+b)!(c+d)!(a+c)!(b+d)!}{N!a!b!c!d!}\\vspace{0.2in}\\\\&amp;=&amp; \\exp \\left[ LN \\left( \\frac{(a+b)!(c+d)!(a+c)!(b+d)!}{N!a!b!c!d!} \\right) \\right]\\vspace{0.2in}\\\\ &amp;=&amp; \\exp [ LN((a+b)!) + LN((c+d)!) + LN((a+c)!) + LN((b+d)!)\\vspace{0.2in}\\\\&amp; &amp; - LN(N!) - LN(a!) - LN(b!) - LN(c!) - LN(d!) ]\\end{array}' class='latex' \/><\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Chi-square test is known to compare between ratios with two-by-two table. But you couldn&#8217;t use chi-squar &hellip; <a href=\"https:\/\/www.fujiitoshiki.com\/improvesociety\/?p=839\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;How to calculate Fisher&#8217;s exact test with logarithm?&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[7],"tags":[32,24,33],"class_list":["post-839","post","type-post","status-publish","format-standard","hentry","category-statistics","tag-chi-square-test","tag-fishers-exact-test","tag-logarithm"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts\/839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=839"}],"version-history":[{"count":15,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts\/839\/revisions"}],"predecessor-version":[{"id":6170,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=\/wp\/v2\/posts\/839\/revisions\/6170"}],"wp:attachment":[{"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fujiitoshiki.com\/improvesociety\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}