{"id":2708,"date":"2024-07-24T12:11:36","date_gmt":"2024-07-24T16:11:36","guid":{"rendered":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/?post_type=chapter&#038;p=2708"},"modified":"2024-07-24T14:24:54","modified_gmt":"2024-07-24T18:24:54","slug":"steps-for-testing-for-differences-in-proportions","status":"publish","type":"chapter","link":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/chapter\/steps-for-testing-for-differences-in-proportions\/","title":{"raw":"Steps for Differences in Proportions Testing","rendered":"Steps for Differences in Proportions Testing"},"content":{"raw":"<div class=\"textbox textbox--learning-objectives\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">Learning Objectives<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">\r\n\r\nIn this section, we will:\r\n<ul>\r\n \t<li>Introduce the steps to test for differences in population proportions.<\/li>\r\n \t<li>Outline the different formulae required for left, right or two-tailed tests.<\/li>\r\n<\/ul>\r\n<\/div>\r\n<\/div>\r\nThe same six steps from <a href=\"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/chapter\/steps-to-perform-a-hypothesis-testing\/\">One Sample Hypothesis Testing<\/a> still apply:\r\n<ol>\r\n \t<li>Check that the required assumptions are satisfied.<\/li>\r\n \t<li>State the Null and Alternate Hypotheses.<\/li>\r\n \t<li>Calculate the Value of the Test Statistic:<\/li>\r\n \t<li>Compute the [latex]p[\/latex]-value.<\/li>\r\n \t<li>Make a Decision (to accept or reject H<sub>0<\/sub>).<\/li>\r\n \t<li>Draw a Conclusion (there is or is not enough evidence to conclude that one population proportion is larger\/smaller\/different than the other population proportion).<\/li>\r\n<\/ol>\r\n<h1>1. Required Assumptions<\/h1>\r\n<ol>\r\n \t<li><strong>Sample size:<\/strong> Is the sample size large enough to ensure that the sampling distribution is roughly normal? For proportions, 'large enough' means that [latex]np &gt; 5[\/latex] and [latex]n(1-p) &gt; 5[\/latex].<\/li>\r\n \t<li><strong>Randomness<\/strong>: Are the data selected at random such that each data point is independent of the one-another. Is the sample random, representative and non-bias?<\/li>\r\n<\/ol>\r\n<h1>2. The Null and Alternate Hypotheses<\/h1>\r\n<ol>\r\n \t<li><strong>The Null Hypothesis (H<sub>0<\/sub>)<\/strong>: There is no difference between the two population proportions.\r\nIe: [latex]p_1 = p_2[\/latex] or [latex]p_1 - p_2 = 0[\/latex].<\/li>\r\n \t<li><strong>The Alternate Hypothesis (H<sub>A<\/sub>)<\/strong>: Either one population proportion is smaller\/larger than the other (left\/right-tailed) or not equal to the other:\r\n<ul>\r\n \t<li>Left-tailed: [latex]p_1 &lt; p_2[\/latex] or [latex]p_1 - p_2 &lt; 0[\/latex]<\/li>\r\n \t<li>Right-tailed: [latex]p_1 &gt; p_2[\/latex] or [latex]p_1 - p_2 &gt; 0[\/latex]<\/li>\r\n \t<li>Two-tailed: [latex]p_1 \\neq p_2[\/latex] or [latex]p_1 - p_2 \\neq 0[\/latex]<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ol>\r\n<strong>Note<\/strong>: Which sample is defined as the first and second samples affects which 'tail' (right or left) is being used. If we flip the order of the samples, we will 'flip' the tail (left to right or right to left).\r\n<h1>3. THE Test Statistic FormulaE<\/h1>\r\nBefore calculating the test statistic, we need to perform a 'best guess' of the population proportion:\r\n<ul>\r\n \t<li>We assume there is no difference between the two proportions when defining H<sub>0<\/sub><\/li>\r\n \t<li>We do not know our 'true'\/population proportion<\/li>\r\n \t<li>We combine or 'pool' the two sample proportions as our 'best guess' for the true proportion<\/li>\r\n<\/ul>\r\n<h2>The Pooled and Sample Proportions<\/h2>\r\nLet us say that we have x<sub>1<\/sub> successes from the first sample of size n<sub>1<\/sub>, and, x<sub>2<\/sub> successes from the second sample of size n<sub>2.<\/sub> We can calculate the sample proportions: [latex]p_1 = \\frac{x_1}{n_1}[\/latex], [latex]p_2 = \\frac{x_2}{n_2}[\/latex]. We also use these to calculate the 'pooled' proportion, [latex]\\bar{p}[\/latex]:\r\n\r\n\\[\\bar{p} = \\frac{x_1+x_2}{n_1+n_2} \\]\r\n<h2>The Test Statistic (Z<sub>test<\/sub>)<\/h2>\r\nWe can now calculate the test statistic ([latex]z_{test}[\/latex]):\r\n\r\n\\[z_{test} = \\frac{(\\bar{p_1}-\\bar{p_2})-(p_1-p_2)}{\\sqrt{\\bar{p}(1-\\bar{p})\\left(\\frac{1}{n_1}+\\frac{1}{n_2}\\right)}} \\]\r\n\r\nThis formula can be simplified by reflecting on what we assumed in our null hypothesis, H<sub>0<\/sub> (that [latex]p_1-p_2 = 0[\/latex]). We replace the second term in the numerator with zero:\r\n\r\n\\[z_{test} = \\frac{(\\bar{p_1}-\\bar{p_2})-(0)}{\\sqrt{\\bar{p}(1-\\bar{p})\\left(\\frac{1}{n_1}+\\frac{1}{n_2}\\right)}} = \\frac{\\bar{p_1}-\\bar{p_2}}{\\sqrt{\\bar{p}(1-\\bar{p})\\left(\\frac{1}{n_1}+\\frac{1}{n_2}\\right)}}\\]\r\n<h1>4. The P-Value FormulaE<\/h1>\r\nWhen testing for the differences in two proportions, the p-value equals to the probability of obtaining the sample proportion results ([latex]p_1[\/latex] and [latex]p_2[\/latex]) given that there is no difference in the true proportions from these two groups.\r\n\r\nWe again, use Excel's <a href=\"https:\/\/support.microsoft.com\/en-us\/office\/norm-s-dist-function-1e787282-3832-4520-a9ae-bd2a8d99ba88\">NORM.S.DIST()<\/a> function to calculate its value:\r\n<ol>\r\n \t<li><strong>Left-tailed test<\/strong>: [latex]p\\text{-value}=\\text{NORM.S.DIST}(z_{test},\\text{TRUE})[\/latex]<\/li>\r\n \t<li><strong>Two-tailed test and negative z<\/strong>[latex]_{test}[\/latex] <strong>score<\/strong>: [latex]p\\text{-value}=2\\times\\text{NORM.S.DIST}(z_{test},\\text{TRUE}) [\/latex]<\/li>\r\n \t<li><strong>Two-tailed test and positive z<\/strong>[latex]_{test}[\/latex] <strong>score<\/strong>: [latex]p\\text{-value}=2\\times(1-\\text{NORM.S.DIST}(z_{test},\\text{TRUE}))[\/latex]<\/li>\r\n \t<li><strong>Right-tailed test<\/strong>: [latex]p\\text{-value}=1-\\text{NORM.S.DIST}(z_{test},\\text{TRUE})[\/latex]<\/li>\r\n<\/ol>\r\n<strong>Remember:<\/strong> For two-tailed tests, we double the area outside of the z[latex]_{test}[\/latex] score to account for the fact that we are interested in either tail (the left or right tail). We double the area beyond the test statistic to account for this.\r\n<h1>5. Decision Criteria<\/h1>\r\nWe either accept or reject the null hypothesis depending on whether the [latex]p[\/latex]-value is less than the level of significance (\u03b1). We can make a diagram to visualize our decision also. If our pooled proportion (p\u0304) lands in the rejection region on our diagram, we reject H<sub>0<\/sub>.\r\n\r\n[caption id=\"attachment_2550\" align=\"aligncenter\" width=\"1361\"]<a href=\"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-content\/uploads\/sites\/2128\/2024\/07\/AllHypothesisTest_Areas_prop_Z-scores.jpg\"><img class=\"wp-image-2550 size-full\" src=\"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-content\/uploads\/sites\/2128\/2024\/07\/AllHypothesisTest_Areas_prop_Z-scores.jpg\" alt=\"All possible hypothesis test areas shown. One Tailed left and right tailed as well as two tailed test shown in image.\" width=\"1361\" height=\"200\" \/><\/a> Figure 60.1 The rejection regions and critical values value for one and two-tailed proportion hypothesis tests.[\/caption]\r\n<ul>\r\n \t<li><strong>Reject H<sub>0<\/sub><\/strong> if the test statistic lands in the rejection region or if the [latex]p[\/latex]-value is less than (&lt;) the level of significance (\u03b1).<\/li>\r\n \t<li><strong>Do not reject H<sub>0<\/sub><\/strong> if the test statistic does not land in the rejection region or if the [latex]p[\/latex]-value is more than (&gt;) the level of significance (\u03b1).<\/li>\r\n<\/ul>\r\n<h1>6. Conclusions<\/h1>\r\nWe restate the question asked in the hypothesis test question. The following is true:\r\n<ul>\r\n \t<li><strong>If we reject H<sub>0<\/sub>: <\/strong>Then there <em><strong>is<\/strong><\/em> sufficient evidence to conclude what is stated in the original question (that H<sub>A<\/sub> is true).<\/li>\r\n \t<li><strong>If we do not reject H<sub>0<\/sub>: <\/strong>There is not sufficient evidence to conclude what was stated in the original question (ie: there is not enough to conclude that H<sub>A<\/sub> is true).<\/li>\r\n<\/ul>","rendered":"<div class=\"textbox textbox--learning-objectives\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">Learning Objectives<\/p>\n<\/header>\n<div class=\"textbox__content\">\n<p>In this section, we will:<\/p>\n<ul>\n<li>Introduce the steps to test for differences in population proportions.<\/li>\n<li>Outline the different formulae required for left, right or two-tailed tests.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<p>The same six steps from <a href=\"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/chapter\/steps-to-perform-a-hypothesis-testing\/\">One Sample Hypothesis Testing<\/a> still apply:<\/p>\n<ol>\n<li>Check that the required assumptions are satisfied.<\/li>\n<li>State the Null and Alternate Hypotheses.<\/li>\n<li>Calculate the Value of the Test Statistic:<\/li>\n<li>Compute the [latex]p[\/latex]-value.<\/li>\n<li>Make a Decision (to accept or reject H<sub>0<\/sub>).<\/li>\n<li>Draw a Conclusion (there is or is not enough evidence to conclude that one population proportion is larger\/smaller\/different than the other population proportion).<\/li>\n<\/ol>\n<h1>1. Required Assumptions<\/h1>\n<ol>\n<li><strong>Sample size:<\/strong> Is the sample size large enough to ensure that the sampling distribution is roughly normal? For proportions, &#8216;large enough&#8217; means that [latex]np > 5[\/latex] and [latex]n(1-p) > 5[\/latex].<\/li>\n<li><strong>Randomness<\/strong>: Are the data selected at random such that each data point is independent of the one-another. Is the sample random, representative and non-bias?<\/li>\n<\/ol>\n<h1>2. The Null and Alternate Hypotheses<\/h1>\n<ol>\n<li><strong>The Null Hypothesis (H<sub>0<\/sub>)<\/strong>: There is no difference between the two population proportions.<br \/>\nIe: [latex]p_1 = p_2[\/latex] or [latex]p_1 - p_2 = 0[\/latex].<\/li>\n<li><strong>The Alternate Hypothesis (H<sub>A<\/sub>)<\/strong>: Either one population proportion is smaller\/larger than the other (left\/right-tailed) or not equal to the other:\n<ul>\n<li>Left-tailed: [latex]p_1 < p_2[\/latex] or [latex]p_1 - p_2 < 0[\/latex]<\/li>\n<li>Right-tailed: [latex]p_1 > p_2[\/latex] or [latex]p_1 - p_2 > 0[\/latex]<\/li>\n<li>Two-tailed: [latex]p_1 \\neq p_2[\/latex] or [latex]p_1 - p_2 \\neq 0[\/latex]<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><strong>Note<\/strong>: Which sample is defined as the first and second samples affects which &#8216;tail&#8217; (right or left) is being used. If we flip the order of the samples, we will &#8216;flip&#8217; the tail (left to right or right to left).<\/p>\n<h1>3. THE Test Statistic FormulaE<\/h1>\n<p>Before calculating the test statistic, we need to perform a &#8216;best guess&#8217; of the population proportion:<\/p>\n<ul>\n<li>We assume there is no difference between the two proportions when defining H<sub>0<\/sub><\/li>\n<li>We do not know our &#8216;true&#8217;\/population proportion<\/li>\n<li>We combine or &#8216;pool&#8217; the two sample proportions as our &#8216;best guess&#8217; for the true proportion<\/li>\n<\/ul>\n<h2>The Pooled and Sample Proportions<\/h2>\n<p>Let us say that we have x<sub>1<\/sub> successes from the first sample of size n<sub>1<\/sub>, and, x<sub>2<\/sub> successes from the second sample of size n<sub>2.<\/sub> We can calculate the sample proportions: [latex]p_1 = \\frac{x_1}{n_1}[\/latex], [latex]p_2 = \\frac{x_2}{n_2}[\/latex]. We also use these to calculate the &#8216;pooled&#8217; proportion, [latex]\\bar{p}[\/latex]:<\/p>\n<p>\\[\\bar{p} = \\frac{x_1+x_2}{n_1+n_2} \\]<\/p>\n<h2>The Test Statistic (Z<sub>test<\/sub>)<\/h2>\n<p>We can now calculate the test statistic ([latex]z_{test}[\/latex]):<\/p>\n<p>\\[z_{test} = \\frac{(\\bar{p_1}-\\bar{p_2})-(p_1-p_2)}{\\sqrt{\\bar{p}(1-\\bar{p})\\left(\\frac{1}{n_1}+\\frac{1}{n_2}\\right)}} \\]<\/p>\n<p>This formula can be simplified by reflecting on what we assumed in our null hypothesis, H<sub>0<\/sub> (that [latex]p_1-p_2 = 0[\/latex]). We replace the second term in the numerator with zero:<\/p>\n<p>\\[z_{test} = \\frac{(\\bar{p_1}-\\bar{p_2})-(0)}{\\sqrt{\\bar{p}(1-\\bar{p})\\left(\\frac{1}{n_1}+\\frac{1}{n_2}\\right)}} = \\frac{\\bar{p_1}-\\bar{p_2}}{\\sqrt{\\bar{p}(1-\\bar{p})\\left(\\frac{1}{n_1}+\\frac{1}{n_2}\\right)}}\\]<\/p>\n<h1>4. The P-Value FormulaE<\/h1>\n<p>When testing for the differences in two proportions, the p-value equals to the probability of obtaining the sample proportion results ([latex]p_1[\/latex] and [latex]p_2[\/latex]) given that there is no difference in the true proportions from these two groups.<\/p>\n<p>We again, use Excel&#8217;s <a href=\"https:\/\/support.microsoft.com\/en-us\/office\/norm-s-dist-function-1e787282-3832-4520-a9ae-bd2a8d99ba88\">NORM.S.DIST()<\/a> function to calculate its value:<\/p>\n<ol>\n<li><strong>Left-tailed test<\/strong>: [latex]p\\text{-value}=\\text{NORM.S.DIST}(z_{test},\\text{TRUE})[\/latex]<\/li>\n<li><strong>Two-tailed test and negative z<\/strong>[latex]_{test}[\/latex] <strong>score<\/strong>: [latex]p\\text{-value}=2\\times\\text{NORM.S.DIST}(z_{test},\\text{TRUE})[\/latex]<\/li>\n<li><strong>Two-tailed test and positive z<\/strong>[latex]_{test}[\/latex] <strong>score<\/strong>: [latex]p\\text{-value}=2\\times(1-\\text{NORM.S.DIST}(z_{test},\\text{TRUE}))[\/latex]<\/li>\n<li><strong>Right-tailed test<\/strong>: [latex]p\\text{-value}=1-\\text{NORM.S.DIST}(z_{test},\\text{TRUE})[\/latex]<\/li>\n<\/ol>\n<p><strong>Remember:<\/strong> For two-tailed tests, we double the area outside of the z[latex]_{test}[\/latex] score to account for the fact that we are interested in either tail (the left or right tail). We double the area beyond the test statistic to account for this.<\/p>\n<h1>5. Decision Criteria<\/h1>\n<p>We either accept or reject the null hypothesis depending on whether the [latex]p[\/latex]-value is less than the level of significance (\u03b1). We can make a diagram to visualize our decision also. If our pooled proportion (p\u0304) lands in the rejection region on our diagram, we reject H<sub>0<\/sub>.<\/p>\n<figure id=\"attachment_2550\" aria-describedby=\"caption-attachment-2550\" style=\"width: 1361px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-content\/uploads\/sites\/2128\/2024\/07\/AllHypothesisTest_Areas_prop_Z-scores.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2550 size-full\" src=\"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-content\/uploads\/sites\/2128\/2024\/07\/AllHypothesisTest_Areas_prop_Z-scores.jpg\" alt=\"All possible hypothesis test areas shown. One Tailed left and right tailed as well as two tailed test shown in image.\" width=\"1361\" height=\"200\" srcset=\"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-content\/uploads\/sites\/2128\/2024\/07\/AllHypothesisTest_Areas_prop_Z-scores.jpg 1361w, https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-content\/uploads\/sites\/2128\/2024\/07\/AllHypothesisTest_Areas_prop_Z-scores-300x44.jpg 300w, https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-content\/uploads\/sites\/2128\/2024\/07\/AllHypothesisTest_Areas_prop_Z-scores-1024x150.jpg 1024w, https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-content\/uploads\/sites\/2128\/2024\/07\/AllHypothesisTest_Areas_prop_Z-scores-768x113.jpg 768w, https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-content\/uploads\/sites\/2128\/2024\/07\/AllHypothesisTest_Areas_prop_Z-scores-65x10.jpg 65w, https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-content\/uploads\/sites\/2128\/2024\/07\/AllHypothesisTest_Areas_prop_Z-scores-225x33.jpg 225w, https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-content\/uploads\/sites\/2128\/2024\/07\/AllHypothesisTest_Areas_prop_Z-scores-350x51.jpg 350w\" sizes=\"auto, (max-width: 1361px) 100vw, 1361px\" \/><\/a><figcaption id=\"caption-attachment-2550\" class=\"wp-caption-text\">Figure 60.1 The rejection regions and critical values value for one and two-tailed proportion hypothesis tests.<\/figcaption><\/figure>\n<ul>\n<li><strong>Reject H<sub>0<\/sub><\/strong> if the test statistic lands in the rejection region or if the [latex]p[\/latex]-value is less than (&lt;) the level of significance (\u03b1).<\/li>\n<li><strong>Do not reject H<sub>0<\/sub><\/strong> if the test statistic does not land in the rejection region or if the [latex]p[\/latex]-value is more than (&gt;) the level of significance (\u03b1).<\/li>\n<\/ul>\n<h1>6. Conclusions<\/h1>\n<p>We restate the question asked in the hypothesis test question. The following is true:<\/p>\n<ul>\n<li><strong>If we reject H<sub>0<\/sub>: <\/strong>Then there <em><strong>is<\/strong><\/em> sufficient evidence to conclude what is stated in the original question (that H<sub>A<\/sub> is true).<\/li>\n<li><strong>If we do not reject H<sub>0<\/sub>: <\/strong>There is not sufficient evidence to conclude what was stated in the original question (ie: there is not enough to conclude that H<sub>A<\/sub> is true).<\/li>\n<\/ul>\n","protected":false},"author":865,"menu_order":1,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-2708","chapter","type-chapter","status-publish","hentry"],"part":2684,"_links":{"self":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapters\/2708","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/wp\/v2\/users\/865"}],"version-history":[{"count":25,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapters\/2708\/revisions"}],"predecessor-version":[{"id":2758,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapters\/2708\/revisions\/2758"}],"part":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/parts\/2684"}],"metadata":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapters\/2708\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/wp\/v2\/media?parent=2708"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapter-type?post=2708"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/wp\/v2\/contributor?post=2708"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/wp\/v2\/license?post=2708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}