{"id":602,"date":"2015-08-01T13:57:22","date_gmt":"2015-08-01T12:57:22","guid":{"rendered":"http:\/\/pcool.dyndns.org:8080\/statsbook\/?page_id=602"},"modified":"2025-07-01T22:58:48","modified_gmt":"2025-07-01T21:58:48","slug":"statistical-tests","status":"publish","type":"page","link":"https:\/\/pcool.dyndns.org\/index.php\/statistical-tests\/","title":{"rendered":"Statistical Tests"},"content":{"rendered":"\n<p>In this section, <a href=\"https:\/\/pcool.dyndns.org\/index.php\/non-parametric-tests-2\/\" data-type=\"page\" data-id=\"605\">parametric tests<\/a> (based on a Normal distribution) and <a href=\"https:\/\/pcool.dyndns.org\/index.php\/non-parametric-tests\/\" data-type=\"page\" data-id=\"594\">non parametric tests<\/a> are discussed. In addition, there are sections on <a href=\"https:\/\/pcool.dyndns.org\/index.php\/power-analysis\/\" data-type=\"page\" data-id=\"597\">power analysis<\/a>, <a href=\"https:\/\/pcool.dyndns.org\/index.php\/sensitivity-specificity\/\" data-type=\"page\" data-id=\"813\">sensitivity \/ specificity<\/a>, <a href=\"https:\/\/pcool.dyndns.org\/index.php\/errors\/\" data-type=\"page\" data-id=\"816\">errors<\/a>, <a href=\"https:\/\/pcool.dyndns.org\/index.php\/repeatability-and-reproducibility\/\" data-type=\"page\" data-id=\"835\">repeatability \/ reproducibility<\/a>, <a href=\"https:\/\/pcool.dyndns.org\/index.php\/bias-and-accuracy\/\" data-type=\"page\" data-id=\"838\">bias \/ accuracy<\/a> and <a href=\"https:\/\/pcool.dyndns.org\/index.php\/multiple-observers\/\" data-type=\"page\" data-id=\"859\">multiple observer analysis<\/a>.<\/p>\n\n\n\n<p><strong>Null Hypothesis:<\/strong> No difference between study groups<\/p>\n\n\n\n<p><strong>Alternate Hypothesis:<\/strong> There is a difference between the study groups<\/p>\n\n\n\n<p><strong>Outcome Measure:<\/strong> Variable used to test the hypotheses<\/p>\n\n\n\n<p><strong>Test Statistic:<\/strong> Calculation used to determine statistical significance<\/p>\n\n\n\n<p><strong>P Value:<\/strong> Probability the test statistic takes a more extreme value<\/p>\n\n\n\n<p><strong>Statistically Significant:<\/strong> Probability the test statistic has a more extreme value is less than 5%.<\/p>\n\n\n\n<p><strong>Parametric Test:<\/strong> Assumes data follow a Normal distribution<\/p>\n\n\n\n<p><strong>Tests for Normality:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Quantile-Quantile plots<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><span style=\"color: #ff0000;\"><em>qqnorm(data)<\/em><\/span>\n<span style=\"color: #ff0000;\"><em>qqline(data)<\/em><\/span><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Shapiro-Wilk test<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><em><span style=\"color: #ff0000;\">shapiro.test(data)<\/span><\/em><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Kolmogorov-Smirnov test<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><em><span style=\"color: #ff0000;\">ks.test(data,\"pnorm\",mean=mean(data),sd=sd(data))<\/span><\/em><\/code><\/pre>\n\n\n\n<p><strong>t-test:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><span style=\"color: #ff0000;\"><em>t.test(data ~ group)<\/em><\/span>\n<span style=\"color: #ff0000;\"><em>t.test(data1, data2, paired=FALSE)<\/em><\/span><\/code><\/pre>\n\n\n\n<p><strong>Non Parametric Test:<\/strong> Data can&#8217;t be modelled with a Normal distribution<\/p>\n\n\n\n<table id=\"tablepress-13\" class=\"tablepress tablepress-id-13\">\n<thead>\n<tr class=\"row-1\">\n\t<th class=\"column-1\">Data<\/th><th class=\"column-2\">Sample Size<\/th><th class=\"column-3\">Test<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">Continuous<\/td><td class=\"column-2\">> 50<\/td><td class=\"column-3\">Normal<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\"><\/td><td class=\"column-2\">< 50 <br \/>\nNormal <\/td><td class=\"column-3\">t-Test<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\"><\/td><td class=\"column-2\">Not Normal<\/td><td class=\"column-3\">Wilcoxon<\/td>\n<\/tr>\n<tr class=\"row-5\">\n\t<td class=\"column-1\">Ordinal<\/td><td class=\"column-2\"><\/td><td class=\"column-3\">Wilcoxon<\/td>\n<\/tr>\n<tr class=\"row-6\">\n\t<td class=\"column-1\">Nominal<\/td><td class=\"column-2\"><\/td><td class=\"column-3\">Chi Squared<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-13 from cache -->\n\n\n<p><strong>\u03b1:<\/strong> Probability of incorrectly rejecting the null hypothesis (false positive, type 1 error)<\/p>\n\n\n\n<p><strong>\u03b2:<\/strong> Probability of incorrectly accepting the null hypothesis (false negative, type 2 error)<\/p>\n\n\n\n<p><strong>Power:<\/strong> Probability of correctly rejecting the null hypothesis (<strong>Power = 1 \u2013 \u03b2)<\/strong><\/p>\n\n\n\n<p><strong>Chi-square test:<\/strong><\/p>\n\n\n\n<p>The prerequisites 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<pre class=\"wp-block-code has-small-font-size\"><code><em><span style=\"color: #ff0000;\">data&lt;-matrix(c(a,b,c,d),nrow=2)<\/span><\/em>\n<em><span style=\"color: #ff0000;\">chisq.test(data,correct=TRUE)<\/span><\/em>\n<em><span style=\"color: #ff0000;\">chisq.test(data,correct=TRUE)$expected<\/span> <\/em>(for expected frequencies)<\/code><\/pre>\n\n\n\n<p>It is recommended to use Yates&#8217; continuity correction (correct=TRUE), if the expected cell count is less than 10 . When the expected cell count is less than 5, the Chi Square test should not be used and the Fisher exact test is recommended.<\/p>\n\n\n\n<p><strong>Wilxocon test:<\/strong> Non parametric singed rank test for continuous data<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><span style=\"color: #ff0000;\"><em>wilcox.test(data)<\/em><\/span><\/code><\/pre>\n\n\n\n<p><strong>Power analysis<\/strong><\/p>\n\n\n\n<p>Required information:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Difference desired to detect (delta)<\/li>\n\n\n\n<li>Spread of data (sd)<\/li>\n\n\n\n<li>Significance level (\u03b1)<\/li>\n\n\n\n<li>Test statistic (power)<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><em><span style=\"color: #ff0000;\">power.t.test(sd=s, delta=d, sig.level=0.05, power=0.8)<\/span><\/em><\/code><\/pre>\n\n\n\n<p><strong>Errors:<\/strong><\/p>\n\n\n\n<p><strong>Type 1:<\/strong> Null hypothesis is incorrectly rejected (false positive; significance level (\u03b1)<\/p>\n\n\n\n<p><strong>Type 2: <\/strong>Null hypothesis is incorrectly accepted (false negative; statistical power)<\/p>\n\n\n\n<p><strong>Errors are related to:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Difference desired to detect<\/li>\n\n\n\n<li>Spread of data<\/li>\n\n\n\n<li>Significance level (\u03b1)<\/li>\n\n\n\n<li>Test statistic (power)<\/li>\n<\/ul>\n\n\n\n<table id=\"tablepress-1\" class=\"tablepress tablepress-id-1\">\n<thead>\n<tr class=\"row-1\">\n\t<td class=\"column-1\"><\/td><th class=\"column-2\">Disease<\/th><th class=\"column-3\">No Disease<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">Exposure<\/td><td class=\"column-2\">a<\/td><td class=\"column-3\">b<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">No Exposure<\/td><td class=\"column-2\">c<\/td><td class=\"column-3\">d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-1 from cache -->\n\n\n<p>True Positive: a<\/p>\n\n\n\n<p>False Positive: b<\/p>\n\n\n\n<p>False Negative: c<\/p>\n\n\n\n<p>True Negative: d<\/p>\n\n\n\n<p><strong>Positive Predictive Value<\/strong> <strong>(or precision)<\/strong> is the probability that a person who is test positive has the condition:<\/p>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(ppv = \\frac{a}{a+b} \\)<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<p><strong>Negative Predictive Value<\/strong> is the probability that a person who is test negative does not have the condition:<\/p>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(npv = \\frac{d}{c+d} \\)<\/div>\n\n\n\n<p><strong>Sensitivity (or recall<\/strong> <strong>or true positive rate)<\/strong>, is the probability that a person who has the condition tests positive:<\/p>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(sensitivity = \\frac{a}{a+c} \\)<\/div>\n\n\n\n<p><strong>Specificity<\/strong>, or true negative rate is the probability that a person who does not have the condition tests negative: <\/p>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(specificity = \\frac{d}{b+d} \\)<\/div>\n\n\n\n<p><strong>Accuracy<\/strong> is the probability a test result is correct: <\/p>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(accuracy = \\frac{a+d}{a+b+c+d} \\)<\/div>\n\n\n\n<p>In the R console using the epiR<sup class='sup-ref-note' id='note-zotero-ref-p602-r1-o1'><a class='sup-ref-note' href='#zotero-ref-p602-r1'>1<\/a><\/sup> <a href=\"https:\/\/pcool.dyndns.org\/index.php\/packages\/\" data-type=\"page\" data-id=\"22\">package<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><span style=\"color: #ff0000;\"><em>library(epiR)<\/em><\/span>\n<span style=\"color: #0000ff;\"><em><span style=\"color: #ff0000;\">mat &lt;- matrix(c(a,c,b,d), ncol=2)<\/span> <\/em><span style=\"color: #000000;\">{enter values}<\/span><\/span>\n<span style=\"color: #ff0000;\"><em>epi.tests(mat)<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Disease +&nbsp;&nbsp;&nbsp; Disease -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Total<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Test +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Test -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; c &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; d &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Total&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Point estimates and 95 % CIs:<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>---------------------------------------------------------<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Apparent prevalence&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>True prevalence&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Sensitivity&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Specificity&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Positive predictive value&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Negative predictive value&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Positive likelihood ratio&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Negative likelihood ratio&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>---------------------------------------------------------<\/em><\/span><\/code><\/pre>\n\n\n\n<p><strong>Bias<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Selection bias<\/strong>; reduced by <strong>randomisation<\/strong><\/li>\n\n\n\n<li><strong>Confounding bias<\/strong>; reduced by <strong>stratification<\/strong><\/li>\n\n\n\n<li><strong>Observational bias<\/strong>; reduced by <strong>blinding<\/strong><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In this section, parametric tests (based on a Normal distribution) and non parametric tests are discussed. In addition, there are sections on power analysis, sensitivity \/ specificity, errors, repeatability \/ reproducibility, bias \/ accuracy and multiple observer analysis. Null Hypothesis: No difference between study groups Alternate Hypothesis: There is a difference between the study groups [&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-602","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/pages\/602","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=602"}],"version-history":[{"count":6,"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/pages\/602\/revisions"}],"predecessor-version":[{"id":4763,"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/pages\/602\/revisions\/4763"}],"wp:attachment":[{"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/media?parent=602"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}