{"id":966,"date":"2020-06-02T07:12:24","date_gmt":"2020-06-02T11:12:24","guid":{"rendered":"http:\/\/pressbooks.library.upei.ca\/montelpare\/?post_type=chapter&#038;p=966"},"modified":"2020-08-31T06:43:29","modified_gmt":"2020-08-31T10:43:29","slug":"calculating-probabilities","status":"publish","type":"chapter","link":"https:\/\/pressbooks.library.upei.ca\/montelpare\/chapter\/calculating-probabilities\/","title":{"raw":"Calculating Probabilities","rendered":"Calculating Probabilities"},"content":{"raw":"<div class=\"textbox textbox--learning-objectives\"><header class=\"textbox__header\">\r\n<table class=\"aligncenter\" style=\"border-collapse: collapse\">\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 100%\"><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p class=\"textbox__title\">Learner Outcomes<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">\r\n\r\nAfter reading this chapter you should be able to:\r\n<ul>\r\n \t<li>apply probabilistic approaches to compute the likelihood of outcomes<\/li>\r\n \t<li>recognize and apply the binomial probability formula<\/li>\r\n<\/ul>\r\n<\/div>\r\n<\/div>\r\n<h2>1. Computing Bernoulli Trials<\/h2>\r\nThe rules of a Bernoulli trial are straight-forward. Given an independent process in which an outcome can be observed, the outcome can have only two possibilities and the chance or probability of the observed outcome is the same as the chance or probability of the non-observed outcome. \u00a0Hence the fair toss of a fair coin is an excellent demonstration of a Bernoulli trial, because, as we observe in the tossing of a fair coin, there are only two possible outcomes: a head or a tail.\u00a0 Likewise, the probability of tossing a head is equal to the probability of tossing a tail, and this probability is equal to 0.5 or one-half. Further, if the coin is fair and the toss or flip is fair \u2013 without any external influence, then we can say that the process was independent.\r\n\r\nWhen we are computing Bernoulli trials we often use the term <em>event<\/em> to refer to the process or test that we are conducting, and the outcome variable as the indicator variable. The outcome of an event in a Bernoulli trial is an element of the Bernoulli distribution, whereby the Bernoulli distribution is described as a discrete distribution with a possibility of one of two outcomes. The indicator variable sometimes referred to as a DUMMY variable or a BINARY variable, has two possible outcomes (success or failure).\u00a0 Further, when scoring the indicator variable we typically assign a value of 1 to the success and a value of 0 to the failure.\r\n\r\nThe notation used to represent the outcome of a Bernoulli trial is [latex]X_{i}[\/latex], so that [latex]X_{1}[\/latex] refers to a single Bernoulli trial and[latex]X_{n}[\/latex] refers to <strong><em>n<\/em><\/strong> Bernoulli trials where <em><strong>n<\/strong><\/em> ranges from 1 to infinity. Further, the probability of success of an outcome in a Bernoulli trial is written as: ([latex]P(X_{i} =1) [\/latex] ) = p, while the probability of failure of an outcome in a Bernoulli trial is written as ([latex]P(X_{i} =0) [\/latex] ) = 1 \u2013 p.\r\n\r\nWe can also use p and q to represent the outcome of a Bernoulli trial, where p is representative of the probability of success and q is representative of the probability of failure. The probability of p is assigned in a fair and independent event as p = 0.5, and the probability of q is assigned as (1 - p) = (1 - 0.5) = 0.5.\r\n\r\nIn the following example, we can use SAS and a set of probability outcomes that range from 0 to 1 and are based on an interval of 0.025 to plot the variance of a Bernoulli trial. In this example, the outcome is based on the assumption that the mean [latex]X_{i}[\/latex] = p and the variance of [latex]X_{i}[\/latex] = p(1-p).\r\n\r\nThe data set for this example will be based on[latex]X_{1}[\/latex] = p: 0.00, 0.025, 0.05, 0.075, 0.1, 0.125, 0.15, 0.175, 0.2, 0.225, 0.25, 0.275, 0.3, 0.325, 0.35, 0.375, 0.4, 0.425, 0.45, 0.475, 0.5, 0.525, 0.55, 0.575, 0.6, 0.625, 0.65, 0.675, 0.7, 0.725, 0.75, 0.775, 0.8, 0.825, 0.85, 0.875, 0.9, 0.925, 0.95, 0.975, 1\r\n\r\nThese data are entered as follows:\r\n\r\n1 0.00\r\n2 0.025\r\n3 0.05\r\n. \u00a0\u00a0.\r\n. \u00a0\u00a0.\r\n. \u00a0\u00a0.\r\n39 0.95\r\n40 0.975\r\n41 1.00\r\n<div class=\"textbox\">The SAS code to produce the variance [latex]\\color{dbeeff}\\rightarrow {varX_{1}}[\/latex]= p(1-p) based on these data is shown here.<\/div>\r\n<div class=\"textbox textbox--examples\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">SAS Program to compute variance of a Bernoulli Trial<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">\r\n\r\nDATA BERNOULLI;\r\nINPUT ID PROB_PI @@ ;\r\nPROB_QI=(1-PROB_PI);\r\nVARPQ=(PROB_PI * PROB_QI);\r\n\r\nDATALINES;\r\n1 0.00 2 0.025 3 0.05 4 0.075 5 0.1 6 0.125 7 0.15\r\n8 0.175 9 0.2 10 0.225 11 0.25 12 0.275 13 0.3\r\n14 0.325 15 0.35 16 0.375 17 0.4 18 0.425 19 0.45\r\n20 0.475 21 0.5 22 0.525 23 0.55 24 0.575 25 0.6\r\n26 0.625 27 0.65 28 0.675 29 .7 30 0.725 31 0.75\r\n32 0.775 33 0.8 34 0.825 35 0.85 36 0.875 37 0.9\r\n38 0.925 39 0.95 40 0.975 41 1\r\n;\r\nPROC SGPLOT;\r\nSERIES X=PROB_PI Y=VARPQ;\r\n* XAXIS TYPE = DISCRETE;\r\nTITLE1 \"GRAPHICAL PRESENTATION OF THE VARIANCE OF (P * Q) USING SGPLOT \";\r\n\r\nRUN;\r\nPROC PRINT;\r\nVAR PROB_PI PROB_QI VARPQ;\r\nTITLE1 'PRINT OF DATA FOR COMPLETE BERNOULLI TRIAL';\r\nRUN;\r\n\r\n<\/div>\r\n<\/div>\r\nThe SAS statements: proc SGPLOT \u00a0and PLOT varpq*prob_pi produced the following graph which shows the distribution of variance across all estimates of [latex]p_{success}[\/latex] and [latex]q_{failures}[\/latex] from 0.00 to 1.00.\r\n\r\n<img src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/var_pq.png\" alt=\"\" class=\"aligncenter size-full wp-image-1707\" width=\"640\" height=\"480\" \/>\r\n\r\nWith the PROC PRINT statement, we can produce a complete listing of the data set for probabilities of success (<strong>[latex] p_{i}[\/latex]<\/strong>) and the probability of failures (<strong>[latex] q_{i}[\/latex]<\/strong> along with the variance of the success and failures (variance of p*q). These results are shown in the 22.1 below.\r\n<div><\/div>\r\n<div style=\"text-align: center\">Table 22.1 Discrete Probability Distribution of the Bernouli Trial for all possible outcomes for the data set [latex]X_{i}[\/latex] where i = 0 to 41.<\/div>\r\n<div>\r\n<table class=\"aligncenter\">\r\n<thead>\r\n<tr>\r\n<td><strong>Obs(i)<\/strong><\/td>\r\n<td><strong>[latex] p_{i}[\/latex]<\/strong><\/td>\r\n<td><strong>[latex]q_{i}[\/latex]<\/strong><\/td>\r\n<td><strong>variance of p*q<\/strong><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td><strong>1<\/strong><\/td>\r\n<td>0.000<\/td>\r\n<td>1.000<\/td>\r\n<td>0.00000<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>2<\/strong><\/td>\r\n<td>0.025<\/td>\r\n<td>0.975<\/td>\r\n<td>0.02438<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>3<\/strong><\/td>\r\n<td>0.050<\/td>\r\n<td>0.950<\/td>\r\n<td>0.04750<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>4<\/strong><\/td>\r\n<td>0.075<\/td>\r\n<td>0.925<\/td>\r\n<td>0.06938<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>5<\/strong><\/td>\r\n<td>0.100<\/td>\r\n<td>0.900<\/td>\r\n<td>0.09000<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>6<\/strong><\/td>\r\n<td>0.125<\/td>\r\n<td>0.875<\/td>\r\n<td>0.10938<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>7<\/strong><\/td>\r\n<td>0.150<\/td>\r\n<td>0.850<\/td>\r\n<td>0.12750<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>8<\/strong><\/td>\r\n<td>0.175<\/td>\r\n<td>0.825<\/td>\r\n<td>0.14438<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>9<\/strong><\/td>\r\n<td>0.200<\/td>\r\n<td>0.800<\/td>\r\n<td>0.16000<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>10<\/strong><\/td>\r\n<td>0.225<\/td>\r\n<td>0.775<\/td>\r\n<td>0.17438<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>11<\/strong><\/td>\r\n<td>0.250<\/td>\r\n<td>0.750<\/td>\r\n<td>0.18750<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>12<\/strong><\/td>\r\n<td>0.275<\/td>\r\n<td>0.725<\/td>\r\n<td>0.19938<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>13<\/strong><\/td>\r\n<td>0.300<\/td>\r\n<td>0.700<\/td>\r\n<td>0.21000<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>14<\/strong><\/td>\r\n<td>0.325<\/td>\r\n<td>0.675<\/td>\r\n<td>0.21938<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>15<\/strong><\/td>\r\n<td>0.350<\/td>\r\n<td>0.650<\/td>\r\n<td>0.22750<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>16<\/strong><\/td>\r\n<td>0.375<\/td>\r\n<td>0.625<\/td>\r\n<td>0.23438<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>17<\/strong><\/td>\r\n<td>0.400<\/td>\r\n<td>0.600<\/td>\r\n<td>0.24000<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>18<\/strong><\/td>\r\n<td>0.425<\/td>\r\n<td>0.575<\/td>\r\n<td>0.24438<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>19<\/strong><\/td>\r\n<td>0.450<\/td>\r\n<td>0.550<\/td>\r\n<td>0.24750<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>20<\/strong><\/td>\r\n<td>0.475<\/td>\r\n<td>0.525<\/td>\r\n<td>0.24938<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>21<\/strong><\/td>\r\n<td>0.500<\/td>\r\n<td>0.500<\/td>\r\n<td>0.25000<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>22<\/strong><\/td>\r\n<td>0.525<\/td>\r\n<td>0.475<\/td>\r\n<td>0.24938<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>23<\/strong><\/td>\r\n<td>0.550<\/td>\r\n<td>0.450<\/td>\r\n<td>0.24750<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>24<\/strong><\/td>\r\n<td>0.575<\/td>\r\n<td>0.425<\/td>\r\n<td>0.24438<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>25<\/strong><\/td>\r\n<td>0.600<\/td>\r\n<td>0.400<\/td>\r\n<td>0.24000<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>26<\/strong><\/td>\r\n<td>0.625<\/td>\r\n<td>0.375<\/td>\r\n<td>0.23438<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>27<\/strong><\/td>\r\n<td>0.650<\/td>\r\n<td>0.350<\/td>\r\n<td>0.22750<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>28<\/strong><\/td>\r\n<td>0.675<\/td>\r\n<td>0.325<\/td>\r\n<td>0.21938<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>29<\/strong><\/td>\r\n<td>0.700<\/td>\r\n<td>0.300<\/td>\r\n<td>0.21000<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>30<\/strong><\/td>\r\n<td>0.725<\/td>\r\n<td>0.275<\/td>\r\n<td>0.19938<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>31<\/strong><\/td>\r\n<td>0.750<\/td>\r\n<td>0.250<\/td>\r\n<td>0.18750<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>32<\/strong><\/td>\r\n<td>0.775<\/td>\r\n<td>0.225<\/td>\r\n<td>0.17438<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>33<\/strong><\/td>\r\n<td>0.800<\/td>\r\n<td>0.200<\/td>\r\n<td>0.16000<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>34<\/strong><\/td>\r\n<td>0.825<\/td>\r\n<td>0.175<\/td>\r\n<td>0.14438<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>35<\/strong><\/td>\r\n<td>0.850<\/td>\r\n<td>0.150<\/td>\r\n<td>0.12750<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>36<\/strong><\/td>\r\n<td>0.875<\/td>\r\n<td>0.125<\/td>\r\n<td>0.10938<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>37<\/strong><\/td>\r\n<td>0.900<\/td>\r\n<td>0.100<\/td>\r\n<td>0.09000<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>38<\/strong><\/td>\r\n<td>0.925<\/td>\r\n<td>0.075<\/td>\r\n<td>0.06937<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>39<\/strong><\/td>\r\n<td>0.950<\/td>\r\n<td>0.050<\/td>\r\n<td>0.04750<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>40<\/strong><\/td>\r\n<td>0.975<\/td>\r\n<td>0.025<\/td>\r\n<td>0.02438<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>41<\/strong><\/td>\r\n<td>1.000<\/td>\r\n<td>0.000<\/td>\r\n<td>0.00000<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<div>\r\n\r\nThe proc freq procedure produced a complete frequency distribution independently for each of the variables: prob_pi , prob_qi ,\u00a0 and varpq.\r\n\r\nThe output shown below is identical for the frequency distributions of the variables prob_pi and prob_qi. Therefore, only the data for prob_pi is shown here.\r\n\r\n<\/div>\r\n<div>\r\n<div align=\"center\">\r\n<table>\r\n<thead>\r\n<tr>\r\n<td><strong>prob_pi<\/strong><\/td>\r\n<td><strong>Freq<\/strong><\/td>\r\n<td><strong>PCT<\/strong><\/td>\r\n<td><strong>Cumulative\r\nFrequency<\/strong><\/td>\r\n<td><strong>Cumulative\r\nPercent<\/strong><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>0<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.025<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.05<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>3<\/td>\r\n<td>7.32<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.075<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>4<\/td>\r\n<td>9.76<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.1<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>5<\/td>\r\n<td>12.20<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.125<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>6<\/td>\r\n<td>14.63<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.15<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>7<\/td>\r\n<td>17.07<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.175<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>8<\/td>\r\n<td>19.51<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.2<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>9<\/td>\r\n<td>21.95<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.225<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>10<\/td>\r\n<td>24.39<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.25<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>11<\/td>\r\n<td>26.83<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.275<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>12<\/td>\r\n<td>29.27<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.3<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>13<\/td>\r\n<td>31.71<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.325<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>14<\/td>\r\n<td>34.15<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.35<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>15<\/td>\r\n<td>36.59<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.375<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>16<\/td>\r\n<td>39.02<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.4<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>17<\/td>\r\n<td>41.46<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.425<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>18<\/td>\r\n<td>43.90<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.45<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>19<\/td>\r\n<td>46.34<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.475<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>20<\/td>\r\n<td>48.78<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.5<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>21<\/td>\r\n<td>51.22<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.525<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>22<\/td>\r\n<td>53.66<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.55<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>23<\/td>\r\n<td>56.10<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.575<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>24<\/td>\r\n<td>58.54<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.6<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>25<\/td>\r\n<td>60.98<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.625<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>26<\/td>\r\n<td>63.41<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.65<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>27<\/td>\r\n<td>65.85<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.675<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>28<\/td>\r\n<td>68.29<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.7<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>29<\/td>\r\n<td>70.73<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.725<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>30<\/td>\r\n<td>73.17<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.75<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>31<\/td>\r\n<td>75.61<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.775<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>32<\/td>\r\n<td>78.05<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.8<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>33<\/td>\r\n<td>80.49<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.825<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>34<\/td>\r\n<td>82.93<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.85<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>35<\/td>\r\n<td>85.37<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.875<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>36<\/td>\r\n<td>87.80<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.9<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>37<\/td>\r\n<td>90.24<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.925<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>38<\/td>\r\n<td>92.68<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.95<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>39<\/td>\r\n<td>95.12<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>0.975<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>40<\/td>\r\n<td>97.56<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>1<\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>41<\/td>\r\n<td>100.00<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<\/div>\r\n<div>\r\n\r\nHowever, the frequency distribution for var(PQ) is unique and is shown here.\r\n\r\n<\/div>\r\n<div>\r\n<table class=\"aligncenter\">\r\n<thead>\r\n<tr>\r\n<td><strong>Var(p*q)<\/strong><\/td>\r\n<td><strong>Frequency<\/strong><\/td>\r\n<td><strong>PCT<\/strong><\/td>\r\n<td><strong>Cumulative\r\nFrequency<\/strong><\/td>\r\n<td><strong>Cumulative\r\nPercent<\/strong><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td><strong>0<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.024<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>4<\/td>\r\n<td>9.76<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.048<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>6<\/td>\r\n<td>14.63<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.069<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>8<\/td>\r\n<td>19.51<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.09<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>10<\/td>\r\n<td>24.39<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.109<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>12<\/td>\r\n<td>29.27<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.128<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>14<\/td>\r\n<td>34.15<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.144<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>16<\/td>\r\n<td>39.02<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.16<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>18<\/td>\r\n<td>43.90<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.174<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>20<\/td>\r\n<td>48.78<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.188<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>22<\/td>\r\n<td>53.66<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.199<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>24<\/td>\r\n<td>58.54<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.21<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>26<\/td>\r\n<td>63.41<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.219<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>28<\/td>\r\n<td>68.29<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.228<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>30<\/td>\r\n<td>73.17<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.375<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>32<\/td>\r\n<td>78.05<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.24<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>34<\/td>\r\n<td>82.93<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.244<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>36<\/td>\r\n<td>87.80<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.248<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>38<\/td>\r\n<td>92.68<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.249<\/strong><\/td>\r\n<td>2<\/td>\r\n<td>4.88<\/td>\r\n<td>40<\/td>\r\n<td>97.56<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>0.25<\/strong><\/td>\r\n<td>1<\/td>\r\n<td>2.44<\/td>\r\n<td>41<\/td>\r\n<td>100.00<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<div>\r\n<h2>2. The Coin Toss That Might Mean Something<\/h2>\r\nThe American Football league\u2019s national championship: the Super Bowl begins with a coin toss. At the start of the game, the captain\u2019s of each team meet in the centre of the field to toss a coin to determine which one of the teams will start the game as the kicking team and which team will start the game as the receiving team. Since the outcome of either kicking the ball to the opposing team to start the game or receiving the ball from the opposing team to start the game may have consequences on the final score, there is an attempt to make this decision an unbiased and fair process.\u00a0 The National Football League has chosen to render this decision to a Bernoulli trial.\r\n\r\nConsidering that a fair toss of a fair coin has a 50% chance of turning up heads and a 50% chance of turning up tails then the use of a coin toss to determine outcomes is a good approach.\r\n<h3>The Binomial Formula establishes the probability using the following formula:<\/h3>\r\n<p style=\"text-align: center\">[latex]P_{x} = \\frac{n!}{x!(n-x)!} \\times p^{x} q^{n-x}[\/latex]<\/p>\r\n\r\n<h3>The elements of this probability prediction formula are explained as follows:<\/h3>\r\n<h5>[latex]P_{x} =[\/latex] the probability of exactly <em>x<\/em> events of a given outcome appearing in<strong> <em>n<\/em> trials.<\/strong><\/h5>\r\n<h5>p = the probability of an event on any given trial (if we are flipping a coin then this value is \u00bd with a fair coin).<\/h5>\r\n<em>q<\/em> = the probability of an event on any given trial <em>q =\u00a0 1- p <\/em>(usually this value is \u00bd if we were flipping a coin).\r\n<em>n<\/em> = the number of events.\r\n\r\n<em>x<\/em> = the number of a given outcome (e.g. heads) being evaluated.\r\n\r\n<hr \/>\r\n\r\n<div>Consider an example for the Probabilities associated with tossing a fair coin<\/div>\r\nThe coin tossing exercise is a useful way of demonstrating the probability of an outcome within a given set of trials when the expected chance of an outcome is fixed (known) or expected. For example, if we have a <em>\"fair\"<\/em> coin then the expected probability or chance of tossing a given outcome (i.e. heads) is 0.5 or \u00bd. Therefore, given ten tosses of the fair coin we could predict the number of times we should expect to see the outcome as heads or tails.\r\n\r\nIn other words, to compute the proportion of outcomes observed we can predict the chance that an outcome or event will occur.\r\n\r\nIn the following example, we can determine the probability associated with flipping a \"head\" four times in ten tosses of a fair coin. That is, if we flip a fair coin ten times then we could predict the number of times we should expect to see \"heads\" appear in four of the ten flips.\r\n\r\nThe formula used to resolve this question is the binomial and is worked through as follows. Let x=4 (the number of heads), n=10 (the number of throws), and P=probability of 4 heads in 10 throws, where <em>p<\/em> is the starting probability and <em>q<\/em> is 1 - <em>p<\/em>. We begin with the binomial formula:\r\n<p style=\"text-align: center\">[latex]P_{x} = \\frac{n!}{x!(n-x)!} \\times p^{x} q^{n-x}[\/latex]<\/p>\r\nStep 1: [latex]P_{4} = \\frac{10!}{4!(10-4)!} \\times (0.5)^{4} (0.5)^{10-4}[\/latex]\r\n\r\nStep 2: [latex]P_{4} =[\/latex][latex] ({10*9*8*7*6*5*4*3*2*1})\\over({4*3*2*1}) \\times ({6*5*4*3*2*1}) [\/latex][latex] \\times (\\frac{1}{2})^{4+6}[\/latex]\r\n\r\nStep 3: [latex]P_{4} =[\/latex][latex] ({10*9*8*7} \\times{\\enclose{horizontalstrike}{6*5*4*3*2*1}}) \\over({4*3*2*1}) \\times {\\enclose{horizontalstrike}{6*5*4*3*2*1}})[\/latex][latex] \\times (\\frac{1}{2})^{10}[\/latex]\r\n\r\nStep 4: [latex]P_{4} ={5040 \\over{24} } \\times {(1)^{10} \\over (2)^{10} }[\/latex]\r\n\r\nStep 5: [latex]P_{4} ={210\\times{1\\over{1024} }} [\/latex]\r\n\r\nStep 6: [latex]P_{4} ={210\\over{1024} } [\/latex] = <span style=\"background-color: #ffff00\"><strong>0.206<\/strong><\/span>\r\n\r\nThe calculation table above shows us that in ten tosses of a fair coin there is roughly a 20 percent chance of tossing 4 heads. Further, we can use the binomial formula to compute all possible outcomes for a given series of events when we establish the beforehand (a priori) probability of an outcome in a defined set.\r\n\r\nFor example, let\u2019s use the binomial to compute all possible outcomes for ten tosses of a fair coin.\u00a0 That is, how many times in 10 tosses would 0 heads appear? Likewise, how many times in 10 tosses would 1 through to 10 heads appear?\r\n\r\nAfter working through each application of the binomial equation we could create a table of all possible events in the outcome space.\u00a0 This table is referred to as the Probability Density Chart, and is shown below.\r\n\r\nThe Probability Density Chart for the outcome space when determining the likelihood of tossing a head in 10 tosses of a fair coin\r\n\r\n(x = number of a given outcome; <em>p<\/em> = \u00bd\u00a0 and <em>q<\/em> = 1 - <em>p<\/em>= \u00bd)\r\n\r\n<\/div>\r\n<table>\r\n<tfoot>\r\n<tr class=\"shaded\">\r\n<td style=\"text-align: center\">SUM<\/td>\r\n<td style=\"text-align: center\">1024:1024<\/td>\r\n<td style=\"text-align: center\">1.00<\/td>\r\n<\/tr>\r\n<\/tfoot>\r\n<thead>\r\n<tr class=\"shaded\">\r\n<td style=\"text-align: center\">x<\/td>\r\n<td style=\"text-align: center\">The probability expressed as a ratio<\/td>\r\n<td style=\"text-align: center\">The probability expressed as a decimal<\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr class=\"border\">\r\n<td style=\"text-align: center\">0<\/td>\r\n<td style=\"text-align: center\">1:1024<\/td>\r\n<td style=\"text-align: center\">0.0009765<\/td>\r\n<\/tr>\r\n<tr class=\"border\">\r\n<td style=\"text-align: center\">1<\/td>\r\n<td style=\"text-align: center\">10:1024<\/td>\r\n<td style=\"text-align: center\">0.0097656<\/td>\r\n<\/tr>\r\n<tr class=\"border\">\r\n<td style=\"text-align: center\">2<\/td>\r\n<td style=\"text-align: center\">45:1024<\/td>\r\n<td style=\"text-align: center\">0.0439453<\/td>\r\n<\/tr>\r\n<tr class=\"border\">\r\n<td style=\"text-align: center\">3<\/td>\r\n<td style=\"text-align: center\">120:1024<\/td>\r\n<td style=\"text-align: center\">0.1171875<\/td>\r\n<\/tr>\r\n<tr class=\"border\">\r\n<td style=\"text-align: center\">4<\/td>\r\n<td style=\"text-align: center\">210:1024<\/td>\r\n<td style=\"text-align: center\">0.2050781<\/td>\r\n<\/tr>\r\n<tr class=\"border\">\r\n<td style=\"text-align: center\">5<\/td>\r\n<td style=\"text-align: center\">252:1024<\/td>\r\n<td style=\"text-align: center\">0.2460937<\/td>\r\n<\/tr>\r\n<tr class=\"border\">\r\n<td style=\"text-align: center\">6<\/td>\r\n<td style=\"text-align: center\">210:1024<\/td>\r\n<td style=\"text-align: center\">0.2050781<\/td>\r\n<\/tr>\r\n<tr class=\"border\">\r\n<td style=\"text-align: center\">7<\/td>\r\n<td style=\"text-align: center\">120:1024<\/td>\r\n<td style=\"text-align: center\">0.1171875<\/td>\r\n<\/tr>\r\n<tr class=\"border\">\r\n<td style=\"text-align: center\">8<\/td>\r\n<td style=\"text-align: center\">45:1024<\/td>\r\n<td style=\"text-align: center\">0.0439453<\/td>\r\n<\/tr>\r\n<tr class=\"border\">\r\n<td style=\"text-align: center\">9<\/td>\r\n<td style=\"text-align: center\">10:1024<\/td>\r\n<td style=\"text-align: center\">0.0097656<\/td>\r\n<\/tr>\r\n<tr class=\"border\">\r\n<td style=\"text-align: center\">10<\/td>\r\n<td style=\"text-align: center\">1:1024<\/td>\r\n<td style=\"text-align: center\">0.0009765<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<h2>3. Patients as Coins - An Application of the Coin Toss<\/h2>\r\nWe can use the example of tossing a fair coin as a proxy for estimating the likelihood of identifying individuals to develop health conditions.\r\n\r\nFor example, consider the hypothetical situation where it is suspected that families within certain rural environments may be exposed to carcinogenic compounds in their drinking water as a result of run-off from farm fields into their wells. Let\u2019s start with the following scenario in which you are asked, \u201cWhat is the likelihood of observing 15 blood screens that test positive for a given carcinogenic substance in blood samples drawn from 25 mothers attending a prenatal health program?\u201d\r\n\r\nTo compute the likelihood of observing 15 positive blood screens for the 25 mothers sampled, we decide to use the binomial formula with the following elements. Since we observed 15 positive cases then the term [latex]P_{x} [\/latex] refers to the probability of observing this outcome in the 25 mothers, where <strong>x=15\u00a0<\/strong> and <strong>n=25<\/strong>.\r\n<h5 style=\"text-align: center\">[latex]P_{x} = \\frac{n!}{x!(n-x)!} \\times p^{x} q^{n-x}[\/latex]<\/h5>\r\n<h5 style=\"text-align: center\">Step 1: [latex]P_{15} = \\frac{25!}{15!(25-15)!} \\times {\\left({1\\over{2} }\\right)^{15}}{\\left({1\\over{2} }\\right)^{25-15}} [\/latex]<\/h5>\r\n<h5 style=\"text-align: center\">Step 2: [latex]P_{15} = \\frac{25!}{15!\\times(10!)} \\times {\\left({1\\over{2} }\\right)^{15+10}} [\/latex]<\/h5>\r\nWhile this formula looks neat in the arrangement of terms it can become quite unwieldy quickly because we are multiplying and dividing such large numbers. Note the term (n!) is 25! which indicates that we use a series of multiplication steps that are (n * (n-1)) repeatedly until we converge to (2 * (2-1)). Given that we include factorials in the numerator and the denominator our challenge is to organize all of the operations while respecting the BEDMAS principle and arriving at the appropriate solution to the formula. While we can do this with a handheld calculator it is so much easier to simply write a program to analyze this scenario using the following SAS code:\r\n<div>\r\n<div class=\"textbox textbox--examples\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">Use SAS to do the work in our computations of probability to identify individuals to develop health conditions.<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">DATA BERN2;\r\n\/* create the variable to represent the numerator (n!) *\/\r\nNUM1 = FACT(25);\/* create the variable to represent the denominator (x!(n-x)!) *\/\r\nDEN1= (FACT(15)*FACT(10));\/* notice in the statements above, the function to produce a factorial of a number is FACT(#), as in FACT(25) will produce the factorial of the number 25. *\/\/* create the variable to represent the first fraction\u00a0 *\/\r\nFRACTION1= NUM1 \/ DEN1;\/* create variable to represent the combined probability estimates, then include PUT statement to use the outcome in the subsequent calculations *\/\r\nPQ1= (0.5)**25; PUT PQ1;\/* variable to represent the expected outcome *\/\r\nANSWER1 = (FRACTION1 * PQ1);\r\nRUN;\/* print the important variables *\/\r\nPROC PRINT; VAR\u00a0 NUM1 DEN1 FRACTION1 PQ1 ANSWER1;\r\nRUN;<\/div>\r\n<\/div>\r\n<\/div>\r\nThe SAS code above produced the following table of results.\r\n<table class=\"table\" aria-label=\"Data Set WORK.BERNOULLI\"><caption aria-label=\"Data Set WORK.BERNOULLI\">\u00a0<\/caption><colgroup> <col \/><\/colgroup> <colgroup> <col \/> <col \/> <col \/> <col \/> <col \/><\/colgroup>\r\n<tbody>\r\n<tr bgcolor=\"#dbeeff\">\r\n<th class=\"r rowheader\" scope=\"row\">1<\/th>\r\n<td class=\"r data\">1.5511_E25<\/td>\r\n<td class=\"r data\">4.7453_E18<\/td>\r\n<td class=\"r data\">3268760<\/td>\r\n<td class=\"r data\">2.9802_E-8<\/td>\r\n<td class=\"r data\">0.097417<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\nLet's walk through this SAS Output to explain each of the parts of the exercise in calculating the probability of identifying 15 Cases from a sample of 25 women visiting the health clinic. The following elements of the Bernoulli equation (binomial equation) were computed with the SAS program above.\r\n\r\n(i) The Numerator term is:<strong>[latex]\\color{#330099}(n!) [\/latex] <\/strong>\r\n<div align=\"center\">\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td>1.5511(E25) [latex] \\rightarrow [\/latex] reminds us to add 21 trailing zeros and move the decimal place to the right by 25 spaces, since E25 refers to 1.5511 times ten to the twenty-fifth power<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n(ii) The Denominator term is:<strong>[latex]\\color{#330099}(x!)\\times(n-x)! [\/latex] <\/strong>\r\n<div align=\"center\">\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td>4.7453(E18) [latex] \\rightarrow [\/latex]add 13 leading zeros since E18 refers to 4.7453 times ten to the eighteenth power<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n(iii) The fraction of <strong>[latex]\\color{#330099}\\frac{(n!)}{(x!)\\times(n-x)! } [\/latex] is: <\/strong>\r\n<div align=\"center\">\r\n<table>\r\n<tbody>\r\n<tr bgcolor=\"#dbeeff\">\r\n<td><strong>[latex]{\\textit{1.5511(E25)}\\over{\\textit{4.7453(E18)}}} = 3,268,760[\/latex]<\/strong><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n(iv) The unbiased expected probability terms [latex]p^x q^{n-x}[\/latex]\u00a0are:\r\n<div align=\"center\">\r\n<table>\r\n<thead>\r\n<tr bgcolor=\"#dbeeff\">\r\n<td>[latex]{\\left({1\\over{2} }\\right)^{15+10}} [\/latex]<\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>2.98 E-8 which represents 0.0000000298 because E with a - sign indicates the number by which we move the decimal to the left of the whole number and add leading zeros (0)<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n(v) The resulting probability expressed in terms of a percentage:\r\n<div align=\"center\">\r\n<table>\r\n<thead>\r\n<tr bgcolor=\"#dbeeff\">\r\n<td>[latex]P_{15}\\rvert (N=25)[\/latex]<\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>0.097 can be expressed as 10%<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\nIn example 1, we found that there was a 10% chance of observing 15 positive screens for the suspected carcinogen in the sample of 25 women attending the prenatal class.\r\n\r\n<hr \/>\r\n\r\nWhat is the likelihood of identifying 5 positive cases for the suspected carcinogen in a sample of 50 women selected at random from the corresponding urban environment?\r\n\r\nThe SAS code to resolve this question is:\r\n\r\nDATA BERN3;\r\nEX2A= FACT(50); EX2B= ((FACT(5)*FACT(45)));\r\nEX2C= EX2A\/EX2B; EX2D = (0.5)**50; EX2E = EX2C * EX2D;\r\nRUN;\r\nPROC PRINT; VAR EX2A EX2B EX2C EX2D EX2E ;\r\nRUN;\r\n\r\nThe SAS code produced the following output:\r\n<div align=\"center\">\r\n<table>\r\n<thead>\r\n<tr bgcolor=\"#dbeeff\">\r\n<td width=\"30%\">Numerator\r\n[latex](50!)= 50 \\times 49 \\times 48 \\times ... \\times 2 \\times 1[\/latex]<\/td>\r\n<td width=\"15%\">Denominator\r\n[latex](5!) \\times (45!)[\/latex]<\/td>\r\n<td width=\"15%\">[latex]{Numerator}\\over{Denominator}[\/latex]<\/td>\r\n<td width=\"20%\">[latex]{\\left({1\\over{2} }\\right)^{5+45}} [\/latex]<\/td>\r\n<td width=\"20%\">[latex]P_{5}\\rvert (N=50)[\/latex]<\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr>\r\n<td>3.0414E64<\/td>\r\n<td>1.4355E58<\/td>\r\n<td>2118760<\/td>\r\n<td>8.8818E-16<\/td>\r\n<td>1.8818E-9<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\nIn example 2, we suggest that the likelihood of observing 5 cases in 50 patients was extremely unlikely and is less than 1% as shown by the answer \u00e0 1.88 E-9 which translates to a probability of 0.00000000188 given a sample size of 50 women, and can be written as: [latex]P_{5}\\rvert (N=50) = 0.00000000188[\/latex]\r\n<h2>Computing the probabilities of tossing a single die<\/h2>\r\nConsidering a single die -- what is the probability (or chance) of rolling a given number?\u00a0 For example, for a single die, estimate the probability of rolling a number less than \u201c5\u201d.\r\n\r\n<strong>Step 1:<\/strong> determine the set of all possible outcomes.\r\n\r\n<em>1 roll of a single die = {1, 2, 3, 4, 5, 6} = 6<\/em>\r\n\r\n<img src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/dice.png\" alt=\"\" width=\"625\" height=\"132\" class=\"aligncenter size-full wp-image-1791\" \/>\r\n<p style=\"text-align: center\">Figure 22.2 Image of all possible outcomes for a single die<\/p>\r\n<strong>On the roll of the dice<\/strong> . . . A single die has six sides, each side with a different number from 1 to 6.\r\n\r\nTherefore, the set of all possible outcomes is:\r\n\r\n\u2013 1 die = {1, 2, 3, 4, 5, 6}\r\n\r\n\u2013 the probability of rolling any\u00a0 \u201cgiven number\u201d is 1\/6 or p(roll) = 0.17.\r\n<h4><em>Therefore, with a <strong>single die<\/strong>, estimate the probability of rolling a number less than \u201c5\u201d.<\/em><\/h4>\r\n<strong>Step 1:<\/strong> determine the set of all possible outcomes.\r\n\r\n1 roll of a single die = {1, 2, 3, 4, 5, 6} = 6\r\n\r\n<strong>Step 2:<\/strong> determine the set of favourable outcomes.\r\n\r\nNumbers less than 5 = {1, 2, 3, 4} = 4\r\n\r\n<strong>Step 3:<\/strong> divide the number of favourable or anticipated outcomes by the number of possible outcomes to estimate the probability. Therefore, there is a 67% chance of rolling a number less than 5 as shown here:\r\n\r\nProbability\u00a0 = 4\/6 = 2\/3 = 0.6666 = 67%\r\n\r\n<hr \/>\r\n\r\n<h6><strong>HOWEVER,<\/strong> what if we were asked to consider rolling a number less than 5, in four of ten tosses of a single die? To answer this question we would apply the binomial formula, using the following apriori estimates: n=10, x=4, p=0.67, q=0.33.<\/h6>\r\n[latex]P_{x} = \\frac{n!}{x!(n-x)!} \\times p^{x} q^{n-x}[\/latex]\r\n\r\n[latex]P_{4} = \\frac{10!}{4!(10-4)!} \\times {\\left({0.67}\\right)^{4}}{\\left({0.33}\\right)^{10-4}} [\/latex]\r\n\r\n[latex]P_{4} = {210} \\times {0.000259}[\/latex]\r\n\r\n[latex]P_{4} = {0.05465}[\/latex] = roughly 5%\r\n\r\n<hr \/>\r\n\r\n<h2>4. Computing Probabilities Associated With Lottery Number Selection<\/h2>\r\n<h6>So what is the probability of winning from the purchase of a single lottery ticket?<\/h6>\r\n<span style=\"text-align: initial;font-size: 1em\">The chance of any single combination of six numbers from 1 to 49 is extremely low [latex] {1 \\over {49 \\choose{6}}}[\/latex] which is read as 1 ticket divided by the binomial coefficient of (n choose k) or (49 choose 6) and our likelihood of winning the lottery is 1 chance in 13,983,816 combinations.<\/span>\r\n\r\nLet's say you wanted to buy a lottery ticket on the <em>lotto<\/em> <strong>649<\/strong>.\u00a0 You pay one dollar and pick 6 numbers from 49 on a specific computer scan sheet.\u00a0 Your first expectation after (or maybe prior to) purchasing the lottery ticket is that every number on the lottery card between 1 and 49 has an equally likely chance of being selected.\u00a0 Therefore, if every number on the card has an equally likely chance of being selected, then every combination of 6 numbers that can be made from the 49 numbers on the lottery card, has an equally likely chance of being selected. This is an expectation that the selection of the numbers from the lottery card is truly random.\r\n<h4>How many combinations of six numbers are we really talking about?<\/h4>\r\n<p style=\"text-align: center\">To compute the number of possible combinations of 6 numbers from the 49 numbers, we need to use the following combinatorial (or factorial) formula. We have 49 numbers choose 6.\u00a0 The number 49 represents the population from which the sample \"6\" was chosen.\u00a0 We write the formula for determining the combinations using the following combinatorial equation or the binomial coefficient:<\/p>\r\n<p style=\"text-align: center\"><span style=\"text-align: initial;font-size: 1em\">[latex] {N \\choose{n}} = {49 \\choose{6}} [\/latex] <\/span><\/p>\r\nor we may wish to write the formula using a factorial format as:\r\n<p style=\"text-align: center\"><span style=\"text-align: initial;font-size: 1em\">[latex] {N! \\over {n!{(N - n)}!}}[\/latex] = [latex] {49! \\over {6!{(49 - 6)}!}}[\/latex]<\/span><\/p>\r\nTherefore the number of all possible combinations of 6 numbers from a set of 49 consecutive numbers is:\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">[latex] {(49 \\times 48 \\times ... 2 \\times 1) \\over{(6 \\times 5 \\times ... 1) \\times (49 \\times 48 \\times ... 2 \\times 1) }} [\/latex]<\/span>[latex] = {(10,068,347,520) \\over{720 }} = 13,983,816[\/latex]\r\n\r\nYet you won't be happy unless all of your numbers were chosen, but REALLY what is the chance that all six of your numbers will be selected by the lottery machine.\u00a0 Well since you only bought one ticket, then your chance of winning the lottery is 1 in 13,983,816 chances, or <span style=\"text-align: initial;font-size: 1em\">[latex] 1 \\over{49 \\choose{6}} [\/latex] [latex]\\rightarrow { 1 \\over{13,983,816} }[\/latex] <\/span>where the value 0.000000071 represents the probability associated with your set of scores.\r\n<h6>Given this large set of possible outcomes, how might we evaluate the data that are generated from one year of twice-weekly draws for any patterns that seem to be emerging?<\/h6>\r\nOne of the simplest ways to present these data is to combine all of the numbers and present the outcome data in a chart of the <strong>frequency of outcomes<\/strong>. This organizational strategy would show that 6 unique numbers are drawn from the set of possible numbers ranging from 1 to 49, each week for 104 picks (52 weeks with draws held twice weekly). This approach considers that we are using <strong>sampling without replacement,<\/strong> which means that once a number has been selected from the set of 49 possible outcomes each week, that number cannot be selected again in that week. As shown below, the set of outcomes can be organized by the order of choices per week. That is, for any given lottery we can chart the first number drawn, the second number drawn, the third number drawn, the fourth number drawn, the fifth number drawn, or the sixth number drawn, each week.\r\n<table class=\"aligncenter\" style=\"height: 120px\">\r\n<thead>\r\n<tr class=\"shaded\" style=\"height: 15px\">\r\n<td style=\"height: 15px;width: 51.05px\"><strong>draw #<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>1st\u00a0 pick<\/strong><\/td>\r\n<td style=\"height: 15px;width: 59.05px\"><strong>2nd pick<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>3rd pick<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>4th pick<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>5th pick<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>6th pick<\/strong><\/td>\r\n<\/tr>\r\n<\/thead>\r\n<tbody>\r\n<tr style=\"height: 15px\">\r\n<td style=\"height: 15px;width: 51.05px\"><strong>1<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>13<\/strong><\/td>\r\n<td style=\"height: 15px;width: 59.05px\"><strong>21<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>7<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>32<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>47<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>11<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 15px\">\r\n<td style=\"height: 15px;width: 51.05px\"><strong>2<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>5<\/strong><\/td>\r\n<td style=\"height: 15px;width: 59.05px\"><strong>34<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>28<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>2<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>14<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>44<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 15px\">\r\n<td style=\"height: 15px;width: 51.05px\"><strong>.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>\u00a0.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 59.05px\"><strong>.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 15px\">\r\n<td style=\"height: 15px;width: 51.05px\"><strong>.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>\u00a0.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 59.05px\"><strong>.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 15px\">\r\n<td style=\"height: 15px;width: 51.05px\"><strong>.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>\u00a0.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 59.05px\"><strong>.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>.<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 15px\">\r\n<td style=\"height: 15px;width: 51.05px\"><strong>103<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>33<\/strong><\/td>\r\n<td style=\"height: 15px;width: 59.05px\"><strong>16<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>21<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>48<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>15<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>1<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 15px\">\r\n<td style=\"height: 15px;width: 51.05px\"><strong>104<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>18<\/strong><\/td>\r\n<td style=\"height: 15px;width: 59.05px\"><strong>49<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>28<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>3<\/strong><\/td>\r\n<td style=\"height: 15px;width: 55.85px\"><strong>26<\/strong><\/td>\r\n<td style=\"height: 15px;width: 56.65px\"><strong>37<\/strong><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\nThe set of outcomes will then generate a table with 104 rows representing the six numbers drawn each week.\u00a0 However, this table is far too cumbersome and will not help us to make sense of the choices.\u00a0 Using SAS and the PROC FREQ command we can generate a set of six unique outcomes for 104 draws to replicate the twice-weekly draws of the lottery in a given year (52 weeks x 2 draws per week).\r\n\r\nCopy the following program to your SAS space and run the program to see which lucky lottery numbers you can produce from <span style=\"text-align: initial;font-size: 1em\">[latex] {49 \\choose{6}}[\/latex]. Using if-then logic statements will enable you to group the data for each ball drawn each week and thereby provide simple categories to graph the outcomes.\u00a0<\/span>\r\n<div class=\"textbox textbox--exercises\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">SAS PROGRAM TO GENERATE 104 LOTTERY PICKS from 49 choose 6 combinations<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">\r\n<div>options pagesize=60 linesize=80 center date;<\/div>\r\n<div>PROC FORMAT;<\/div>\r\n<div>VALUE GRPFMT 1 = 'NUMBERS 1 TO 7'<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a02 = 'NUMBERS 8 TO 14'<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a03 = 'NUMBERS 15 TO 21'<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a04 = 'NUMBERS 22 TO 28'<\/div>\r\n<div>5 = 'NUMBERS 29 TO 35'<\/div>\r\n<div>6 = 'NUMBERS 36 TO 42'<\/div>\r\n<div>7 = 'NUMBERS 43 TO 49';<\/div>\r\n<div>data sasrng1;<\/div>\r\n<div>call streaminit(13);<\/div>\r\n<div>\/* this is the seed for the RNG *\/<\/div>\r\n<div>array balls ball1-ball6;<\/div>\r\n<div>\u00a0 \u00a0 do k=1 to 104;<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 do i=1 to 6;<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 balls(i) = RAND(\"normal\")*1000000000000;<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 balls(i)=ROUND(balls(i));<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 balls(i)=1+(mod(balls(i),49));<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 balls(i) = ABS(balls(i));<\/div>\r\n<div>\u00a0if ball1 = 0 then ball1 = 1;<\/div>\r\n<div>if ball1 &gt;0 and ball1&lt;8 then ball1grp=1;<\/div>\r\n<div>if ball1 &gt;7 and ball1&lt;15 then ball1grp=2;<\/div>\r\n<div>if ball1 &gt;14 and ball1&lt;22 then ball1grp=3;<\/div>\r\n<div>if ball1 &gt;21 and ball1&lt;29 then ball1grp=4;<\/div>\r\n<div>if ball1 &gt;28 and ball1&lt;36 then ball1grp=5;<\/div>\r\n<div>if ball1 &gt;35 and ball1&lt;43 then ball1grp=6;<\/div>\r\n<div>if ball1 &gt;42 and ball1&lt;50 then ball1grp=7;<\/div>\r\n<div>end;<\/div>\r\n<div><\/div>\r\n<div>call streaminit(999);<\/div>\r\n<div>do until (ball2 ne ball1);<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball2 = RAND(\"normal\")*1000000000000;<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball2 = ROUND(ball2);<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball2 = 1+(mod(ball2,49));<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball2 = ABS(ball2);<\/div>\r\n<div>\u00a0if ball2 = 0 then ball2 = 1;<\/div>\r\n<div>if ball2 &gt;0 and ball2&lt;8 then ball2grp=1;<\/div>\r\n<div>if ball2 &gt;7 and ball2&lt;15 then ball2grp=2;<\/div>\r\n<div>if ball2 &gt;14 and ball2&lt;22 then ball2grp=3;<\/div>\r\n<div>if ball2 &gt;21 and ball2&lt;29 then ball2grp=4;<\/div>\r\n<div>if ball2 &gt;28 and ball2&lt;36 then ball2grp=5;<\/div>\r\n<div>if ball2 &gt;35 and ball2&lt;43 then ball2grp=6;<\/div>\r\n<div>if ball2 &gt;42 and ball2&lt;50 then ball2grp=7;<\/div>\r\n<div>end;<\/div>\r\n<div>call streaminit(28);<\/div>\r\n<div>do until (ball3 ne ball2 and ball3 ne ball1);<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball3 = RAND(\"normal\")*1000000000000;<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball3 = ROUND(ball3);<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball3 = 1+(mod(ball3,49));<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball3 = ABS(ball3);<\/div>\r\n<div>\u00a0 if ball3 = 0 then ball3 = 1;<\/div>\r\n<div>if ball3 &gt;0 and ball3&lt;8 then ball3grp=1;<\/div>\r\n<div>if ball3 &gt;7 and ball3&lt;15 then ball3grp=2;<\/div>\r\n<div>if ball3 &gt;14 and ball3&lt;22 then ball3grp=3;<\/div>\r\n<div>if ball3 &gt;21 and ball3&lt;29 then ball3grp=4;<\/div>\r\n<div>if ball3 &gt;28 and ball3&lt;36 then ball3grp=5;<\/div>\r\n<div>if ball3 &gt;35 and ball3&lt;43 then ball3grp=6;<\/div>\r\n<div>if ball3 &gt;42 and ball3&lt;50 then ball3grp=7;<\/div>\r\n<div>end;<\/div>\r\n<div>call streaminit(218);<\/div>\r\n<div>do until (ball4 ne ball3 and ball4 ne ball2 and ball4 ne ball1);<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball4 = RAND(\"normal\")*1000000000000;<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball4 = ROUND(ball4);<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball4 = 1+(mod(ball4,49));<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball4 = ABS(ball4);<\/div>\r\n<div>\u00a0 if ball4 = 0 then ball4 = 1;<\/div>\r\n<div>if ball4 &gt;0 and ball4&lt;8 then ball4grp=1;<\/div>\r\n<div>if ball4 &gt;7 and ball4&lt;15 then ball4grp=2;<\/div>\r\n<div>if ball4 &gt;14 and ball4&lt;22 then ball4grp=3;<\/div>\r\n<div>if ball4 &gt;21 and ball4&lt;29 then ball4grp=4;<\/div>\r\n<div>if ball4 &gt;28 and ball4&lt;36 then ball4grp=5;<\/div>\r\n<div>if ball4 &gt;35 and ball4&lt;43 then ball4grp=6;<\/div>\r\n<div>if ball4 &gt;42 and ball4&lt;50 then ball4grp=7;<\/div>\r\n<div>end; call streaminit(28);<\/div>\r\n<div>do until (ball5 ne ball4 and ball5 ne ball3 and ball5 ne ball2 and ball5 ne ball1);<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball5 = RAND(\"normal\")*1000000000000;<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball5 = ROUND(ball5);<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball5 = 1+(mod(ball5,49));<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball5 = ABS(ball5);<\/div>\r\n<div>\u00a0 \u00a0 \u00a0if ball5 = 0 then ball5 = 1;<\/div>\r\n<div>if ball5 &gt;0 and ball5&lt;8 then ball5grp=1;<\/div>\r\n<div>if ball5 &gt;7 and ball5&lt;15 then ball5grp=2;<\/div>\r\n<div>if ball5 &gt;14 and ball5&lt;22 then ball5grp=3;<\/div>\r\n<div>if ball5 &gt;21 and ball5&lt;29 then ball5grp=4;<\/div>\r\n<div>if ball5 &gt;28 and ball5&lt;36 then ball5grp=5;<\/div>\r\n<div>if ball5 &gt;35 and ball5&lt;43 then ball5grp=6;<\/div>\r\n<div>if ball5 &gt;42 and ball5&lt;50 then ball5grp=7;<\/div>\r\n<div>end; call streaminit(68);<\/div>\r\n<div>do until (ball6 ne ball5 and ball6 ne ball4 and ball6 ne ball3 and ball6 ne ball2 and ball6 ne ball1);<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball6 = RAND(\"normal\")*1000000000000;<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball6 = ROUND(ball6);<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball6 = 1+(mod(ball6,49));<\/div>\r\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball6 = ABS(ball6);<\/div>\r\n<div>\u00a0 \u00a0 if ball6 = 0 then ball6 = 1;<\/div>\r\n<div>if ball6 &gt;0 and ball6&lt;8 then ball6grp=1;<\/div>\r\n<div>if ball6 &gt;7 and ball6&lt;15 then ball6grp=2;<\/div>\r\n<div>if ball6 &gt;14 and ball6&lt;22 then ball6grp=3;<\/div>\r\n<div>if ball6 &gt;21 and ball6&lt;29 then ball6grp=4;<\/div>\r\n<div>if ball6 &gt;28 and ball6&lt;36 then ball6grp=5;<\/div>\r\n<div>if ball6 &gt;35 and ball6&lt;43 then ball6grp=6;<\/div>\r\n<div>if ball6 &gt;42 and ball6&lt;50 then ball6grp=7;<\/div>\r\n<div>end;output; end;<\/div>\r\n<div><\/div>\r\n<div>run;<\/div>\r\n<div>proc freq; tables ball1grp ball2grp<\/div>\r\n<div>ball3grp ball4grp ball5grp ball6grp;<\/div>\r\n<div>FORMAT ball1grp -- ball6grp GRPFMT. ;run;<\/div>\r\n<div><\/div>\r\n<div><\/div>\r\n<div><\/div>\r\n<div>\/* CALCULATE CHI SQUARE GOODNESS OF FIT<\/div>\r\n<div><\/div>\r\n<div>PROC FREQ;<\/div>\r\n<div>TABLES ball1grp\/CHISQ;<\/div>\r\n<div>FORMAT ball1grp GRPFMT. ;<\/div>\r\n<div>TITLE 'CALCULATING THE GOODNESS OF FIT FOR ball1grp';<\/div>\r\n<div>RUN; *\/<\/div>\r\n<div>\/* Define the axis characteristics *\/<\/div>\r\n<div>\u00a0 \u00a0axis1 offset=(0,50) minor=none;<\/div>\r\n<div>\u00a0 \u00a0pattern1 value=solid color=cx7c95ca;<\/div>\r\n<div><\/div>\r\n<div>proc sort; by ball1;<\/div>\r\n<div>proc gchart ;<\/div>\r\n<div>\u00a0 \u00a0 \u00a0Hbar ball1grp \/\u00a0 TYPE=PERCENT<\/div>\r\n<div>\u00a0 \u00a0 \u00a0discrete ;<\/div>\r\n<div>\u00a0 \u00a0 \u00a0FORMAT ball1grp\u00a0 GRPFMT. ;run;<\/div>\r\n<div><\/div>\r\n<div>\/* Define the title *\/<\/div>\r\n<div>TITLE 'FREQUENCY DISTRIBUTION FOR OUTCOME GROUPS FOR BALL1';<\/div>\r\n<div>\u00a0 \u00a0run;<\/div>\r\n<\/div>\r\n<\/div>\r\n<div>\r\n\r\nA sample of the output from this procedure is shown below:\r\n<div id=\"IDX\" class=\"proc_title_group\">\r\n<p class=\"c proctitle\">The HORIZONTAL BARCHART WITH FREQ TABLE<\/p>\r\n\r\n<\/div>\r\n<section><article aria-label=\"One-Way Frequencies\"><\/article><\/section><section id=\"IDX1\"><article aria-label=\"One-Way Frequencies\"><img src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/BALLGRP1.png\" alt=\"\" width=\"783\" height=\"426\" class=\"aligncenter size-full wp-image-1821\" \/><\/article><\/section><section id=\"IDX2\"><article aria-label=\"One-Way Frequencies\"><\/article><\/section>\r\n<div><\/div>\r\n<\/div>\r\n\r\n<hr \/>\r\n\r\n&nbsp;","rendered":"<div class=\"textbox textbox--learning-objectives\">\n<header class=\"textbox__header\">\n<table class=\"aligncenter\" style=\"border-collapse: collapse\">\n<tbody>\n<tr>\n<td style=\"width: 100%\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"textbox__title\">Learner Outcomes<\/p>\n<\/header>\n<div class=\"textbox__content\">\n<p>After reading this chapter you should be able to:<\/p>\n<ul>\n<li>apply probabilistic approaches to compute the likelihood of outcomes<\/li>\n<li>recognize and apply the binomial probability formula<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<h2>1. Computing Bernoulli Trials<\/h2>\n<p>The rules of a Bernoulli trial are straight-forward. Given an independent process in which an outcome can be observed, the outcome can have only two possibilities and the chance or probability of the observed outcome is the same as the chance or probability of the non-observed outcome. \u00a0Hence the fair toss of a fair coin is an excellent demonstration of a Bernoulli trial, because, as we observe in the tossing of a fair coin, there are only two possible outcomes: a head or a tail.\u00a0 Likewise, the probability of tossing a head is equal to the probability of tossing a tail, and this probability is equal to 0.5 or one-half. Further, if the coin is fair and the toss or flip is fair \u2013 without any external influence, then we can say that the process was independent.<\/p>\n<p>When we are computing Bernoulli trials we often use the term <em>event<\/em> to refer to the process or test that we are conducting, and the outcome variable as the indicator variable. The outcome of an event in a Bernoulli trial is an element of the Bernoulli distribution, whereby the Bernoulli distribution is described as a discrete distribution with a possibility of one of two outcomes. The indicator variable sometimes referred to as a DUMMY variable or a BINARY variable, has two possible outcomes (success or failure).\u00a0 Further, when scoring the indicator variable we typically assign a value of 1 to the success and a value of 0 to the failure.<\/p>\n<p>The notation used to represent the outcome of a Bernoulli trial is [latex]X_{i}[\/latex], so that [latex]X_{1}[\/latex] refers to a single Bernoulli trial and[latex]X_{n}[\/latex] refers to <strong><em>n<\/em><\/strong> Bernoulli trials where <em><strong>n<\/strong><\/em> ranges from 1 to infinity. Further, the probability of success of an outcome in a Bernoulli trial is written as: ([latex]P(X_{i} =1)[\/latex] ) = p, while the probability of failure of an outcome in a Bernoulli trial is written as ([latex]P(X_{i} =0)[\/latex] ) = 1 \u2013 p.<\/p>\n<p>We can also use p and q to represent the outcome of a Bernoulli trial, where p is representative of the probability of success and q is representative of the probability of failure. The probability of p is assigned in a fair and independent event as p = 0.5, and the probability of q is assigned as (1 &#8211; p) = (1 &#8211; 0.5) = 0.5.<\/p>\n<p>In the following example, we can use SAS and a set of probability outcomes that range from 0 to 1 and are based on an interval of 0.025 to plot the variance of a Bernoulli trial. In this example, the outcome is based on the assumption that the mean [latex]X_{i}[\/latex] = p and the variance of [latex]X_{i}[\/latex] = p(1-p).<\/p>\n<p>The data set for this example will be based on[latex]X_{1}[\/latex] = p: 0.00, 0.025, 0.05, 0.075, 0.1, 0.125, 0.15, 0.175, 0.2, 0.225, 0.25, 0.275, 0.3, 0.325, 0.35, 0.375, 0.4, 0.425, 0.45, 0.475, 0.5, 0.525, 0.55, 0.575, 0.6, 0.625, 0.65, 0.675, 0.7, 0.725, 0.75, 0.775, 0.8, 0.825, 0.85, 0.875, 0.9, 0.925, 0.95, 0.975, 1<\/p>\n<p>These data are entered as follows:<\/p>\n<p>1 0.00<br \/>\n2 0.025<br \/>\n3 0.05<br \/>\n. \u00a0\u00a0.<br \/>\n. \u00a0\u00a0.<br \/>\n. \u00a0\u00a0.<br \/>\n39 0.95<br \/>\n40 0.975<br \/>\n41 1.00<\/p>\n<div class=\"textbox\">The SAS code to produce the variance [latex]\\color{dbeeff}\\rightarrow {varX_{1}}[\/latex]= p(1-p) based on these data is shown here.<\/div>\n<div class=\"textbox textbox--examples\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">SAS Program to compute variance of a Bernoulli Trial<\/p>\n<\/header>\n<div class=\"textbox__content\">\n<p>DATA BERNOULLI;<br \/>\nINPUT ID PROB_PI @@ ;<br \/>\nPROB_QI=(1-PROB_PI);<br \/>\nVARPQ=(PROB_PI * PROB_QI);<\/p>\n<p>DATALINES;<br \/>\n1 0.00 2 0.025 3 0.05 4 0.075 5 0.1 6 0.125 7 0.15<br \/>\n8 0.175 9 0.2 10 0.225 11 0.25 12 0.275 13 0.3<br \/>\n14 0.325 15 0.35 16 0.375 17 0.4 18 0.425 19 0.45<br \/>\n20 0.475 21 0.5 22 0.525 23 0.55 24 0.575 25 0.6<br \/>\n26 0.625 27 0.65 28 0.675 29 .7 30 0.725 31 0.75<br \/>\n32 0.775 33 0.8 34 0.825 35 0.85 36 0.875 37 0.9<br \/>\n38 0.925 39 0.95 40 0.975 41 1<br \/>\n;<br \/>\nPROC SGPLOT;<br \/>\nSERIES X=PROB_PI Y=VARPQ;<br \/>\n* XAXIS TYPE = DISCRETE;<br \/>\nTITLE1 &#8220;GRAPHICAL PRESENTATION OF THE VARIANCE OF (P * Q) USING SGPLOT &#8220;;<\/p>\n<p>RUN;<br \/>\nPROC PRINT;<br \/>\nVAR PROB_PI PROB_QI VARPQ;<br \/>\nTITLE1 &#8216;PRINT OF DATA FOR COMPLETE BERNOULLI TRIAL&#8217;;<br \/>\nRUN;<\/p>\n<\/div>\n<\/div>\n<p>The SAS statements: proc SGPLOT \u00a0and PLOT varpq*prob_pi produced the following graph which shows the distribution of variance across all estimates of [latex]p_{success}[\/latex] and [latex]q_{failures}[\/latex] from 0.00 to 1.00.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/var_pq.png\" alt=\"\" class=\"aligncenter size-full wp-image-1707\" width=\"640\" height=\"480\" srcset=\"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/var_pq.png 640w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/var_pq-300x225.png 300w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/var_pq-65x49.png 65w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/var_pq-225x169.png 225w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/var_pq-350x263.png 350w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>With the PROC PRINT statement, we can produce a complete listing of the data set for probabilities of success (<strong>[latex]p_{i}[\/latex]<\/strong>) and the probability of failures (<strong>[latex]q_{i}[\/latex]<\/strong> along with the variance of the success and failures (variance of p*q). These results are shown in the 22.1 below.<\/p>\n<div><\/div>\n<div style=\"text-align: center\">Table 22.1 Discrete Probability Distribution of the Bernouli Trial for all possible outcomes for the data set [latex]X_{i}[\/latex] where i = 0 to 41.<\/div>\n<div>\n<table class=\"aligncenter\">\n<thead>\n<tr>\n<td><strong>Obs(i)<\/strong><\/td>\n<td><strong>[latex]p_{i}[\/latex]<\/strong><\/td>\n<td><strong>[latex]q_{i}[\/latex]<\/strong><\/td>\n<td><strong>variance of p*q<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>1<\/strong><\/td>\n<td>0.000<\/td>\n<td>1.000<\/td>\n<td>0.00000<\/td>\n<\/tr>\n<tr>\n<td><strong>2<\/strong><\/td>\n<td>0.025<\/td>\n<td>0.975<\/td>\n<td>0.02438<\/td>\n<\/tr>\n<tr>\n<td><strong>3<\/strong><\/td>\n<td>0.050<\/td>\n<td>0.950<\/td>\n<td>0.04750<\/td>\n<\/tr>\n<tr>\n<td><strong>4<\/strong><\/td>\n<td>0.075<\/td>\n<td>0.925<\/td>\n<td>0.06938<\/td>\n<\/tr>\n<tr>\n<td><strong>5<\/strong><\/td>\n<td>0.100<\/td>\n<td>0.900<\/td>\n<td>0.09000<\/td>\n<\/tr>\n<tr>\n<td><strong>6<\/strong><\/td>\n<td>0.125<\/td>\n<td>0.875<\/td>\n<td>0.10938<\/td>\n<\/tr>\n<tr>\n<td><strong>7<\/strong><\/td>\n<td>0.150<\/td>\n<td>0.850<\/td>\n<td>0.12750<\/td>\n<\/tr>\n<tr>\n<td><strong>8<\/strong><\/td>\n<td>0.175<\/td>\n<td>0.825<\/td>\n<td>0.14438<\/td>\n<\/tr>\n<tr>\n<td><strong>9<\/strong><\/td>\n<td>0.200<\/td>\n<td>0.800<\/td>\n<td>0.16000<\/td>\n<\/tr>\n<tr>\n<td><strong>10<\/strong><\/td>\n<td>0.225<\/td>\n<td>0.775<\/td>\n<td>0.17438<\/td>\n<\/tr>\n<tr>\n<td><strong>11<\/strong><\/td>\n<td>0.250<\/td>\n<td>0.750<\/td>\n<td>0.18750<\/td>\n<\/tr>\n<tr>\n<td><strong>12<\/strong><\/td>\n<td>0.275<\/td>\n<td>0.725<\/td>\n<td>0.19938<\/td>\n<\/tr>\n<tr>\n<td><strong>13<\/strong><\/td>\n<td>0.300<\/td>\n<td>0.700<\/td>\n<td>0.21000<\/td>\n<\/tr>\n<tr>\n<td><strong>14<\/strong><\/td>\n<td>0.325<\/td>\n<td>0.675<\/td>\n<td>0.21938<\/td>\n<\/tr>\n<tr>\n<td><strong>15<\/strong><\/td>\n<td>0.350<\/td>\n<td>0.650<\/td>\n<td>0.22750<\/td>\n<\/tr>\n<tr>\n<td><strong>16<\/strong><\/td>\n<td>0.375<\/td>\n<td>0.625<\/td>\n<td>0.23438<\/td>\n<\/tr>\n<tr>\n<td><strong>17<\/strong><\/td>\n<td>0.400<\/td>\n<td>0.600<\/td>\n<td>0.24000<\/td>\n<\/tr>\n<tr>\n<td><strong>18<\/strong><\/td>\n<td>0.425<\/td>\n<td>0.575<\/td>\n<td>0.24438<\/td>\n<\/tr>\n<tr>\n<td><strong>19<\/strong><\/td>\n<td>0.450<\/td>\n<td>0.550<\/td>\n<td>0.24750<\/td>\n<\/tr>\n<tr>\n<td><strong>20<\/strong><\/td>\n<td>0.475<\/td>\n<td>0.525<\/td>\n<td>0.24938<\/td>\n<\/tr>\n<tr>\n<td><strong>21<\/strong><\/td>\n<td>0.500<\/td>\n<td>0.500<\/td>\n<td>0.25000<\/td>\n<\/tr>\n<tr>\n<td><strong>22<\/strong><\/td>\n<td>0.525<\/td>\n<td>0.475<\/td>\n<td>0.24938<\/td>\n<\/tr>\n<tr>\n<td><strong>23<\/strong><\/td>\n<td>0.550<\/td>\n<td>0.450<\/td>\n<td>0.24750<\/td>\n<\/tr>\n<tr>\n<td><strong>24<\/strong><\/td>\n<td>0.575<\/td>\n<td>0.425<\/td>\n<td>0.24438<\/td>\n<\/tr>\n<tr>\n<td><strong>25<\/strong><\/td>\n<td>0.600<\/td>\n<td>0.400<\/td>\n<td>0.24000<\/td>\n<\/tr>\n<tr>\n<td><strong>26<\/strong><\/td>\n<td>0.625<\/td>\n<td>0.375<\/td>\n<td>0.23438<\/td>\n<\/tr>\n<tr>\n<td><strong>27<\/strong><\/td>\n<td>0.650<\/td>\n<td>0.350<\/td>\n<td>0.22750<\/td>\n<\/tr>\n<tr>\n<td><strong>28<\/strong><\/td>\n<td>0.675<\/td>\n<td>0.325<\/td>\n<td>0.21938<\/td>\n<\/tr>\n<tr>\n<td><strong>29<\/strong><\/td>\n<td>0.700<\/td>\n<td>0.300<\/td>\n<td>0.21000<\/td>\n<\/tr>\n<tr>\n<td><strong>30<\/strong><\/td>\n<td>0.725<\/td>\n<td>0.275<\/td>\n<td>0.19938<\/td>\n<\/tr>\n<tr>\n<td><strong>31<\/strong><\/td>\n<td>0.750<\/td>\n<td>0.250<\/td>\n<td>0.18750<\/td>\n<\/tr>\n<tr>\n<td><strong>32<\/strong><\/td>\n<td>0.775<\/td>\n<td>0.225<\/td>\n<td>0.17438<\/td>\n<\/tr>\n<tr>\n<td><strong>33<\/strong><\/td>\n<td>0.800<\/td>\n<td>0.200<\/td>\n<td>0.16000<\/td>\n<\/tr>\n<tr>\n<td><strong>34<\/strong><\/td>\n<td>0.825<\/td>\n<td>0.175<\/td>\n<td>0.14438<\/td>\n<\/tr>\n<tr>\n<td><strong>35<\/strong><\/td>\n<td>0.850<\/td>\n<td>0.150<\/td>\n<td>0.12750<\/td>\n<\/tr>\n<tr>\n<td><strong>36<\/strong><\/td>\n<td>0.875<\/td>\n<td>0.125<\/td>\n<td>0.10938<\/td>\n<\/tr>\n<tr>\n<td><strong>37<\/strong><\/td>\n<td>0.900<\/td>\n<td>0.100<\/td>\n<td>0.09000<\/td>\n<\/tr>\n<tr>\n<td><strong>38<\/strong><\/td>\n<td>0.925<\/td>\n<td>0.075<\/td>\n<td>0.06937<\/td>\n<\/tr>\n<tr>\n<td><strong>39<\/strong><\/td>\n<td>0.950<\/td>\n<td>0.050<\/td>\n<td>0.04750<\/td>\n<\/tr>\n<tr>\n<td><strong>40<\/strong><\/td>\n<td>0.975<\/td>\n<td>0.025<\/td>\n<td>0.02438<\/td>\n<\/tr>\n<tr>\n<td><strong>41<\/strong><\/td>\n<td>1.000<\/td>\n<td>0.000<\/td>\n<td>0.00000<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<p>The proc freq procedure produced a complete frequency distribution independently for each of the variables: prob_pi , prob_qi ,\u00a0 and varpq.<\/p>\n<p>The output shown below is identical for the frequency distributions of the variables prob_pi and prob_qi. Therefore, only the data for prob_pi is shown here.<\/p>\n<\/div>\n<div>\n<div style=\"margin: auto;\">\n<table>\n<thead>\n<tr>\n<td><strong>prob_pi<\/strong><\/td>\n<td><strong>Freq<\/strong><\/td>\n<td><strong>PCT<\/strong><\/td>\n<td><strong>Cumulative<br \/>\nFrequency<\/strong><\/td>\n<td><strong>Cumulative<br \/>\nPercent<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>0<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<\/tr>\n<tr>\n<td>0.025<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<\/tr>\n<tr>\n<td>0.05<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>3<\/td>\n<td>7.32<\/td>\n<\/tr>\n<tr>\n<td>0.075<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>4<\/td>\n<td>9.76<\/td>\n<\/tr>\n<tr>\n<td>0.1<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>5<\/td>\n<td>12.20<\/td>\n<\/tr>\n<tr>\n<td>0.125<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>6<\/td>\n<td>14.63<\/td>\n<\/tr>\n<tr>\n<td>0.15<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>7<\/td>\n<td>17.07<\/td>\n<\/tr>\n<tr>\n<td>0.175<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>8<\/td>\n<td>19.51<\/td>\n<\/tr>\n<tr>\n<td>0.2<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>9<\/td>\n<td>21.95<\/td>\n<\/tr>\n<tr>\n<td>0.225<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>10<\/td>\n<td>24.39<\/td>\n<\/tr>\n<tr>\n<td>0.25<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>11<\/td>\n<td>26.83<\/td>\n<\/tr>\n<tr>\n<td>0.275<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>12<\/td>\n<td>29.27<\/td>\n<\/tr>\n<tr>\n<td>0.3<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>13<\/td>\n<td>31.71<\/td>\n<\/tr>\n<tr>\n<td>0.325<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>14<\/td>\n<td>34.15<\/td>\n<\/tr>\n<tr>\n<td>0.35<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>15<\/td>\n<td>36.59<\/td>\n<\/tr>\n<tr>\n<td>0.375<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>16<\/td>\n<td>39.02<\/td>\n<\/tr>\n<tr>\n<td>0.4<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>17<\/td>\n<td>41.46<\/td>\n<\/tr>\n<tr>\n<td>0.425<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>18<\/td>\n<td>43.90<\/td>\n<\/tr>\n<tr>\n<td>0.45<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>19<\/td>\n<td>46.34<\/td>\n<\/tr>\n<tr>\n<td>0.475<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>20<\/td>\n<td>48.78<\/td>\n<\/tr>\n<tr>\n<td>0.5<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>21<\/td>\n<td>51.22<\/td>\n<\/tr>\n<tr>\n<td>0.525<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>22<\/td>\n<td>53.66<\/td>\n<\/tr>\n<tr>\n<td>0.55<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>23<\/td>\n<td>56.10<\/td>\n<\/tr>\n<tr>\n<td>0.575<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>24<\/td>\n<td>58.54<\/td>\n<\/tr>\n<tr>\n<td>0.6<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>25<\/td>\n<td>60.98<\/td>\n<\/tr>\n<tr>\n<td>0.625<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>26<\/td>\n<td>63.41<\/td>\n<\/tr>\n<tr>\n<td>0.65<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>27<\/td>\n<td>65.85<\/td>\n<\/tr>\n<tr>\n<td>0.675<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>28<\/td>\n<td>68.29<\/td>\n<\/tr>\n<tr>\n<td>0.7<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>29<\/td>\n<td>70.73<\/td>\n<\/tr>\n<tr>\n<td>0.725<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>30<\/td>\n<td>73.17<\/td>\n<\/tr>\n<tr>\n<td>0.75<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>31<\/td>\n<td>75.61<\/td>\n<\/tr>\n<tr>\n<td>0.775<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>32<\/td>\n<td>78.05<\/td>\n<\/tr>\n<tr>\n<td>0.8<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>33<\/td>\n<td>80.49<\/td>\n<\/tr>\n<tr>\n<td>0.825<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>34<\/td>\n<td>82.93<\/td>\n<\/tr>\n<tr>\n<td>0.85<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>35<\/td>\n<td>85.37<\/td>\n<\/tr>\n<tr>\n<td>0.875<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>36<\/td>\n<td>87.80<\/td>\n<\/tr>\n<tr>\n<td>0.9<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>37<\/td>\n<td>90.24<\/td>\n<\/tr>\n<tr>\n<td>0.925<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>38<\/td>\n<td>92.68<\/td>\n<\/tr>\n<tr>\n<td>0.95<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>39<\/td>\n<td>95.12<\/td>\n<\/tr>\n<tr>\n<td>0.975<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>40<\/td>\n<td>97.56<\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>41<\/td>\n<td>100.00<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<div>\n<p>However, the frequency distribution for var(PQ) is unique and is shown here.<\/p>\n<\/div>\n<div>\n<table class=\"aligncenter\">\n<thead>\n<tr>\n<td><strong>Var(p*q)<\/strong><\/td>\n<td><strong>Frequency<\/strong><\/td>\n<td><strong>PCT<\/strong><\/td>\n<td><strong>Cumulative<br \/>\nFrequency<\/strong><\/td>\n<td><strong>Cumulative<br \/>\nPercent<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>0<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<\/tr>\n<tr>\n<td><strong>0.024<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>4<\/td>\n<td>9.76<\/td>\n<\/tr>\n<tr>\n<td><strong>0.048<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>6<\/td>\n<td>14.63<\/td>\n<\/tr>\n<tr>\n<td><strong>0.069<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>8<\/td>\n<td>19.51<\/td>\n<\/tr>\n<tr>\n<td><strong>0.09<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>10<\/td>\n<td>24.39<\/td>\n<\/tr>\n<tr>\n<td><strong>0.109<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>12<\/td>\n<td>29.27<\/td>\n<\/tr>\n<tr>\n<td><strong>0.128<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>14<\/td>\n<td>34.15<\/td>\n<\/tr>\n<tr>\n<td><strong>0.144<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>16<\/td>\n<td>39.02<\/td>\n<\/tr>\n<tr>\n<td><strong>0.16<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>18<\/td>\n<td>43.90<\/td>\n<\/tr>\n<tr>\n<td><strong>0.174<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>20<\/td>\n<td>48.78<\/td>\n<\/tr>\n<tr>\n<td><strong>0.188<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>22<\/td>\n<td>53.66<\/td>\n<\/tr>\n<tr>\n<td><strong>0.199<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>24<\/td>\n<td>58.54<\/td>\n<\/tr>\n<tr>\n<td><strong>0.21<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>26<\/td>\n<td>63.41<\/td>\n<\/tr>\n<tr>\n<td><strong>0.219<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>28<\/td>\n<td>68.29<\/td>\n<\/tr>\n<tr>\n<td><strong>0.228<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>30<\/td>\n<td>73.17<\/td>\n<\/tr>\n<tr>\n<td><strong>0.375<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>32<\/td>\n<td>78.05<\/td>\n<\/tr>\n<tr>\n<td><strong>0.24<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>34<\/td>\n<td>82.93<\/td>\n<\/tr>\n<tr>\n<td><strong>0.244<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>36<\/td>\n<td>87.80<\/td>\n<\/tr>\n<tr>\n<td><strong>0.248<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>38<\/td>\n<td>92.68<\/td>\n<\/tr>\n<tr>\n<td><strong>0.249<\/strong><\/td>\n<td>2<\/td>\n<td>4.88<\/td>\n<td>40<\/td>\n<td>97.56<\/td>\n<\/tr>\n<tr>\n<td><strong>0.25<\/strong><\/td>\n<td>1<\/td>\n<td>2.44<\/td>\n<td>41<\/td>\n<td>100.00<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<h2>2. The Coin Toss That Might Mean Something<\/h2>\n<p>The American Football league\u2019s national championship: the Super Bowl begins with a coin toss. At the start of the game, the captain\u2019s of each team meet in the centre of the field to toss a coin to determine which one of the teams will start the game as the kicking team and which team will start the game as the receiving team. Since the outcome of either kicking the ball to the opposing team to start the game or receiving the ball from the opposing team to start the game may have consequences on the final score, there is an attempt to make this decision an unbiased and fair process.\u00a0 The National Football League has chosen to render this decision to a Bernoulli trial.<\/p>\n<p>Considering that a fair toss of a fair coin has a 50% chance of turning up heads and a 50% chance of turning up tails then the use of a coin toss to determine outcomes is a good approach.<\/p>\n<h3>The Binomial Formula establishes the probability using the following formula:<\/h3>\n<p style=\"text-align: center\">[latex]P_{x} = \\frac{n!}{x!(n-x)!} \\times p^{x} q^{n-x}[\/latex]<\/p>\n<h3>The elements of this probability prediction formula are explained as follows:<\/h3>\n<h5>[latex]P_{x} =[\/latex] the probability of exactly <em>x<\/em> events of a given outcome appearing in<strong> <em>n<\/em> trials.<\/strong><\/h5>\n<h5>p = the probability of an event on any given trial (if we are flipping a coin then this value is \u00bd with a fair coin).<\/h5>\n<p><em>q<\/em> = the probability of an event on any given trial <em>q =\u00a0 1- p <\/em>(usually this value is \u00bd if we were flipping a coin).<br \/>\n<em>n<\/em> = the number of events.<\/p>\n<p><em>x<\/em> = the number of a given outcome (e.g. heads) being evaluated.<\/p>\n<hr \/>\n<div>Consider an example for the Probabilities associated with tossing a fair coin<\/div>\n<p>The coin tossing exercise is a useful way of demonstrating the probability of an outcome within a given set of trials when the expected chance of an outcome is fixed (known) or expected. For example, if we have a <em>&#8220;fair&#8221;<\/em> coin then the expected probability or chance of tossing a given outcome (i.e. heads) is 0.5 or \u00bd. Therefore, given ten tosses of the fair coin we could predict the number of times we should expect to see the outcome as heads or tails.<\/p>\n<p>In other words, to compute the proportion of outcomes observed we can predict the chance that an outcome or event will occur.<\/p>\n<p>In the following example, we can determine the probability associated with flipping a &#8220;head&#8221; four times in ten tosses of a fair coin. That is, if we flip a fair coin ten times then we could predict the number of times we should expect to see &#8220;heads&#8221; appear in four of the ten flips.<\/p>\n<p>The formula used to resolve this question is the binomial and is worked through as follows. Let x=4 (the number of heads), n=10 (the number of throws), and P=probability of 4 heads in 10 throws, where <em>p<\/em> is the starting probability and <em>q<\/em> is 1 &#8211; <em>p<\/em>. We begin with the binomial formula:<\/p>\n<p style=\"text-align: center\">[latex]P_{x} = \\frac{n!}{x!(n-x)!} \\times p^{x} q^{n-x}[\/latex]<\/p>\n<p>Step 1: [latex]P_{4} = \\frac{10!}{4!(10-4)!} \\times (0.5)^{4} (0.5)^{10-4}[\/latex]<\/p>\n<p>Step 2: [latex]P_{4} =[\/latex][latex]({10*9*8*7*6*5*4*3*2*1})\\over({4*3*2*1}) \\times ({6*5*4*3*2*1})[\/latex][latex]\\times (\\frac{1}{2})^{4+6}[\/latex]<\/p>\n<p>Step 3: [latex]P_{4} =[\/latex][latex]({10*9*8*7} \\times{\\enclose{horizontalstrike}{6*5*4*3*2*1}}) \\over({4*3*2*1}) \\times {\\enclose{horizontalstrike}{6*5*4*3*2*1}})[\/latex][latex]\\times (\\frac{1}{2})^{10}[\/latex]<\/p>\n<p>Step 4: [latex]P_{4} ={5040 \\over{24} } \\times {(1)^{10} \\over (2)^{10} }[\/latex]<\/p>\n<p>Step 5: [latex]P_{4} ={210\\times{1\\over{1024} }}[\/latex]<\/p>\n<p>Step 6: [latex]P_{4} ={210\\over{1024} }[\/latex] = <span style=\"background-color: #ffff00\"><strong>0.206<\/strong><\/span><\/p>\n<p>The calculation table above shows us that in ten tosses of a fair coin there is roughly a 20 percent chance of tossing 4 heads. Further, we can use the binomial formula to compute all possible outcomes for a given series of events when we establish the beforehand (a priori) probability of an outcome in a defined set.<\/p>\n<p>For example, let\u2019s use the binomial to compute all possible outcomes for ten tosses of a fair coin.\u00a0 That is, how many times in 10 tosses would 0 heads appear? Likewise, how many times in 10 tosses would 1 through to 10 heads appear?<\/p>\n<p>After working through each application of the binomial equation we could create a table of all possible events in the outcome space.\u00a0 This table is referred to as the Probability Density Chart, and is shown below.<\/p>\n<p>The Probability Density Chart for the outcome space when determining the likelihood of tossing a head in 10 tosses of a fair coin<\/p>\n<p>(x = number of a given outcome; <em>p<\/em> = \u00bd\u00a0 and <em>q<\/em> = 1 &#8211; <em>p<\/em>= \u00bd)<\/p>\n<\/div>\n<table>\n<tfoot>\n<tr class=\"shaded\">\n<td style=\"text-align: center\">SUM<\/td>\n<td style=\"text-align: center\">1024:1024<\/td>\n<td style=\"text-align: center\">1.00<\/td>\n<\/tr>\n<\/tfoot>\n<thead>\n<tr class=\"shaded\">\n<td style=\"text-align: center\">x<\/td>\n<td style=\"text-align: center\">The probability expressed as a ratio<\/td>\n<td style=\"text-align: center\">The probability expressed as a decimal<\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr class=\"border\">\n<td style=\"text-align: center\">0<\/td>\n<td style=\"text-align: center\">1:1024<\/td>\n<td style=\"text-align: center\">0.0009765<\/td>\n<\/tr>\n<tr class=\"border\">\n<td style=\"text-align: center\">1<\/td>\n<td style=\"text-align: center\">10:1024<\/td>\n<td style=\"text-align: center\">0.0097656<\/td>\n<\/tr>\n<tr class=\"border\">\n<td style=\"text-align: center\">2<\/td>\n<td style=\"text-align: center\">45:1024<\/td>\n<td style=\"text-align: center\">0.0439453<\/td>\n<\/tr>\n<tr class=\"border\">\n<td style=\"text-align: center\">3<\/td>\n<td style=\"text-align: center\">120:1024<\/td>\n<td style=\"text-align: center\">0.1171875<\/td>\n<\/tr>\n<tr class=\"border\">\n<td style=\"text-align: center\">4<\/td>\n<td style=\"text-align: center\">210:1024<\/td>\n<td style=\"text-align: center\">0.2050781<\/td>\n<\/tr>\n<tr class=\"border\">\n<td style=\"text-align: center\">5<\/td>\n<td style=\"text-align: center\">252:1024<\/td>\n<td style=\"text-align: center\">0.2460937<\/td>\n<\/tr>\n<tr class=\"border\">\n<td style=\"text-align: center\">6<\/td>\n<td style=\"text-align: center\">210:1024<\/td>\n<td style=\"text-align: center\">0.2050781<\/td>\n<\/tr>\n<tr class=\"border\">\n<td style=\"text-align: center\">7<\/td>\n<td style=\"text-align: center\">120:1024<\/td>\n<td style=\"text-align: center\">0.1171875<\/td>\n<\/tr>\n<tr class=\"border\">\n<td style=\"text-align: center\">8<\/td>\n<td style=\"text-align: center\">45:1024<\/td>\n<td style=\"text-align: center\">0.0439453<\/td>\n<\/tr>\n<tr class=\"border\">\n<td style=\"text-align: center\">9<\/td>\n<td style=\"text-align: center\">10:1024<\/td>\n<td style=\"text-align: center\">0.0097656<\/td>\n<\/tr>\n<tr class=\"border\">\n<td style=\"text-align: center\">10<\/td>\n<td style=\"text-align: center\">1:1024<\/td>\n<td style=\"text-align: center\">0.0009765<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>3. Patients as Coins &#8211; An Application of the Coin Toss<\/h2>\n<p>We can use the example of tossing a fair coin as a proxy for estimating the likelihood of identifying individuals to develop health conditions.<\/p>\n<p>For example, consider the hypothetical situation where it is suspected that families within certain rural environments may be exposed to carcinogenic compounds in their drinking water as a result of run-off from farm fields into their wells. Let\u2019s start with the following scenario in which you are asked, \u201cWhat is the likelihood of observing 15 blood screens that test positive for a given carcinogenic substance in blood samples drawn from 25 mothers attending a prenatal health program?\u201d<\/p>\n<p>To compute the likelihood of observing 15 positive blood screens for the 25 mothers sampled, we decide to use the binomial formula with the following elements. Since we observed 15 positive cases then the term [latex]P_{x}[\/latex] refers to the probability of observing this outcome in the 25 mothers, where <strong>x=15\u00a0<\/strong> and <strong>n=25<\/strong>.<\/p>\n<h5 style=\"text-align: center\">[latex]P_{x} = \\frac{n!}{x!(n-x)!} \\times p^{x} q^{n-x}[\/latex]<\/h5>\n<h5 style=\"text-align: center\">Step 1: [latex]P_{15} = \\frac{25!}{15!(25-15)!} \\times {\\left({1\\over{2} }\\right)^{15}}{\\left({1\\over{2} }\\right)^{25-15}}[\/latex]<\/h5>\n<h5 style=\"text-align: center\">Step 2: [latex]P_{15} = \\frac{25!}{15!\\times(10!)} \\times {\\left({1\\over{2} }\\right)^{15+10}}[\/latex]<\/h5>\n<p>While this formula looks neat in the arrangement of terms it can become quite unwieldy quickly because we are multiplying and dividing such large numbers. Note the term (n!) is 25! which indicates that we use a series of multiplication steps that are (n * (n-1)) repeatedly until we converge to (2 * (2-1)). Given that we include factorials in the numerator and the denominator our challenge is to organize all of the operations while respecting the BEDMAS principle and arriving at the appropriate solution to the formula. While we can do this with a handheld calculator it is so much easier to simply write a program to analyze this scenario using the following SAS code:<\/p>\n<div>\n<div class=\"textbox textbox--examples\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">Use SAS to do the work in our computations of probability to identify individuals to develop health conditions.<\/p>\n<\/header>\n<div class=\"textbox__content\">DATA BERN2;<br \/>\n\/* create the variable to represent the numerator (n!) *\/<br \/>\nNUM1 = FACT(25);\/* create the variable to represent the denominator (x!(n-x)!) *\/<br \/>\nDEN1= (FACT(15)*FACT(10));\/* notice in the statements above, the function to produce a factorial of a number is FACT(#), as in FACT(25) will produce the factorial of the number 25. *\/\/* create the variable to represent the first fraction\u00a0 *\/<br \/>\nFRACTION1= NUM1 \/ DEN1;\/* create variable to represent the combined probability estimates, then include PUT statement to use the outcome in the subsequent calculations *\/<br \/>\nPQ1= (0.5)**25; PUT PQ1;\/* variable to represent the expected outcome *\/<br \/>\nANSWER1 = (FRACTION1 * PQ1);<br \/>\nRUN;\/* print the important variables *\/<br \/>\nPROC PRINT; VAR\u00a0 NUM1 DEN1 FRACTION1 PQ1 ANSWER1;<br \/>\nRUN;<\/div>\n<\/div>\n<\/div>\n<p>The SAS code above produced the following table of results.<\/p>\n<table class=\"table\" aria-label=\"Data Set WORK.BERNOULLI\">\n<caption aria-label=\"Data Set WORK.BERNOULLI\">\u00a0<\/caption>\n<colgroup>\n<col \/><\/colgroup>\n<colgroup>\n<col \/>\n<col \/>\n<col \/>\n<col \/>\n<col \/><\/colgroup>\n<tbody>\n<tr style=\"background-color: #dbeeff;\">\n<th class=\"r rowheader\" scope=\"row\">1<\/th>\n<td class=\"r data\">1.5511_E25<\/td>\n<td class=\"r data\">4.7453_E18<\/td>\n<td class=\"r data\">3268760<\/td>\n<td class=\"r data\">2.9802_E-8<\/td>\n<td class=\"r data\">0.097417<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Let&#8217;s walk through this SAS Output to explain each of the parts of the exercise in calculating the probability of identifying 15 Cases from a sample of 25 women visiting the health clinic. The following elements of the Bernoulli equation (binomial equation) were computed with the SAS program above.<\/p>\n<p>(i) The Numerator term is:<strong>[latex]\\color{#330099}(n!)[\/latex] <\/strong><\/p>\n<div style=\"margin: auto;\">\n<table>\n<tbody>\n<tr>\n<td>1.5511(E25) [latex]\\rightarrow[\/latex] reminds us to add 21 trailing zeros and move the decimal place to the right by 25 spaces, since E25 refers to 1.5511 times ten to the twenty-fifth power<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>(ii) The Denominator term is:<strong>[latex]\\color{#330099}(x!)\\times(n-x)![\/latex] <\/strong><\/p>\n<div style=\"margin: auto;\">\n<table>\n<tbody>\n<tr>\n<td>4.7453(E18) [latex]\\rightarrow[\/latex]add 13 leading zeros since E18 refers to 4.7453 times ten to the eighteenth power<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>(iii) The fraction of <strong>[latex]\\color{#330099}\\frac{(n!)}{(x!)\\times(n-x)! }[\/latex] is: <\/strong><\/p>\n<div style=\"margin: auto;\">\n<table>\n<tbody>\n<tr style=\"background-color: #dbeeff;\">\n<td><strong>[latex]{\\textit{1.5511(E25)}\\over{\\textit{4.7453(E18)}}} = 3,268,760[\/latex]<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>(iv) The unbiased expected probability terms [latex]p^x q^{n-x}[\/latex]\u00a0are:<\/p>\n<div style=\"margin: auto;\">\n<table>\n<thead>\n<tr style=\"background-color: #dbeeff;\">\n<td>[latex]{\\left({1\\over{2} }\\right)^{15+10}}[\/latex]<\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>2.98 E-8 which represents 0.0000000298 because E with a &#8211; sign indicates the number by which we move the decimal to the left of the whole number and add leading zeros (0)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>(v) The resulting probability expressed in terms of a percentage:<\/p>\n<div style=\"margin: auto;\">\n<table>\n<thead>\n<tr style=\"background-color: #dbeeff;\">\n<td>[latex]P_{15}\\rvert (N=25)[\/latex]<\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>0.097 can be expressed as 10%<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>In example 1, we found that there was a 10% chance of observing 15 positive screens for the suspected carcinogen in the sample of 25 women attending the prenatal class.<\/p>\n<hr \/>\n<p>What is the likelihood of identifying 5 positive cases for the suspected carcinogen in a sample of 50 women selected at random from the corresponding urban environment?<\/p>\n<p>The SAS code to resolve this question is:<\/p>\n<p>DATA BERN3;<br \/>\nEX2A= FACT(50); EX2B= ((FACT(5)*FACT(45)));<br \/>\nEX2C= EX2A\/EX2B; EX2D = (0.5)**50; EX2E = EX2C * EX2D;<br \/>\nRUN;<br \/>\nPROC PRINT; VAR EX2A EX2B EX2C EX2D EX2E ;<br \/>\nRUN;<\/p>\n<p>The SAS code produced the following output:<\/p>\n<div style=\"margin: auto;\">\n<table>\n<thead>\n<tr style=\"background-color: #dbeeff;\">\n<td style=\"width: 30%;\">Numerator<br \/>\n[latex](50!)= 50 \\times 49 \\times 48 \\times ... \\times 2 \\times 1[\/latex]<\/td>\n<td style=\"width: 15%;\">Denominator<br \/>\n[latex](5!) \\times (45!)[\/latex]<\/td>\n<td style=\"width: 15%;\">[latex]{Numerator}\\over{Denominator}[\/latex]<\/td>\n<td style=\"width: 20%;\">[latex]{\\left({1\\over{2} }\\right)^{5+45}}[\/latex]<\/td>\n<td style=\"width: 20%;\">[latex]P_{5}\\rvert (N=50)[\/latex]<\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>3.0414E64<\/td>\n<td>1.4355E58<\/td>\n<td>2118760<\/td>\n<td>8.8818E-16<\/td>\n<td>1.8818E-9<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>In example 2, we suggest that the likelihood of observing 5 cases in 50 patients was extremely unlikely and is less than 1% as shown by the answer \u00e0 1.88 E-9 which translates to a probability of 0.00000000188 given a sample size of 50 women, and can be written as: [latex]P_{5}\\rvert (N=50) = 0.00000000188[\/latex]<\/p>\n<h2>Computing the probabilities of tossing a single die<\/h2>\n<p>Considering a single die &#8212; what is the probability (or chance) of rolling a given number?\u00a0 For example, for a single die, estimate the probability of rolling a number less than \u201c5\u201d.<\/p>\n<p><strong>Step 1:<\/strong> determine the set of all possible outcomes.<\/p>\n<p><em>1 roll of a single die = {1, 2, 3, 4, 5, 6} = 6<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/dice.png\" alt=\"\" width=\"625\" height=\"132\" class=\"aligncenter size-full wp-image-1791\" srcset=\"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/dice.png 625w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/dice-300x63.png 300w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/dice-65x14.png 65w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/dice-225x48.png 225w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/dice-350x74.png 350w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/p>\n<p style=\"text-align: center\">Figure 22.2 Image of all possible outcomes for a single die<\/p>\n<p><strong>On the roll of the dice<\/strong> . . . A single die has six sides, each side with a different number from 1 to 6.<\/p>\n<p>Therefore, the set of all possible outcomes is:<\/p>\n<p>\u2013 1 die = {1, 2, 3, 4, 5, 6}<\/p>\n<p>\u2013 the probability of rolling any\u00a0 \u201cgiven number\u201d is 1\/6 or p(roll) = 0.17.<\/p>\n<h4><em>Therefore, with a <strong>single die<\/strong>, estimate the probability of rolling a number less than \u201c5\u201d.<\/em><\/h4>\n<p><strong>Step 1:<\/strong> determine the set of all possible outcomes.<\/p>\n<p>1 roll of a single die = {1, 2, 3, 4, 5, 6} = 6<\/p>\n<p><strong>Step 2:<\/strong> determine the set of favourable outcomes.<\/p>\n<p>Numbers less than 5 = {1, 2, 3, 4} = 4<\/p>\n<p><strong>Step 3:<\/strong> divide the number of favourable or anticipated outcomes by the number of possible outcomes to estimate the probability. Therefore, there is a 67% chance of rolling a number less than 5 as shown here:<\/p>\n<p>Probability\u00a0 = 4\/6 = 2\/3 = 0.6666 = 67%<\/p>\n<hr \/>\n<h6><strong>HOWEVER,<\/strong> what if we were asked to consider rolling a number less than 5, in four of ten tosses of a single die? To answer this question we would apply the binomial formula, using the following apriori estimates: n=10, x=4, p=0.67, q=0.33.<\/h6>\n<p>[latex]P_{x} = \\frac{n!}{x!(n-x)!} \\times p^{x} q^{n-x}[\/latex]<\/p>\n<p>[latex]P_{4} = \\frac{10!}{4!(10-4)!} \\times {\\left({0.67}\\right)^{4}}{\\left({0.33}\\right)^{10-4}}[\/latex]<\/p>\n<p>[latex]P_{4} = {210} \\times {0.000259}[\/latex]<\/p>\n<p>[latex]P_{4} = {0.05465}[\/latex] = roughly 5%<\/p>\n<hr \/>\n<h2>4. Computing Probabilities Associated With Lottery Number Selection<\/h2>\n<h6>So what is the probability of winning from the purchase of a single lottery ticket?<\/h6>\n<p><span style=\"text-align: initial;font-size: 1em\">The chance of any single combination of six numbers from 1 to 49 is extremely low [latex]{1 \\over {49 \\choose{6}}}[\/latex] which is read as 1 ticket divided by the binomial coefficient of (n choose k) or (49 choose 6) and our likelihood of winning the lottery is 1 chance in 13,983,816 combinations.<\/span><\/p>\n<p>Let&#8217;s say you wanted to buy a lottery ticket on the <em>lotto<\/em> <strong>649<\/strong>.\u00a0 You pay one dollar and pick 6 numbers from 49 on a specific computer scan sheet.\u00a0 Your first expectation after (or maybe prior to) purchasing the lottery ticket is that every number on the lottery card between 1 and 49 has an equally likely chance of being selected.\u00a0 Therefore, if every number on the card has an equally likely chance of being selected, then every combination of 6 numbers that can be made from the 49 numbers on the lottery card, has an equally likely chance of being selected. This is an expectation that the selection of the numbers from the lottery card is truly random.<\/p>\n<h4>How many combinations of six numbers are we really talking about?<\/h4>\n<p style=\"text-align: center\">To compute the number of possible combinations of 6 numbers from the 49 numbers, we need to use the following combinatorial (or factorial) formula. We have 49 numbers choose 6.\u00a0 The number 49 represents the population from which the sample &#8220;6&#8221; was chosen.\u00a0 We write the formula for determining the combinations using the following combinatorial equation or the binomial coefficient:<\/p>\n<p style=\"text-align: center\"><span style=\"text-align: initial;font-size: 1em\">[latex]{N \\choose{n}} = {49 \\choose{6}}[\/latex] <\/span><\/p>\n<p>or we may wish to write the formula using a factorial format as:<\/p>\n<p style=\"text-align: center\"><span style=\"text-align: initial;font-size: 1em\">[latex]{N! \\over {n!{(N - n)}!}}[\/latex] = [latex]{49! \\over {6!{(49 - 6)}!}}[\/latex]<\/span><\/p>\n<p>Therefore the number of all possible combinations of 6 numbers from a set of 49 consecutive numbers is:<\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">[latex]{(49 \\times 48 \\times ... 2 \\times 1) \\over{(6 \\times 5 \\times ... 1) \\times (49 \\times 48 \\times ... 2 \\times 1) }}[\/latex]<\/span>[latex]= {(10,068,347,520) \\over{720 }} = 13,983,816[\/latex]<\/p>\n<p>Yet you won&#8217;t be happy unless all of your numbers were chosen, but REALLY what is the chance that all six of your numbers will be selected by the lottery machine.\u00a0 Well since you only bought one ticket, then your chance of winning the lottery is 1 in 13,983,816 chances, or <span style=\"text-align: initial;font-size: 1em\">[latex]1 \\over{49 \\choose{6}}[\/latex] [latex]\\rightarrow { 1 \\over{13,983,816} }[\/latex] <\/span>where the value 0.000000071 represents the probability associated with your set of scores.<\/p>\n<h6>Given this large set of possible outcomes, how might we evaluate the data that are generated from one year of twice-weekly draws for any patterns that seem to be emerging?<\/h6>\n<p>One of the simplest ways to present these data is to combine all of the numbers and present the outcome data in a chart of the <strong>frequency of outcomes<\/strong>. This organizational strategy would show that 6 unique numbers are drawn from the set of possible numbers ranging from 1 to 49, each week for 104 picks (52 weeks with draws held twice weekly). This approach considers that we are using <strong>sampling without replacement,<\/strong> which means that once a number has been selected from the set of 49 possible outcomes each week, that number cannot be selected again in that week. As shown below, the set of outcomes can be organized by the order of choices per week. That is, for any given lottery we can chart the first number drawn, the second number drawn, the third number drawn, the fourth number drawn, the fifth number drawn, or the sixth number drawn, each week.<\/p>\n<table class=\"aligncenter\" style=\"height: 120px\">\n<thead>\n<tr class=\"shaded\" style=\"height: 15px\">\n<td style=\"height: 15px;width: 51.05px\"><strong>draw #<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>1st\u00a0 pick<\/strong><\/td>\n<td style=\"height: 15px;width: 59.05px\"><strong>2nd pick<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>3rd pick<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>4th pick<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>5th pick<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>6th pick<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"height: 15px\">\n<td style=\"height: 15px;width: 51.05px\"><strong>1<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>13<\/strong><\/td>\n<td style=\"height: 15px;width: 59.05px\"><strong>21<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>7<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>32<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>47<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>11<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 15px\">\n<td style=\"height: 15px;width: 51.05px\"><strong>2<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>5<\/strong><\/td>\n<td style=\"height: 15px;width: 59.05px\"><strong>34<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>28<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>2<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>14<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>44<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 15px\">\n<td style=\"height: 15px;width: 51.05px\"><strong>.<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>\u00a0.<\/strong><\/td>\n<td style=\"height: 15px;width: 59.05px\"><strong>.<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>.<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 15px\">\n<td style=\"height: 15px;width: 51.05px\"><strong>.<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>\u00a0.<\/strong><\/td>\n<td style=\"height: 15px;width: 59.05px\"><strong>.<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>.<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 15px\">\n<td style=\"height: 15px;width: 51.05px\"><strong>.<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>\u00a0.<\/strong><\/td>\n<td style=\"height: 15px;width: 59.05px\"><strong>.<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>.<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>.<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 15px\">\n<td style=\"height: 15px;width: 51.05px\"><strong>103<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>33<\/strong><\/td>\n<td style=\"height: 15px;width: 59.05px\"><strong>16<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>21<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>48<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>15<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>1<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 15px\">\n<td style=\"height: 15px;width: 51.05px\"><strong>104<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>18<\/strong><\/td>\n<td style=\"height: 15px;width: 59.05px\"><strong>49<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>28<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>3<\/strong><\/td>\n<td style=\"height: 15px;width: 55.85px\"><strong>26<\/strong><\/td>\n<td style=\"height: 15px;width: 56.65px\"><strong>37<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The set of outcomes will then generate a table with 104 rows representing the six numbers drawn each week.\u00a0 However, this table is far too cumbersome and will not help us to make sense of the choices.\u00a0 Using SAS and the PROC FREQ command we can generate a set of six unique outcomes for 104 draws to replicate the twice-weekly draws of the lottery in a given year (52 weeks x 2 draws per week).<\/p>\n<p>Copy the following program to your SAS space and run the program to see which lucky lottery numbers you can produce from <span style=\"text-align: initial;font-size: 1em\">[latex]{49 \\choose{6}}[\/latex]. Using if-then logic statements will enable you to group the data for each ball drawn each week and thereby provide simple categories to graph the outcomes.\u00a0<\/span><\/p>\n<div class=\"textbox textbox--exercises\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">SAS PROGRAM TO GENERATE 104 LOTTERY PICKS from 49 choose 6 combinations<\/p>\n<\/header>\n<div class=\"textbox__content\">\n<div>options pagesize=60 linesize=80 center date;<\/div>\n<div>PROC FORMAT;<\/div>\n<div>VALUE GRPFMT 1 = &#8216;NUMBERS 1 TO 7&#8217;<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a02 = &#8216;NUMBERS 8 TO 14&#8217;<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a03 = &#8216;NUMBERS 15 TO 21&#8217;<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a04 = &#8216;NUMBERS 22 TO 28&#8217;<\/div>\n<div>5 = &#8216;NUMBERS 29 TO 35&#8217;<\/div>\n<div>6 = &#8216;NUMBERS 36 TO 42&#8217;<\/div>\n<div>7 = &#8216;NUMBERS 43 TO 49&#8217;;<\/div>\n<div>data sasrng1;<\/div>\n<div>call streaminit(13);<\/div>\n<div>\/* this is the seed for the RNG *\/<\/div>\n<div>array balls ball1-ball6;<\/div>\n<div>\u00a0 \u00a0 do k=1 to 104;<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 do i=1 to 6;<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 balls(i) = RAND(&#8220;normal&#8221;)*1000000000000;<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 balls(i)=ROUND(balls(i));<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 balls(i)=1+(mod(balls(i),49));<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 balls(i) = ABS(balls(i));<\/div>\n<div>\u00a0if ball1 = 0 then ball1 = 1;<\/div>\n<div>if ball1 &gt;0 and ball1&lt;8 then ball1grp=1;<\/div>\n<div>if ball1 &gt;7 and ball1&lt;15 then ball1grp=2;<\/div>\n<div>if ball1 &gt;14 and ball1&lt;22 then ball1grp=3;<\/div>\n<div>if ball1 &gt;21 and ball1&lt;29 then ball1grp=4;<\/div>\n<div>if ball1 &gt;28 and ball1&lt;36 then ball1grp=5;<\/div>\n<div>if ball1 &gt;35 and ball1&lt;43 then ball1grp=6;<\/div>\n<div>if ball1 &gt;42 and ball1&lt;50 then ball1grp=7;<\/div>\n<div>end;<\/div>\n<div><\/div>\n<div>call streaminit(999);<\/div>\n<div>do until (ball2 ne ball1);<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball2 = RAND(&#8220;normal&#8221;)*1000000000000;<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball2 = ROUND(ball2);<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball2 = 1+(mod(ball2,49));<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball2 = ABS(ball2);<\/div>\n<div>\u00a0if ball2 = 0 then ball2 = 1;<\/div>\n<div>if ball2 &gt;0 and ball2&lt;8 then ball2grp=1;<\/div>\n<div>if ball2 &gt;7 and ball2&lt;15 then ball2grp=2;<\/div>\n<div>if ball2 &gt;14 and ball2&lt;22 then ball2grp=3;<\/div>\n<div>if ball2 &gt;21 and ball2&lt;29 then ball2grp=4;<\/div>\n<div>if ball2 &gt;28 and ball2&lt;36 then ball2grp=5;<\/div>\n<div>if ball2 &gt;35 and ball2&lt;43 then ball2grp=6;<\/div>\n<div>if ball2 &gt;42 and ball2&lt;50 then ball2grp=7;<\/div>\n<div>end;<\/div>\n<div>call streaminit(28);<\/div>\n<div>do until (ball3 ne ball2 and ball3 ne ball1);<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball3 = RAND(&#8220;normal&#8221;)*1000000000000;<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball3 = ROUND(ball3);<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball3 = 1+(mod(ball3,49));<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball3 = ABS(ball3);<\/div>\n<div>\u00a0 if ball3 = 0 then ball3 = 1;<\/div>\n<div>if ball3 &gt;0 and ball3&lt;8 then ball3grp=1;<\/div>\n<div>if ball3 &gt;7 and ball3&lt;15 then ball3grp=2;<\/div>\n<div>if ball3 &gt;14 and ball3&lt;22 then ball3grp=3;<\/div>\n<div>if ball3 &gt;21 and ball3&lt;29 then ball3grp=4;<\/div>\n<div>if ball3 &gt;28 and ball3&lt;36 then ball3grp=5;<\/div>\n<div>if ball3 &gt;35 and ball3&lt;43 then ball3grp=6;<\/div>\n<div>if ball3 &gt;42 and ball3&lt;50 then ball3grp=7;<\/div>\n<div>end;<\/div>\n<div>call streaminit(218);<\/div>\n<div>do until (ball4 ne ball3 and ball4 ne ball2 and ball4 ne ball1);<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball4 = RAND(&#8220;normal&#8221;)*1000000000000;<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball4 = ROUND(ball4);<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball4 = 1+(mod(ball4,49));<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball4 = ABS(ball4);<\/div>\n<div>\u00a0 if ball4 = 0 then ball4 = 1;<\/div>\n<div>if ball4 &gt;0 and ball4&lt;8 then ball4grp=1;<\/div>\n<div>if ball4 &gt;7 and ball4&lt;15 then ball4grp=2;<\/div>\n<div>if ball4 &gt;14 and ball4&lt;22 then ball4grp=3;<\/div>\n<div>if ball4 &gt;21 and ball4&lt;29 then ball4grp=4;<\/div>\n<div>if ball4 &gt;28 and ball4&lt;36 then ball4grp=5;<\/div>\n<div>if ball4 &gt;35 and ball4&lt;43 then ball4grp=6;<\/div>\n<div>if ball4 &gt;42 and ball4&lt;50 then ball4grp=7;<\/div>\n<div>end; call streaminit(28);<\/div>\n<div>do until (ball5 ne ball4 and ball5 ne ball3 and ball5 ne ball2 and ball5 ne ball1);<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball5 = RAND(&#8220;normal&#8221;)*1000000000000;<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball5 = ROUND(ball5);<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball5 = 1+(mod(ball5,49));<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball5 = ABS(ball5);<\/div>\n<div>\u00a0 \u00a0 \u00a0if ball5 = 0 then ball5 = 1;<\/div>\n<div>if ball5 &gt;0 and ball5&lt;8 then ball5grp=1;<\/div>\n<div>if ball5 &gt;7 and ball5&lt;15 then ball5grp=2;<\/div>\n<div>if ball5 &gt;14 and ball5&lt;22 then ball5grp=3;<\/div>\n<div>if ball5 &gt;21 and ball5&lt;29 then ball5grp=4;<\/div>\n<div>if ball5 &gt;28 and ball5&lt;36 then ball5grp=5;<\/div>\n<div>if ball5 &gt;35 and ball5&lt;43 then ball5grp=6;<\/div>\n<div>if ball5 &gt;42 and ball5&lt;50 then ball5grp=7;<\/div>\n<div>end; call streaminit(68);<\/div>\n<div>do until (ball6 ne ball5 and ball6 ne ball4 and ball6 ne ball3 and ball6 ne ball2 and ball6 ne ball1);<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball6 = RAND(&#8220;normal&#8221;)*1000000000000;<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball6 = ROUND(ball6);<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball6 = 1+(mod(ball6,49));<\/div>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 ball6 = ABS(ball6);<\/div>\n<div>\u00a0 \u00a0 if ball6 = 0 then ball6 = 1;<\/div>\n<div>if ball6 &gt;0 and ball6&lt;8 then ball6grp=1;<\/div>\n<div>if ball6 &gt;7 and ball6&lt;15 then ball6grp=2;<\/div>\n<div>if ball6 &gt;14 and ball6&lt;22 then ball6grp=3;<\/div>\n<div>if ball6 &gt;21 and ball6&lt;29 then ball6grp=4;<\/div>\n<div>if ball6 &gt;28 and ball6&lt;36 then ball6grp=5;<\/div>\n<div>if ball6 &gt;35 and ball6&lt;43 then ball6grp=6;<\/div>\n<div>if ball6 &gt;42 and ball6&lt;50 then ball6grp=7;<\/div>\n<div>end;output; end;<\/div>\n<div><\/div>\n<div>run;<\/div>\n<div>proc freq; tables ball1grp ball2grp<\/div>\n<div>ball3grp ball4grp ball5grp ball6grp;<\/div>\n<div>FORMAT ball1grp &#8212; ball6grp GRPFMT. ;run;<\/div>\n<div><\/div>\n<div><\/div>\n<div><\/div>\n<div>\/* CALCULATE CHI SQUARE GOODNESS OF FIT<\/div>\n<div><\/div>\n<div>PROC FREQ;<\/div>\n<div>TABLES ball1grp\/CHISQ;<\/div>\n<div>FORMAT ball1grp GRPFMT. ;<\/div>\n<div>TITLE &#8216;CALCULATING THE GOODNESS OF FIT FOR ball1grp&#8217;;<\/div>\n<div>RUN; *\/<\/div>\n<div>\/* Define the axis characteristics *\/<\/div>\n<div>\u00a0 \u00a0axis1 offset=(0,50) minor=none;<\/div>\n<div>\u00a0 \u00a0pattern1 value=solid color=cx7c95ca;<\/div>\n<div><\/div>\n<div>proc sort; by ball1;<\/div>\n<div>proc gchart ;<\/div>\n<div>\u00a0 \u00a0 \u00a0Hbar ball1grp \/\u00a0 TYPE=PERCENT<\/div>\n<div>\u00a0 \u00a0 \u00a0discrete ;<\/div>\n<div>\u00a0 \u00a0 \u00a0FORMAT ball1grp\u00a0 GRPFMT. ;run;<\/div>\n<div><\/div>\n<div>\/* Define the title *\/<\/div>\n<div>TITLE &#8216;FREQUENCY DISTRIBUTION FOR OUTCOME GROUPS FOR BALL1&#8217;;<\/div>\n<div>\u00a0 \u00a0run;<\/div>\n<\/div>\n<\/div>\n<div>\n<p>A sample of the output from this procedure is shown below:<\/p>\n<div id=\"IDX\" class=\"proc_title_group\">\n<p class=\"c proctitle\">The HORIZONTAL BARCHART WITH FREQ TABLE<\/p>\n<\/div>\n<section>\n<article aria-label=\"One-Way Frequencies\"><\/article>\n<\/section>\n<section id=\"IDX1\">\n<article aria-label=\"One-Way Frequencies\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/BALLGRP1.png\" alt=\"\" width=\"783\" height=\"426\" class=\"aligncenter size-full wp-image-1821\" srcset=\"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/BALLGRP1.png 783w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/BALLGRP1-300x163.png 300w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/BALLGRP1-768x418.png 768w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/BALLGRP1-65x35.png 65w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/BALLGRP1-225x122.png 225w, https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-content\/uploads\/sites\/49\/2020\/06\/BALLGRP1-350x190.png 350w\" sizes=\"auto, (max-width: 783px) 100vw, 783px\" \/><\/article>\n<\/section>\n<section id=\"IDX2\">\n<article aria-label=\"One-Way Frequencies\"><\/article>\n<\/section>\n<div><\/div>\n<\/div>\n<hr \/>\n<p>&nbsp;<\/p>\n","protected":false},"author":56,"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-966","chapter","type-chapter","status-publish","hentry"],"part":38,"_links":{"self":[{"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/pressbooks\/v2\/chapters\/966","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/wp\/v2\/users\/56"}],"version-history":[{"count":124,"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/pressbooks\/v2\/chapters\/966\/revisions"}],"predecessor-version":[{"id":2094,"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/pressbooks\/v2\/chapters\/966\/revisions\/2094"}],"part":[{"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/pressbooks\/v2\/parts\/38"}],"metadata":[{"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/pressbooks\/v2\/chapters\/966\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/wp\/v2\/media?parent=966"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/pressbooks\/v2\/chapter-type?post=966"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/wp\/v2\/contributor?post=966"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/pressbooks.library.upei.ca\/montelpare\/wp-json\/wp\/v2\/license?post=966"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}