{"id":1099,"date":"2021-06-12T19:12:05","date_gmt":"2021-06-12T23:12:05","guid":{"rendered":"https:\/\/openbooks.macewan.ca\/rcommander\/?post_type=chapter&#038;p=1099"},"modified":"2025-10-17T17:59:25","modified_gmt":"2025-10-17T21:59:25","slug":"10-4-margin-of-error-and-sample-size-calculation-for-proportion","status":"publish","type":"chapter","link":"https:\/\/openbooks.macewan.ca\/introstats\/chapter\/10-4-margin-of-error-and-sample-size-calculation-for-proportion\/","title":{"raw":"10.4 Margin of Error and Sample Size Calculation for Proportion","rendered":"10.4 Margin of Error and Sample Size Calculation for Proportion"},"content":{"raw":"A [latex](1 \u2013 \\alpha) \\times 100\\%[\/latex] confidence interval for the population proportion [latex]p[\/latex] is [latex]\\hat{p} \\pm z_{\\alpha \/ 2} \\sqrt{\\frac{\\hat{p} (1 - \\hat{p})}{n}}[\/latex]. The margin of error is [latex]E = z_{\\alpha \/2 } \\sqrt{\\frac{\\hat{p} (1 - \\hat{p})}{n}}[\/latex], which is half of the length of the interval; solving for [latex]n[\/latex] yields [latex]n = \\hat{p} (1 - \\hat{p}) \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2[\/latex]. Consequently, we are [latex] (1 \u2013 \\alpha) \\times 100\\%[\/latex] confident that the margin of error is at most [latex]E[\/latex] if the sample size [latex]n \\geq \\hat{p} (1 - \\hat{p}) \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2[\/latex]. However, this formula cannot be used because the sample proportion [latex]\\hat{p} = \\frac{x}{n}[\/latex] is unknown until the sample is obtained. One solution to this problem is to use the maximum value of [latex]\\hat{p} (1 - \\hat{p})[\/latex], which is 0.25 when [latex]\\hat{p} = 0.5[\/latex]. This leads to the conservative bound on the sample size.\r\n<p align=\"center\">[latex]n = 0.5(1 - 0.5) \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2 = 0.25 \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2 [\/latex]<\/p>\r\nrounded up to the nearest integer. However, if we have some extra information about the value of [latex]\\hat{p}[\/latex], we can use that information to obtain the guess [latex]\\hat{p} = p_g[\/latex]. This alternative approach leads to the sample size\r\n<p align=\"center\">[latex]n = p_g (1 - p_g) \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2[\/latex]<\/p>\r\nrounded up to the nearest integer.<a id=\"retfig10.2\"><\/a>\r\n\r\n[caption id=\"attachment_2898\" align=\"aligncenter\" width=\"500\"]<img class=\"wp-image-2898\" src=\"https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/06\/proportion_samplesize_crop-300x170.png\" alt=\"A graph of p-hat versus p-hat times 1 - p-hat. Image description available.\" width=\"500\" height=\"283\" \/> <strong>Figure 10.2<\/strong>: Graph of <strong>p\u0302(1\u2212p\u0302)<\/strong> versus <strong>p\u0302<\/strong>. [<a href=\"https:\/\/devlibbooks.macewan.ca\/introstatsclone\/back-matter\/image-description\/#fig10.2\">Image Description (See Appendix D Figure 10.2)<\/a>][\/caption]\r\n<p style=\"text-align: center;\"><strong>Table 10.2<\/strong>: Relationship Between [latex]\\hat p[\/latex] and [latex]\\hat p (1-\\hat p)[\/latex].<\/p>\r\n\r\n<table class=\"aligncenter\" style=\"border-collapse: collapse; width: 50%; height: 86px;\" border=\"0\" cellpadding=\"10\">\r\n<thead>\r\n<tr class=\"shaded\" style=\"height: 14px;\">\r\n<td style=\"width: 27.9335%; height: 15px;\">[latex]\\hat{p}[\/latex]<\/td>\r\n<td style=\"width: 19.4283%; height: 15px;\">[latex]\\hat{p} (1 - \\hat{p})[\/latex]<\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr style=\"height: 14px;\">\r\n<td style=\"width: 27.9335%; height: 14px;\">[latex]0[\/latex]<\/td>\r\n<td style=\"width: 19.4283%; height: 14px;\">[latex]0 \\times (1 - 0) = 0[\/latex]<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px;\">\r\n<td style=\"width: 27.9335%; height: 14px;\">[latex]0.2[\/latex]<\/td>\r\n<td style=\"width: 19.4283%; height: 14px;\">[latex]0.2 \\times (1 - 0.2) = 0.16[\/latex]<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px;\">\r\n<td style=\"width: 27.9335%; height: 15px;\">[latex]0.5[\/latex]<\/td>\r\n<td style=\"width: 19.4283%; height: 15px;\">[latex]0.5 \\times (1 - 0.5) = 0.25[\/latex]<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px;\">\r\n<td style=\"width: 27.9335%; height: 14px;\">[latex]0.8[\/latex]<\/td>\r\n<td style=\"width: 19.4283%; height: 14px;\">[latex]0.8 \\times (1-0.8) = 0.16[\/latex]<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px;\">\r\n<td style=\"width: 27.9335%; height: 14px;\">[latex]1[\/latex]<\/td>\r\n<td style=\"width: 19.4283%; height: 14px;\">[latex]1 \\times (1 - 1) = 0[\/latex]<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<div class=\"textbox textbox--examples\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">Example: Sample Size Calculation for Proportion<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">\r\n<ol>\r\n \t<li>Determine the sample size <em>n<\/em> such that we are 95% confident that the error is at most 0.05 when [latex]\\hat{p}[\/latex] is used to estimate [latex]p[\/latex]. Use the conservative estimate [latex]\\hat{p}=0.5[\/latex].\r\nSince we do not have any extra information about [latex]\\hat{p}[\/latex], we will use [latex]n = 0.25 \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2[\/latex]. [latex]1 - \\alpha = 0.95 \\Longrightarrow \\alpha = 0.05 \\Longrightarrow z_{\\alpha \/ 2} = z_{0.025} = 1.96[\/latex], and [latex]E = 0.05[\/latex].<\/li>\r\n<\/ol>\r\n<p align=\"center\">[latex] n = 0.25 \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2 = 0.25 \\times \\left( \\frac{1.96}{0.05} \\right)^2 = 384.16[\/latex] rounded up to [latex]n = 385.[\/latex]<\/p>\r\n\r\n<ol start=\"2\">\r\n \t<li>Suppose [latex]p[\/latex] is known to be in between 0.6 and 0.8. Equipped with this new information, obtain a sample size to ensure the margin of error is at most 0.05 with 95% confidence.\r\nWe should take this information into account and use [latex]p_g = 0.6[\/latex], the value closest to 0.5 within the range [0.6, 0.8]. Therefore, the required sample size is\r\n<p align=\"center\">[latex]n = p_g (1 - p_g) \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2 = 0.6 (1 - 0.6) \\times \\left( \\frac{1.96}{0.05} \\right)^2 = 368.79[\/latex],<\/p>\r\nrounded up to [latex]n = 369[\/latex].<\/li>\r\n<\/ol>\r\n<\/div>\r\n<\/div>","rendered":"<p>A [latex](1 \u2013 \\alpha) \\times 100\\%[\/latex] confidence interval for the population proportion [latex]p[\/latex] is [latex]\\hat{p} \\pm z_{\\alpha \/ 2} \\sqrt{\\frac{\\hat{p} (1 - \\hat{p})}{n}}[\/latex]. The margin of error is [latex]E = z_{\\alpha \/2 } \\sqrt{\\frac{\\hat{p} (1 - \\hat{p})}{n}}[\/latex], which is half of the length of the interval; solving for [latex]n[\/latex] yields [latex]n = \\hat{p} (1 - \\hat{p}) \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2[\/latex]. Consequently, we are [latex](1 \u2013 \\alpha) \\times 100\\%[\/latex] confident that the margin of error is at most [latex]E[\/latex] if the sample size [latex]n \\geq \\hat{p} (1 - \\hat{p}) \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2[\/latex]. However, this formula cannot be used because the sample proportion [latex]\\hat{p} = \\frac{x}{n}[\/latex] is unknown until the sample is obtained. One solution to this problem is to use the maximum value of [latex]\\hat{p} (1 - \\hat{p})[\/latex], which is 0.25 when [latex]\\hat{p} = 0.5[\/latex]. This leads to the conservative bound on the sample size.<\/p>\n<p style=\"text-align: center;\">[latex]n = 0.5(1 - 0.5) \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2 = 0.25 \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2[\/latex]<\/p>\n<p>rounded up to the nearest integer. However, if we have some extra information about the value of [latex]\\hat{p}[\/latex], we can use that information to obtain the guess [latex]\\hat{p} = p_g[\/latex]. This alternative approach leads to the sample size<\/p>\n<p style=\"text-align: center;\">[latex]n = p_g (1 - p_g) \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2[\/latex]<\/p>\n<p>rounded up to the nearest integer.<a id=\"retfig10.2\"><\/a><\/p>\n<figure id=\"attachment_2898\" aria-describedby=\"caption-attachment-2898\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2898\" src=\"https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/06\/proportion_samplesize_crop-300x170.png\" alt=\"A graph of p-hat versus p-hat times 1 - p-hat. Image description available.\" width=\"500\" height=\"283\" srcset=\"https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/06\/proportion_samplesize_crop-300x170.png 300w, https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/06\/proportion_samplesize_crop-768x434.png 768w, https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/06\/proportion_samplesize_crop-65x37.png 65w, https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/06\/proportion_samplesize_crop-225x127.png 225w, https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/06\/proportion_samplesize_crop-350x198.png 350w, https:\/\/openbooks.macewan.ca\/introstats\/wp-content\/uploads\/sites\/8\/2021\/06\/proportion_samplesize_crop.png 872w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><figcaption id=\"caption-attachment-2898\" class=\"wp-caption-text\"><strong>Figure 10.2<\/strong>: Graph of <strong>p\u0302(1\u2212p\u0302)<\/strong> versus <strong>p\u0302<\/strong>. [<a href=\"https:\/\/devlibbooks.macewan.ca\/introstatsclone\/back-matter\/image-description\/#fig10.2\">Image Description (See Appendix D Figure 10.2)<\/a>]<\/figcaption><\/figure>\n<p style=\"text-align: center;\"><strong>Table 10.2<\/strong>: Relationship Between [latex]\\hat p[\/latex] and [latex]\\hat p (1-\\hat p)[\/latex].<\/p>\n<table class=\"aligncenter\" style=\"border-collapse: collapse; width: 50%; height: 86px;\" cellpadding=\"10\">\n<thead>\n<tr class=\"shaded\" style=\"height: 14px;\">\n<td style=\"width: 27.9335%; height: 15px;\">[latex]\\hat{p}[\/latex]<\/td>\n<td style=\"width: 19.4283%; height: 15px;\">[latex]\\hat{p} (1 - \\hat{p})[\/latex]<\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"height: 14px;\">\n<td style=\"width: 27.9335%; height: 14px;\">[latex]0[\/latex]<\/td>\n<td style=\"width: 19.4283%; height: 14px;\">[latex]0 \\times (1 - 0) = 0[\/latex]<\/td>\n<\/tr>\n<tr style=\"height: 14px;\">\n<td style=\"width: 27.9335%; height: 14px;\">[latex]0.2[\/latex]<\/td>\n<td style=\"width: 19.4283%; height: 14px;\">[latex]0.2 \\times (1 - 0.2) = 0.16[\/latex]<\/td>\n<\/tr>\n<tr style=\"height: 14px;\">\n<td style=\"width: 27.9335%; height: 15px;\">[latex]0.5[\/latex]<\/td>\n<td style=\"width: 19.4283%; height: 15px;\">[latex]0.5 \\times (1 - 0.5) = 0.25[\/latex]<\/td>\n<\/tr>\n<tr style=\"height: 14px;\">\n<td style=\"width: 27.9335%; height: 14px;\">[latex]0.8[\/latex]<\/td>\n<td style=\"width: 19.4283%; height: 14px;\">[latex]0.8 \\times (1-0.8) = 0.16[\/latex]<\/td>\n<\/tr>\n<tr style=\"height: 14px;\">\n<td style=\"width: 27.9335%; height: 14px;\">[latex]1[\/latex]<\/td>\n<td style=\"width: 19.4283%; height: 14px;\">[latex]1 \\times (1 - 1) = 0[\/latex]<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"textbox textbox--examples\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">Example: Sample Size Calculation for Proportion<\/p>\n<\/header>\n<div class=\"textbox__content\">\n<ol>\n<li>Determine the sample size <em>n<\/em> such that we are 95% confident that the error is at most 0.05 when [latex]\\hat{p}[\/latex] is used to estimate [latex]p[\/latex]. Use the conservative estimate [latex]\\hat{p}=0.5[\/latex].<br \/>\nSince we do not have any extra information about [latex]\\hat{p}[\/latex], we will use [latex]n = 0.25 \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2[\/latex]. [latex]1 - \\alpha = 0.95 \\Longrightarrow \\alpha = 0.05 \\Longrightarrow z_{\\alpha \/ 2} = z_{0.025} = 1.96[\/latex], and [latex]E = 0.05[\/latex].<\/li>\n<\/ol>\n<p style=\"text-align: center;\">[latex]n = 0.25 \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2 = 0.25 \\times \\left( \\frac{1.96}{0.05} \\right)^2 = 384.16[\/latex] rounded up to [latex]n = 385.[\/latex]<\/p>\n<ol start=\"2\">\n<li>Suppose [latex]p[\/latex] is known to be in between 0.6 and 0.8. Equipped with this new information, obtain a sample size to ensure the margin of error is at most 0.05 with 95% confidence.<br \/>\nWe should take this information into account and use [latex]p_g = 0.6[\/latex], the value closest to 0.5 within the range [0.6, 0.8]. Therefore, the required sample size is<\/p>\n<p style=\"text-align: center;\">[latex]n = p_g (1 - p_g) \\left( \\frac{z_{\\alpha \/ 2}}{E} \\right)^2 = 0.6 (1 - 0.6) \\times \\left( \\frac{1.96}{0.05} \\right)^2 = 368.79[\/latex],<\/p>\n<p>rounded up to [latex]n = 369[\/latex].<\/li>\n<\/ol>\n<\/div>\n<\/div>\n","protected":false},"author":19,"menu_order":4,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-1099","chapter","type-chapter","status-publish","hentry"],"part":1075,"_links":{"self":[{"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/pressbooks\/v2\/chapters\/1099","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/wp\/v2\/users\/19"}],"version-history":[{"count":33,"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/pressbooks\/v2\/chapters\/1099\/revisions"}],"predecessor-version":[{"id":5625,"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/pressbooks\/v2\/chapters\/1099\/revisions\/5625"}],"part":[{"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/pressbooks\/v2\/parts\/1075"}],"metadata":[{"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/pressbooks\/v2\/chapters\/1099\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/wp\/v2\/media?parent=1099"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/pressbooks\/v2\/chapter-type?post=1099"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/wp\/v2\/contributor?post=1099"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/openbooks.macewan.ca\/introstats\/wp-json\/wp\/v2\/license?post=1099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}