{"id":594,"date":"2015-08-01T13:55:21","date_gmt":"2015-08-01T12:55:21","guid":{"rendered":"http:\/\/pcool.dyndns.org:8080\/statsbook\/?page_id=594"},"modified":"2025-07-03T16:06:31","modified_gmt":"2025-07-03T15:06:31","slug":"non-parametric-tests","status":"publish","type":"page","link":"https:\/\/pcool.dyndns.org\/index.php\/non-parametric-tests\/","title":{"rendered":"Non Parametric Tests"},"content":{"rendered":"\n<p>If data are not <a href=\"https:\/\/pcool.dyndns.org\/index.php\/normal-distribution\/\" data-type=\"page\" data-id=\"578\">Normally distributed<\/a>, a non parametric test should be used.<\/p>\n\n\n\n<p>There are many non parametric tests described, and it is impossible to name \/ lists them all. The following tests are discussed using the example data in <a href=\"https:\/\/pcool.dyndns.org:\/wp-content\/data_files\/skinfold.rda\" target=\"_blank\" rel=\"noreferrer noopener\">skinfold.rda<\/a>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Sign test<\/strong><\/li>\n\n\n\n<li><strong>Chi square test<\/strong><\/li>\n\n\n\n<li><strong>Fisher Exact test<\/strong><\/li>\n\n\n\n<li><strong>Mann-Whitney U test \/ Wilcoxon test<br><\/strong><\/li>\n<\/ul>\n\n\n\n<p>It <a href=\"https:\/\/pcool.dyndns.org\/index.php\/non-parametric-tests-2\/\" data-type=\"page\" data-id=\"605\">has been shown<\/a> that the data do not conform a Normal distribution. Therefore, parametric statistics can&#8217;t be used and a non parametric test should be used instead. The skinfold data will be analysed with each of the four tests mentioned above.<\/p>\n\n\n\n<p><strong>Sign Test<\/strong><\/p>\n\n\n\n<p>This is the most basic type of non parametric test. As the name implies, it uses the plus or minus sign to differentiate. The data is transformed; if the skin fold is smaller or equal to 4 mm, we indicate this by a minus sign and if the skin fold is greater than 4 mm by a plus sign. The data can than be summarised in a contingency table (row: skin thickness, column: cancer or not):<\/p>\n\n\n\n<table id=\"tablepress-10\" class=\"tablepress tablepress-id-10\">\n<thead>\n<tr class=\"row-1\">\n\t<td class=\"column-1\"><\/td><th class=\"column-2\">No Cancer<\/th><th class=\"column-3\">Cancer<\/th><th class=\"column-4\">Total<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\"><= 4 mm<\/td><td class=\"column-2\">10<\/td><td class=\"column-3\">8<\/td><td class=\"column-4\">18<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">> 4 mm<\/td><td class=\"column-2\">10<\/td><td class=\"column-3\">1<\/td><td class=\"column-4\">11<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\">Total<\/td><td class=\"column-2\">20<\/td><td class=\"column-3\">9<\/td><td class=\"column-4\">29<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-10 from cache -->\n\n\n<p>Therefore, of the patients with cancer, there is only 1 out of 9 patients who has a skin thickness of more than 4 mm; whilst 50% of the patients without cancer has a skin fold thickness of more than 4 mm. Is this due to <a href=\"https:\/\/pcool.dyndns.org\/index.php\/probability-and-chance\/\" data-type=\"page\" data-id=\"932\">chance<\/a> \/ random variation or is there a statistically significant difference between the two groups?<\/p>\n\n\n\n<p>If the probabilities were equal, the probability of plus and minus would be 50% (1\/2).<\/p>\n\n\n\n<p>If we test <strong><em>two sided<\/em><\/strong> we need to calculate the probability that:<\/p>\n\n\n\n<p>P = &nbsp;&nbsp; 0 out of 9 patients &gt; 4 mm + 1 out of 9 patients &gt; 4 mm<\/p>\n\n\n\n<p>8 out of 9 patients &lt; 4 mm + 9 out of 9 patients &lt; 4 mm<\/p>\n\n\n\n<p><a href=\"https:\/\/pcool.dyndns.org\/index.php\/probability-and-chance\/\" data-type=\"page\" data-id=\"932\"> So<\/a>:<\/p>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(P = {9 \\choose 0} \\cdot (0.5)^0 \\cdot (0.5)^9 + {9 \\choose 1} \\cdot (0.5)^1 \\cdot (0.5)^8 + \\)\n\\({9 \\choose 8} \\cdot (0.5)^8 \\cdot (0.5)^1 + {9 \\choose 9} \\cdot (0.5)^9 \\cdot (0.5)^0 \\)<script src=\"https:\/\/pcool.dyndns.org\/wp-includes\/js\/dist\/hooks.min.js?ver=dd5603f07f9220ed27f1\" id=\"wp-hooks-js\"><\/script>\n<script src=\"https:\/\/pcool.dyndns.org\/wp-includes\/js\/dist\/i18n.min.js?ver=c26c3dc7bed366793375\" id=\"wp-i18n-js\"><\/script>\n<script id=\"wp-i18n-js-after\">\nwp.i18n.setLocaleData( { 'text direction\\u0004ltr': [ 'ltr' ] } );\n\/\/# sourceURL=wp-i18n-js-after\n<\/script>\n<script  async src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/mathjax\/2.7.7\/MathJax.js?config=TeX-MML-AM_CHTML\" id=\"mathjax-js\"><\/script>\n<\/div>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(P = \\frac{9!}{9! \\cdot 0!} \\cdot(0.5)^0 \\cdot (0.5)^9  + \\frac{9!}{8! \\cdot 1!} \\cdot(0.5)^1 \\cdot (0.5)^8  + \\)\n\\(\\frac{9!}{1! \\cdot 8!} \\cdot(0.5)^8 \\cdot (0.5)^1  + \\frac{9!}{0! \\cdot 9!} \\cdot(0.5)^9  \\)\n <\/div>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(P = 1 \\cdot 0.001953125 + 9 \\cdot 0.001953125  +  \\)\n\\(9 \\cdot 0.001953125  + 1 \\cdot 0.001953125 \\)<\/div>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(P = 0.0390625 \\)<\/div>\n\n\n\n<p>P &lt; 5%, therefore statistically significant.<\/p>\n\n\n\n<p><em><strong>It is straight forward to perform a binomial test in R:<\/strong><\/em><\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><span style=\"color: #ff0000;\"><em>binom.test(1,9)<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>\u00a0\u00a0 \u00a0Exact binomial test<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>data:\u00a0 1 and 9<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>number of successes = 1, number of trials = 9, <strong>p-value = 0.03906<\/strong><\/em><\/span>\n<span style=\"color: #0000ff;\"><em>alternative hypothesis: true probability of success is not equal to 0.5<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>95 percent confidence interval:<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>\u00a00.002809137 0.482496515<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>sample estimates:<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>probability of success <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0.1111111<\/em> <\/span><\/code><\/pre>\n\n\n\n<p>Therefore, the null hypothesis is rejected in favour of the alternate hypothesis and it is concluded that there is a difference in skin thickness between cancer patients and other patients.<\/p>\n\n\n\n<p><strong>Chi Square Test (\ud835\udce7<sup>2<\/sup> test)<\/strong><\/p>\n\n\n\n<p>Instead of the sign test, the  Square test can be used. There are prerequisites for the Chi square test. These are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em><strong>Random sample<\/strong><\/em><\/li>\n\n\n\n<li><em><strong>Sufficient sample size<\/strong><\/em><\/li>\n\n\n\n<li><em><strong>Independence<\/strong><\/em> of the observations<\/li>\n\n\n\n<li><em><strong>Expected cell count<\/strong><\/em> at least 5 in 2 by 2 tables or at least 5 in 80% of larger tables, but no cells with an expected count of 0.<\/li>\n<\/ul>\n\n\n\n<p>For now, lets assume the prerequisites have been met. Again, we look at the table (these are the<strong> observed frequencies<\/strong>):<\/p>\n\n\n\n<table id=\"tablepress-10-no-2\" class=\"tablepress tablepress-id-10\">\n<thead>\n<tr class=\"row-1\">\n\t<td class=\"column-1\"><\/td><th class=\"column-2\">No Cancer<\/th><th class=\"column-3\">Cancer<\/th><th class=\"column-4\">Total<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\"><= 4 mm<\/td><td class=\"column-2\">10<\/td><td class=\"column-3\">8<\/td><td class=\"column-4\">18<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">> 4 mm<\/td><td class=\"column-2\">10<\/td><td class=\"column-3\">1<\/td><td class=\"column-4\">11<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\">Total<\/td><td class=\"column-2\">20<\/td><td class=\"column-3\">9<\/td><td class=\"column-4\">29<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-10-no-2 from cache -->\n\n\n<p>In total, there are 18 out of 29 patients with a skin fold thickness of &lt;= 4 mm. If there were no difference between the two groups, we would expect 20 \u00d7 18 \/ 29 patients in the &#8216;No Cancer&#8217; Group and 9 \u00d7 18 \/ 29 patient in the &#8216;Cancer&#8217; group with a skin thickness &lt;= 4 mm. These are called the <strong>expected frequencies<\/strong>. Similarly, we would expect 20 \u00d7 11 \/ 29 patients in the &#8216;No Cancer&#8217; group and 9 \u00d7 11 \/ 29 patients in the &#8216;Cancer group with a skin thickness &gt; 4 mm. Or summarised in a table:<\/p>\n\n\n\n<table id=\"tablepress-11\" class=\"tablepress tablepress-id-11\">\n<thead>\n<tr class=\"row-1\">\n\t<td class=\"column-1\"><\/td><th class=\"column-2\">No <br \/>\nCancer<br \/>\nObserved<\/th><th class=\"column-3\">No <br \/>\nCancer<br \/>\nExpected<\/th><th class=\"column-4\">Cancer<br \/>\nObserved<\/th><th class=\"column-5\">Cancer<br \/>\nExpected<\/th><th class=\"column-6\">Total<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\"><= 4 mm<\/td><td class=\"column-2\">10<\/td><td class=\"column-3\">12.4<\/td><td class=\"column-4\">8<\/td><td class=\"column-5\">5.6<\/td><td class=\"column-6\">18<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">> 4 mm<\/td><td class=\"column-2\">10<\/td><td class=\"column-3\">7.6<\/td><td class=\"column-4\">1<\/td><td class=\"column-5\">3.4<\/td><td class=\"column-6\">11<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\">Total<\/td><td class=\"column-2\">20<\/td><td class=\"column-3\">20<\/td><td class=\"column-4\">9<\/td><td class=\"column-5\">9<\/td><td class=\"column-6\">29<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-11 from cache -->\n\n\n<p class=\"is-style-text-annotation is-style-text-annotation--1\">Please note one of the expected frequencies is below 5!<\/p>\n\n\n\n<p>Next, the Chi Square test statistic is calculated:<\/p>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(\\chi^2 = \\sum (\\frac{(Observed &#8211; Expected)^2}{Expected}) \\)<\/div>\n\n\n\n<p>So:<\/p>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(\\chi^2 = \\sum (\\frac{(O-E)^2}{E}) = \\frac{(10 &#8211; 12.4)^2}{12.4} + \\frac{(8- 5.6)^2}{5.6} + \\frac{(10 &#8211; 7.6)^2}{7.6} + \\frac{(1 &#8211; 3.4)^2}{3.4} \\)<\/div>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\( \\chi^2 \\approx 3.987093154 \\)<\/div>\n\n\n\n<p>Next we need to determine the <strong><em>degrees of freedom<\/em><\/strong>: In the observed frequencies table, there are two columns (c = 2) and two rows (r = 2). So there are (r &#8211; 1)\u00d7(c &#8211; 1) = 1 degree of freedom.<\/p>\n\n\n\n<p>We can now look in a Chi Square distribution table (statistical table):<\/p>\n\n\n\n<table id=\"tablepress-12\" class=\"tablepress tablepress-id-12\">\n<thead>\n<tr class=\"row-1\">\n\t<th class=\"column-1\">Degrees <br \/>\nof <br \/>\nFreedom<\/th><th class=\"column-2\">10%<\/th><th class=\"column-3\">5%<\/th><th class=\"column-4\">1%<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">1<\/td><td class=\"column-2\">2.71<\/td><td class=\"column-3\">3.84<\/td><td class=\"column-4\">6.63<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">2<\/td><td class=\"column-2\">4.61<\/td><td class=\"column-3\">5.99<\/td><td class=\"column-4\">9.21<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\">3<\/td><td class=\"column-2\">6.25<\/td><td class=\"column-3\">7.81<\/td><td class=\"column-4\">11.34<\/td>\n<\/tr>\n<tr class=\"row-5\">\n\t<td class=\"column-1\">4<\/td><td class=\"column-2\">7.78<\/td><td class=\"column-3\">9.49<\/td><td class=\"column-4\">13.28<\/td>\n<\/tr>\n<tr class=\"row-6\">\n\t<td class=\"column-1\">5<\/td><td class=\"column-2\">9.24<\/td><td class=\"column-3\">11.07<\/td><td class=\"column-4\">15.09<\/td>\n<\/tr>\n<tr class=\"row-7\">\n\t<td class=\"column-1\">10<\/td><td class=\"column-2\">15.99<\/td><td class=\"column-3\">18.31<\/td><td class=\"column-4\">23.21<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-12 from cache -->\n\n\n<p>Looking in the first row under one degree of freedom:<\/p>\n\n\n\n<p>P = 3.84 at 5% and 6.63 at 1%.<\/p>\n\n\n\n<p>3.987093154 &gt; 3.84 and therefore the null hypothesis can be rejected in favour of the alternate hypothesis (p &lt; 5%).<\/p>\n\n\n\n<p class=\"is-style-text-annotation is-style-text-annotation--2\">Please note that statistical significance is demonstrated at p &lt;= 5%, but <em>not<\/em> at p &lt;= 1%<\/p>\n\n\n\n<p><em><strong>In the R console:<\/strong><\/em><\/p>\n\n\n\n<p>If the 2 by 2 table has already been constructed, it is easy to perform a Chi Square test. First create a matrix that contains the data in 2 rows:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><span style=\"color: #ff0000;\"><em>skindata &lt;- matrix(c(10,10,8,1),nrow=2)<\/em><\/span>\n<em><mark style=\"background-color:rgba(0, 0, 0, 0);color:#f60404\" class=\"has-inline-color\">skindata\n<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#2b05f5\" class=\"has-inline-color\">     &#91;,1] &#91;,2]\n&#91;1,]   10    8\n&#91;2,]   10    1<\/mark><\/em><\/code><\/pre>\n\n\n\n<p>Next, do a Chi Square test:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><span style=\"color: #ff0000;\"><em>chisq.test(skindata,correct=FALSE)<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>\u00a0\u00a0 \u00a0Pearson's Chi-squared test<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>data:\u00a0 skindata<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>X-squared = 3.9871, df = 1, <strong>p-value = 0.04585<\/strong><\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Warning message:<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>In chisq.test(skindata, correct = FALSE) :<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>\u00a0 Chi-squared approximation may be incorrect<\/em><\/span><\/code><\/pre>\n\n\n\n<p class=\"is-style-text-annotation is-style-text-annotation--3\">The &#8216;correct=FALSE&#8217; option switches OFF the continuity correction (Yates) when computing the test statistic. This involves subtracting 0.5 from the difference in observed and expected frequencies before squaring. The Yates continuity correction is recommended, especially when the numbers are small in a two by two table. In this case, it would be better to use the continuity correction.<\/p>\n\n\n\n<p>The result is the same as with the manual method. Again, we reject the null hypothesis in favour of the alternate hypothesis: The skin thickness is less in patients with cancer than in other patients. However, the numbers are small and it would be better to use the Yates continuity correction:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><em><mark style=\"background-color:rgba(0, 0, 0, 0);color:#f70202\" class=\"has-inline-color\">chisq.test(skindata,correct=TRUE)\n\n<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#2a02f7\" class=\"has-inline-color\">\tPearson's Chi-squared test with Yates' continuity correction\n\ndata:  skindata\nX-squared = 2.5064, df = 1, <strong>p-value = 0.1134<\/strong>\n\nWarning message:\nIn chisq.test(skindata, correct = TRUE) :\n  Chi-squared approximation may be incorrect<\/mark><\/em><\/code><\/pre>\n\n\n\n<p>This show a non significant result.<\/p>\n\n\n\n<p>To show the expected frequencies:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><em><mark style=\"background-color:rgba(0, 0, 0, 0);color:#f70707\" class=\"has-inline-color\">chisq.test(skindata,correct=FALSE)$expected\n<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#4e07f7\" class=\"has-inline-color\">          &#91;,1]     &#91;,2]\n&#91;1,] 12.413793 5.586207\n&#91;2,]  7.586207 <strong>3.413793<\/strong><\/mark><\/em>\n<em><mark style=\"background-color:rgba(0, 0, 0, 0);color:#620df7\" class=\"has-inline-color\">Warning message:\nIn chisq.test(skindata, correct = FALSE) :\n  Chi-squared approximation may be incorrect<\/mark><\/em><\/code><\/pre>\n\n\n\n<p class=\"is-style-text-annotation is-style-text-annotation--4\">Please note that the prerequisites of the Chi Square test have not been met! One of the expected frequencies is less than 5, hence the warning.<\/p>\n\n\n\n<p><em><strong>Create matrix:<\/strong><\/em><\/p>\n\n\n\n<p>Above, the matrix was created &#8216;manually&#8217; by adding up the categories. However, this would be more difficult with large data sets. To recode the Skinfold variable into a new binary variable (Skinfold_cat)and create a two by two table in R:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><em><mark style=\"background-color:rgba(0, 0, 0, 0);color:#f50515\" class=\"has-inline-color\">skinfold$Skinfold_cat &lt;- ifelse(skinfold$Skinfold &lt;= 4, 0, 1)\nskinfold<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#3b04f6\" class=\"has-inline-color\">\n   Patient     Group Skinfold Skinfold_cat\n1        1 No Cancer      1.9            0\n2        2 No Cancer      2.2            0\n3        3 No Cancer      2.3            0\n4        4 No Cancer      2.6            0\n5        5 No Cancer      2.8            0\n6        6 No Cancer      2.9            0\n7        7 No Cancer      3.0            0\n8        8 No Cancer      3.7            0\n9        9 No Cancer      3.8            0\n10      10 No Cancer      4.0            0\n11      11 No Cancer      4.3            1\n12      12 No Cancer      4.4            1\n13      13 No Cancer      4.8            1\n14      14 No Cancer      5.6            1\n15      15 No Cancer      6.0            1\n16      16 No Cancer      6.2            1\n17      17 No Cancer      6.2            1\n18      18 No Cancer      7.0            1\n19      19 No Cancer     10.0            1\n20      20 No Cancer     10.4            1\n21      21    Cancer      1.8            0\n22      22    Cancer      2.0            0\n23      23    Cancer      2.0            0\n24      24    Cancer      2.0            0\n25      25    Cancer      3.0            0\n26      26    Cancer      3.8            0\n27      27    Cancer      3.9            0\n28      28    Cancer      4.0            0\n29      29    Cancer      4.1            1\n<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#f50515\" class=\"has-inline-color\">table(skinfold$Skinfold_cat, skinfold$Group)<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#3b04f6\" class=\"has-inline-color\">\n   \n    Cancer No Cancer\n  0      8        10\n  1      1        10<\/mark><\/em><\/code><\/pre>\n\n\n\n<p><strong>Fisher Exact test<\/strong><\/p>\n\n\n\n<p>The output in the Chi Square test gives a warning that the approximation may be incorrect. This is because not all prerequisites for the Chi Square test have been met. One of the cells has an expected frequency of less than 5 (<strong>3.413<\/strong>); therefore the Chi Square test may be incorrect and a Fisher Exact test is more appropriate. To perform a Fisher Exact test:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><span style=\"color: #ff0000;\"><em>fisher.test(skindata)<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>\u00a0\u00a0 \u00a0Fisher's Exact Test for Count Data<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>data:\u00a0 skindata<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>p-value = 0.0959<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>alternative hypothesis: true odds ratio is not equal to 1<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>95 percent confidence interval:<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>\u00a00.002571797 1.319280078<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>sample estimates:<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>odds ratio <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>\u00a00.1333924<\/em> <\/span><\/code><\/pre>\n\n\n\n<p>The Fisher Exact test, does not reject the null hypothesis as the p-value is 0.0959.<\/p>\n\n\n\n<p><strong>Mann-Whitney U Test \/ Wilcoxon Test<\/strong><\/p>\n\n\n\n<p>This test has several names: Mann\u2013Whitney U test, Mann-Whitney-Wilcoxon test, Wilcoxon rank sum test, Wilcoxon-Mann-Whitney test. It is a non parametric test for two independent samples of continuous data. It is very similar to the t-test, but the data does not have to be Normally distributed. There doesn&#8217;t seem to be agreement in the literature regarding the nomenclature of this test. In this book, the name Wilcoxon test (as used in the R programming language).<\/p>\n\n\n\n<p>Continuing with the same example (skinfolds).<\/p>\n\n\n\n<p>It has been demonstrated that it was not appropriate to use the t-test as the data are not Normally distributed. Subsequently, the data were transformed and a Chi Square test was performed. The Chi Square test without continuity correction rejected the null hypothesis. However, not all prerequisites were met and its use probably inappropriate. The Chi Square test with Yates&#8217; continuity correction (should be used if expected frequencies are below 10) and the Fisher Exact test were both insignificant. What about the Wilcoxon test?<\/p>\n\n\n\n<p>The Wilcoxon test is performed on continuous data, but Normality is not a requirement. The test is more powerful than the Sign and Chi Square test, but less versatile. In the previous sections, the Sign and Chi Square test were used after transforming the data. However, it is unnecessary to transform the data to <a href=\"https:\/\/pcool.dyndns.org\/index.php\/data-types\/\" data-type=\"page\" data-id=\"355\">nominal data<\/a> and normally the most powerful test available is used within its operational conditions. The Wilcoxon test is the most appropriate test to use for the skinfold data.<\/p>\n\n\n\n<p><em><strong>In the R console:<\/strong><\/em><\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><span style=\"color: #ff0000;\"><em>wilcox.test(Skinfold~Group,data=skinfold,correct=FALSE)<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>\u00a0\u00a0 \u00a0Wilcoxon rank sum test<\/em><\/span>\n<em><mark style=\"background-color:rgba(0, 0, 0, 0);color:#4607f7\" class=\"has-inline-color\">data:\u00a0 skinfold$Skinfold by skinfold$Group\nW = 46.5, <strong>p-value = 0.04011<\/strong>\nalternative hypothesis: true location shift is not equal to 0\n\nWarning message:\nIn wilcox.test.default(x = c(1.8, 2, 2, 2, 3, 3.8, 3.9, 4, 4.1),\u00a0 :\n\u00a0 cannot compute exact p-value with ties<\/mark><\/em><\/code><\/pre>\n\n\n\n<p class=\"is-style-text-annotation is-style-text-annotation--5\">\u00a0As the data are continuous, the &#8216;correct=FALSE&#8217; option is selected so that no continuity correction is used in the calculation of the p-value.<\/p>\n\n\n\n<p class=\"is-style-text-annotation is-style-text-annotation--6\">R gives a warning message as there are some values that are the same, making ranking and calculation of an exact p value difficult. <\/p>\n\n\n\n<p>The p=value is significant and therefore the null hypothesis is rejected in favour of the alternative hypothesis and it is concluded that there is a difference in the skin thickness of cancer patients and other patients.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If data are not Normally distributed, a non parametric test should be used. There are many non parametric tests described, and it is impossible to name \/ lists them all. The following tests are discussed using the example data in skinfold.rda: It has been shown that the data do not conform a Normal distribution. Therefore, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"footnotes":""},"class_list":["post-594","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/pages\/594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/comments?post=594"}],"version-history":[{"count":3,"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/pages\/594\/revisions"}],"predecessor-version":[{"id":4864,"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/pages\/594\/revisions\/4864"}],"wp:attachment":[{"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/media?parent=594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}