{"id":1052,"date":"2024-05-03T08:51:22","date_gmt":"2024-05-03T12:51:22","guid":{"rendered":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/?post_type=chapter&#038;p=1052"},"modified":"2024-06-11T16:01:47","modified_gmt":"2024-06-11T20:01:47","slug":"contigency-tables","status":"publish","type":"chapter","link":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/chapter\/contigency-tables\/","title":{"raw":"Contingency Tables","rendered":"Contingency Tables"},"content":{"raw":"<div class=\"textbox textbox--learning-objectives\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">Learning Objectives<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">\r\n\r\nConstruct and understand contingency tables.\r\n\r\n<\/div>\r\n<\/div>\r\n<h2>A Contingency Table:<\/h2>\r\n<ul>\r\n \t<li>Describes the relationship between categories.<\/li>\r\n \t<li>Also know as a '<a style=\"text-align: initial\" href=\"https:\/\/libguides.library.kent.edu\/SPSS\/Crosstabs#:~:text=To%20describe%20the%20relationship%20between,other%20variable%20determine%20the%20columns.\"><strong>Crosstabs<\/strong><\/a><span style=\"text-align: initial\">' in marketing.<\/span><\/li>\r\n \t<li>\"The categories of one variable determine the rows of the table.<\/li>\r\n \t<li>The categories of the other variable determine the columns.\"[footnote]https:\/\/libguides.library.kent.edu\/SPSS\/Crosstabs#:~:text=To%20describe%20the%20relationship%20between,other%20variable%20determine%20the%20columns.[\/footnote]<\/li>\r\n \t<li>\"Heavily used in survey research, business intelligence, engineering, and scientific research.\"[footnote]https:\/\/en.wikipedia.org\/wiki\/Contingency_table[\/footnote]<\/li>\r\n<\/ul>\r\n<h2>Constructing a Continency Table:<\/h2>\r\n<ul>\r\n \t<li>The 'outsides' (totals) of the table, are the 'singular' (or total) probabilities<\/li>\r\n \t<li>Inside the table are the intersections of categories (or 'ANDs')<\/li>\r\n \t<li>The table below is for two events, A and B, that can each either happen or not happen<\/li>\r\n \t<li>Because there are only 2 options for both A and B, the above table is also called a 2\u00d72 table<\/li>\r\n \t<li>Some events can have more than 2 possible options (see examples later in this section)<\/li>\r\n<\/ul>\r\n<table class=\"grid aligncenter\">\r\n<tbody>\r\n<tr>\r\n<td style=\"text-align: center\"><\/td>\r\n<th style=\"text-align: center\">A<\/th>\r\n<th style=\"text-align: center\">not A<\/th>\r\n<th style=\"text-align: center\">Totals<\/th>\r\n<\/tr>\r\n<tr>\r\n<th style=\"text-align: center\">B<\/th>\r\n<td style=\"text-align: center\">P(A and B)<\/td>\r\n<td style=\"text-align: center\">P(\u0100\u00a0and B)<\/td>\r\n<td style=\"text-align: center\">P(B)<\/td>\r\n<\/tr>\r\n<tr>\r\n<th style=\"text-align: center\">not B<\/th>\r\n<td style=\"text-align: center\">P(A and B\u0305)<\/td>\r\n<td style=\"text-align: center\">P(\u0100\u00a0and B\u0305)<\/td>\r\n<td style=\"text-align: center\">P(B\u0305)<\/td>\r\n<\/tr>\r\n<tr>\r\n<th style=\"text-align: center\">Totals<\/th>\r\n<td style=\"text-align: center\">P(A)<\/td>\r\n<td style=\"text-align: center\">P(\u0100)<\/td>\r\n<td style=\"text-align: center\">1<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\nWhere:\r\n<ul>\r\n \t<li>P(\u0100) = P(<em>not<\/em> A) = 1 \u2212 P(A)<\/li>\r\n \t<li>P(B\u0305) = P(<em>not<\/em> B) = 1 \u2212 P(B)<\/li>\r\n<\/ul>\r\n<h1>Symbol notation in contingency tables<\/h1>\r\nThe contingency (or crosstabs) table can be noted using symbols also:\r\n<table class=\"grid aligncenter\">\r\n<tbody>\r\n<tr>\r\n<td style=\"text-align: center\"><\/td>\r\n<th style=\"text-align: center\">A<\/th>\r\n<th style=\"text-align: center\">\u0100<\/th>\r\n<th style=\"text-align: center\">Totals<\/th>\r\n<\/tr>\r\n<tr>\r\n<th style=\"text-align: center\">B<\/th>\r\n<td style=\"text-align: center\">P(A \u2229 B)<\/td>\r\n<td style=\"text-align: center\">P(\u0100 \u2229 B)<\/td>\r\n<td style=\"text-align: center\">P(B)<\/td>\r\n<\/tr>\r\n<tr>\r\n<th style=\"text-align: center\">B\u0305<\/th>\r\n<td style=\"text-align: center\">P(A \u2229 B\u0305)<\/td>\r\n<td style=\"text-align: center\">P(\u0100 \u2229 B\u0305)<\/td>\r\n<td style=\"text-align: center\">P(B\u0305)<\/td>\r\n<\/tr>\r\n<tr>\r\n<th style=\"text-align: center\">Totals<\/th>\r\n<td style=\"text-align: center\">P(A)<\/td>\r\n<td style=\"text-align: center\">P(\u0100)<\/td>\r\n<td style=\"text-align: center\">1<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\nwhere the symbols shown above mean the following:\r\n<ul>\r\n \t<li>\u2229 = intersection (or 'AND')<\/li>\r\n \t<li>P(\u0100) = P(<em>not <\/em>A) = 1 \u2212 P(A)<\/li>\r\n \t<li>P(B\u0305) = P(<em>not<\/em> B) = 1 \u2212 P(B)<\/li>\r\n \t<li>P(A \u2229 B) = P(A and B)<\/li>\r\n \t<li>P(\u0100 \u2229 B) = P(<em>not<\/em> A and B)<\/li>\r\n \t<li>P(A \u2229 B\u0305) = P(A and <em>not <\/em>B)<\/li>\r\n \t<li>P(\u0100 \u2229 B\u0305) = P(<em>not<\/em> A and <em>not<\/em> B)<\/li>\r\n<\/ul>\r\n<h1>Deconstructing Contingency Tables<\/h1>\r\n<h2>The Totals<\/h2>\r\nIn the above table, we can calculate the total (singular) probabilities:\r\n<ul>\r\n \t<li>P(A) = P(A and B) + P(A and B\u0305)<\/li>\r\n \t<li>P(\u0100) = P(\u0100 and B) + P(\u0100\u00a0and B\u0305)<\/li>\r\n \t<li>P(B) = P(A and B) + P(\u0100\u00a0and B)<\/li>\r\n \t<li>P(B\u0305) = P(A and B\u0305) + P(\u0100\u00a0and B\u0305)<\/li>\r\n<\/ul>\r\nThese 'singular' probabilities are the overall odds of A or B happening (or not happening).\r\n<em>Note<\/em>: <em>The overall total (bottom right box) should always equal 1 (ie: 100%)<\/em>.\r\n<h2>Inside Probabilities (Intersections)<\/h2>\r\nThe 'inside' of the table contains the 'overlaps' (intersections) between the categories:\r\n<ul>\r\n \t<li>P(A and B) = the odds of both A and B occurring<\/li>\r\n \t<li>P(A and B\u0305) = the odds of A occurring and B not occurring<\/li>\r\n \t<li>P(\u0100\u00a0and B) = the odds of A not occurring and B occurring<\/li>\r\n \t<li>P(\u0100 and B\u0305) = the odds of A not occurring and B not occurring<\/li>\r\n<\/ul>\r\n<h1>Calculating The 'ANDs' (EXErCISE)<\/h1>\r\nThe <em>AND<\/em>'s can be calculated using the conditional probabilities ('givens'):\r\n<ul>\r\n \t<li>P(A and B) = P(A|B)\u00d7P(B) = P(B|A)\u00d7P(A)<\/li>\r\n \t<li>P(A and B\u0305)\u00a0 = P(A|B\u0305)\u00d7P(B\u0305) = P(B\u0305|A)\u00d7P(A)<\/li>\r\n \t<li>P(\u0100\u00a0and B) = P(\u0100|B)\u00d7P(B) = P(B|\u0100)\u00d7P(\u0100)<\/li>\r\n \t<li>P(\u0100 and B\u0305) = P(\u0100|B\u0305)\u00d7P(B\u0305) = P(B\u0305|\u0100)\u00d7P(\u0100)<\/li>\r\n<\/ul>\r\n<h2>Example 17.1.1<\/h2>\r\n<strong><span style=\"color: #003366\">Problem Setup<\/span><\/strong>: Let us examine the effectiveness of two social media marketing campaigns:\r\n<ul>\r\n \t<li>Let's call them campaign <em>A<\/em> and campaign <em>B<\/em><\/li>\r\n \t<li>In each campaign, people are shown an ad<\/li>\r\n \t<li>If someone clicks on the link provided after looking at the ad, we say they 'click through'<\/li>\r\n<\/ul>\r\nThe percentage who click through on each ad is called the '<a href=\"https:\/\/support.google.com\/google-ads\/answer\/2615875?hl=en#:~:text=Clickthrough%20rate%20(CTR)%20can%20be,your%20CTR%20would%20be%205%25.\">click-through rate<\/a>' (CTR):\r\n<ul>\r\n \t<li>The CTR (click-through rate) for campaign <em>A<\/em>\u00a0is 2%<\/li>\r\n \t<li>The CTR (click-through rate) for campaign <em>B<\/em> is 5%<\/li>\r\n \t<li>If someone has already viewed ad A, the CTR for campaign <em>B<\/em> rises to 15%<\/li>\r\n<\/ul>\r\n<span style=\"color: #003366\"><strong>Question<\/strong><\/span>: What is the probability of someone clicking through after both ads?\r\n\r\n<span style=\"color: #003366\"><strong>You Try<\/strong><\/span>: Can you write out the probabilities above using 'stats notation'?\r\n\r\n[h5p id=\"40\"]\r\n\r\n<span style=\"color: #003366\"><strong>Need Help?\u00a0<\/strong><\/span>Click below to reveal the answers (if needed).\r\n\r\n[h5p id=\"37\"]\r\n<h3><span style=\"color: #003366\"><strong>Calculating the AND<\/strong><\/span>:<\/h3>\r\nWe can now calculate the odds of someone clicking through after both ads:\r\n<p style=\"padding-left: 40px\">P(A and B) = P(B|A) \u00d7 P(A) = 0.15 \u00d7 0.02 = 0.003<\/p>\r\n\r\n<h1>Setting Up the Table (Exercise)<\/h1>\r\nIt is also possible to calculate missing values in the table. We only need to know the following:\r\n<ul>\r\n \t<li>one or two of the totals<\/li>\r\n \t<li>some of the inside probabilities<\/li>\r\n<\/ul>\r\nWe can calculate the rest knowing that the 'totals' are the sums across the rows and down the columns.\r\n<h2>Example 17.1.2<\/h2>\r\n<strong><span style=\"color: #003366\">Problem Setup<\/span><\/strong>: Let us continue with the two marketing campaigns example...\r\n\r\n<span style=\"color: #003366\"><strong>Question<\/strong><\/span>: Can you set up the contingency (cross-tabs) table for this problem?\r\n\r\n<span style=\"color: #003366\"><strong>Solution<\/strong><\/span>: Let us first calculate the compliments for A and B. These will be the probabilities of people NOT clicking through after seeing the ad:\r\n<ul>\r\n \t<li>Campaign <em>A<\/em>'s probability that someone does NOT click through = \u00a0P(\u0100) = 1\u2212P(A) =1\u22120.02 = 0.98<\/li>\r\n \t<li>Campaign <em>B<\/em>'s probability that someone does NOT click through = \u00a0P(B\u0305) = 1\u2212P(B) =1\u22120.05 = 0.95<\/li>\r\n<\/ul>\r\n<span style=\"color: #003366\"><strong>You try:<\/strong> <\/span>Can you add the above values and the values in Example 17.1.1 to the table?\r\n\r\n[h5p id=\"39\"]\r\n<div>\r\n<h1>Solutions to Example 17.1.2 (Click here to reveal)<\/h1>\r\n<table class=\"grid aligncenter\">\r\n<tbody>\r\n<tr>\r\n<th style=\"text-align: center\"><\/th>\r\n<th style=\"text-align: center\">A<\/th>\r\n<th style=\"text-align: center\">not A<\/th>\r\n<th style=\"text-align: center\">Totals<\/th>\r\n<\/tr>\r\n<tr>\r\n<th style=\"text-align: center\">B<\/th>\r\n<td style=\"text-align: center\">0.003<\/td>\r\n<td style=\"text-align: center\"><\/td>\r\n<td style=\"text-align: center\">0.05<\/td>\r\n<\/tr>\r\n<tr>\r\n<th style=\"text-align: center\">not B<\/th>\r\n<td style=\"text-align: center\"><\/td>\r\n<td style=\"text-align: center\"><\/td>\r\n<td style=\"text-align: center\">0.95<\/td>\r\n<\/tr>\r\n<tr>\r\n<th style=\"text-align: center\">Totals<\/th>\r\n<td style=\"text-align: center\">0.02<\/td>\r\n<td style=\"text-align: center\">0.98<\/td>\r\n<td style=\"text-align: center\">1<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<h1>Calculating Missing Values in the Table (Exercise)<\/h1>\r\n<ul>\r\n \t<li>We can use the fact that we sum across the rows and columns to determine the totals.<\/li>\r\n \t<li>We can work backwards and subtract values from the totals to get the missing values.<\/li>\r\n \t<li>Let's try this by continuing with the ad campaign example.<\/li>\r\n<\/ul>\r\n<h2>Example 17.1.3<\/h2>\r\n<strong><span style=\"color: #003366\">Problem Setup<\/span><\/strong>: Let us continue with the two marketing campaigns crosstabs (contigency) table...\r\n\r\n<span style=\"color: #003366\"><strong>Question<\/strong><\/span>: Can you calculate the missing values in the table we built in Example 17.1.2?\r\n\r\n<span style=\"color: #003366\"><strong>You try:<\/strong> <\/span>Calculate the missing values where needed and complete the CLR crosstabs table.\r\n\r\n[h5p id=\"41\"]\r\n<div>\r\n<h1>Solutions to Example 17.1.3 (Click here to reveal)<\/h1>\r\n<table class=\"grid aligncenter\" style=\"width: 676px\">\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 130.521px;text-align: center\"><\/td>\r\n<td style=\"width: 179.354px;text-align: center\"><strong>A<\/strong><\/td>\r\n<td style=\"width: 261.083px;text-align: center\"><strong>not A<\/strong><\/td>\r\n<td style=\"width: 150.708px;text-align: center\"><strong>Totals<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 130.521px;text-align: center\"><strong>B<\/strong><\/td>\r\n<td style=\"width: 179.354px;text-align: center\">0.003<\/td>\r\n<td style=\"width: 261.083px;text-align: center\">=0.05\u22120.003 = 0.047<\/td>\r\n<td style=\"width: 150.708px;text-align: center\">0.05<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 130.521px;text-align: center\"><strong>not B<\/strong><\/td>\r\n<td style=\"width: 179.354px;text-align: center\">=0.02\u22120.003 = 0.017<\/td>\r\n<td style=\"width: 261.083px;text-align: center\">=0.98\u2212(0.05\u22120.003) = 0.933<\/td>\r\n<td style=\"width: 150.708px;text-align: center\">0.95<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 130.521px;text-align: center\"><strong>Totals<\/strong><\/td>\r\n<td style=\"width: 179.354px;text-align: center\">0.02<\/td>\r\n<td style=\"width: 261.083px;text-align: center\">0.98<\/td>\r\n<td style=\"width: 150.708px;text-align: center\">1<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n<h1>Key Takeaways (EXERCISE)<\/h1>\r\n<div class=\"textbox textbox--key-takeaways\"><header class=\"textbox__header\">\r\n<p class=\"textbox__title\">Key Takeaways: Contingency Tables<\/p>\r\n\r\n<\/header>\r\n<div class=\"textbox__content\">\r\n\r\n[h5p id=\"42\"]\r\n\r\n[h5p id=\"43\"]\r\n\r\n<\/div>\r\n<\/div>\r\n<h1>Your Own Notes (EXERCISE)<\/h1>\r\n<ul>\r\n \t<li>Are there any notes you want to take from this section? Is there anything you'd like to copy and paste below?<\/li>\r\n \t<li>These notes are for you only (they will not be stored anywhere)<\/li>\r\n \t<li>Make sure to download them at the end to use as a reference<\/li>\r\n<\/ul>\r\n[h5p id=\"16\"]","rendered":"<div class=\"textbox textbox--learning-objectives\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">Learning Objectives<\/p>\n<\/header>\n<div class=\"textbox__content\">\n<p>Construct and understand contingency tables.<\/p>\n<\/div>\n<\/div>\n<h2>A Contingency Table:<\/h2>\n<ul>\n<li>Describes the relationship between categories.<\/li>\n<li>Also know as a &#8216;<a style=\"text-align: initial\" href=\"https:\/\/libguides.library.kent.edu\/SPSS\/Crosstabs#:~:text=To%20describe%20the%20relationship%20between,other%20variable%20determine%20the%20columns.\"><strong>Crosstabs<\/strong><\/a><span style=\"text-align: initial\">&#8216; in marketing.<\/span><\/li>\n<li>&#8220;The categories of one variable determine the rows of the table.<\/li>\n<li>The categories of the other variable determine the columns.&#8221;<a class=\"footnote\" title=\"https:\/\/libguides.library.kent.edu\/SPSS\/Crosstabs#:~:text=To%20describe%20the%20relationship%20between,other%20variable%20determine%20the%20columns.\" id=\"return-footnote-1052-1\" href=\"#footnote-1052-1\" aria-label=\"Footnote 1\"><sup class=\"footnote\">[1]<\/sup><\/a><\/li>\n<li>&#8220;Heavily used in survey research, business intelligence, engineering, and scientific research.&#8221;<a class=\"footnote\" title=\"https:\/\/en.wikipedia.org\/wiki\/Contingency_table\" id=\"return-footnote-1052-2\" href=\"#footnote-1052-2\" aria-label=\"Footnote 2\"><sup class=\"footnote\">[2]<\/sup><\/a><\/li>\n<\/ul>\n<h2>Constructing a Continency Table:<\/h2>\n<ul>\n<li>The &#8216;outsides&#8217; (totals) of the table, are the &#8216;singular&#8217; (or total) probabilities<\/li>\n<li>Inside the table are the intersections of categories (or &#8216;ANDs&#8217;)<\/li>\n<li>The table below is for two events, A and B, that can each either happen or not happen<\/li>\n<li>Because there are only 2 options for both A and B, the above table is also called a 2\u00d72 table<\/li>\n<li>Some events can have more than 2 possible options (see examples later in this section)<\/li>\n<\/ul>\n<table class=\"grid aligncenter\">\n<tbody>\n<tr>\n<td style=\"text-align: center\"><\/td>\n<th style=\"text-align: center\">A<\/th>\n<th style=\"text-align: center\">not A<\/th>\n<th style=\"text-align: center\">Totals<\/th>\n<\/tr>\n<tr>\n<th style=\"text-align: center\">B<\/th>\n<td style=\"text-align: center\">P(A and B)<\/td>\n<td style=\"text-align: center\">P(\u0100\u00a0and B)<\/td>\n<td style=\"text-align: center\">P(B)<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: center\">not B<\/th>\n<td style=\"text-align: center\">P(A and B\u0305)<\/td>\n<td style=\"text-align: center\">P(\u0100\u00a0and B\u0305)<\/td>\n<td style=\"text-align: center\">P(B\u0305)<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: center\">Totals<\/th>\n<td style=\"text-align: center\">P(A)<\/td>\n<td style=\"text-align: center\">P(\u0100)<\/td>\n<td style=\"text-align: center\">1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Where:<\/p>\n<ul>\n<li>P(\u0100) = P(<em>not<\/em> A) = 1 \u2212 P(A)<\/li>\n<li>P(B\u0305) = P(<em>not<\/em> B) = 1 \u2212 P(B)<\/li>\n<\/ul>\n<h1>Symbol notation in contingency tables<\/h1>\n<p>The contingency (or crosstabs) table can be noted using symbols also:<\/p>\n<table class=\"grid aligncenter\">\n<tbody>\n<tr>\n<td style=\"text-align: center\"><\/td>\n<th style=\"text-align: center\">A<\/th>\n<th style=\"text-align: center\">\u0100<\/th>\n<th style=\"text-align: center\">Totals<\/th>\n<\/tr>\n<tr>\n<th style=\"text-align: center\">B<\/th>\n<td style=\"text-align: center\">P(A \u2229 B)<\/td>\n<td style=\"text-align: center\">P(\u0100 \u2229 B)<\/td>\n<td style=\"text-align: center\">P(B)<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: center\">B\u0305<\/th>\n<td style=\"text-align: center\">P(A \u2229 B\u0305)<\/td>\n<td style=\"text-align: center\">P(\u0100 \u2229 B\u0305)<\/td>\n<td style=\"text-align: center\">P(B\u0305)<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: center\">Totals<\/th>\n<td style=\"text-align: center\">P(A)<\/td>\n<td style=\"text-align: center\">P(\u0100)<\/td>\n<td style=\"text-align: center\">1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>where the symbols shown above mean the following:<\/p>\n<ul>\n<li>\u2229 = intersection (or &#8216;AND&#8217;)<\/li>\n<li>P(\u0100) = P(<em>not <\/em>A) = 1 \u2212 P(A)<\/li>\n<li>P(B\u0305) = P(<em>not<\/em> B) = 1 \u2212 P(B)<\/li>\n<li>P(A \u2229 B) = P(A and B)<\/li>\n<li>P(\u0100 \u2229 B) = P(<em>not<\/em> A and B)<\/li>\n<li>P(A \u2229 B\u0305) = P(A and <em>not <\/em>B)<\/li>\n<li>P(\u0100 \u2229 B\u0305) = P(<em>not<\/em> A and <em>not<\/em> B)<\/li>\n<\/ul>\n<h1>Deconstructing Contingency Tables<\/h1>\n<h2>The Totals<\/h2>\n<p>In the above table, we can calculate the total (singular) probabilities:<\/p>\n<ul>\n<li>P(A) = P(A and B) + P(A and B\u0305)<\/li>\n<li>P(\u0100) = P(\u0100 and B) + P(\u0100\u00a0and B\u0305)<\/li>\n<li>P(B) = P(A and B) + P(\u0100\u00a0and B)<\/li>\n<li>P(B\u0305) = P(A and B\u0305) + P(\u0100\u00a0and B\u0305)<\/li>\n<\/ul>\n<p>These &#8216;singular&#8217; probabilities are the overall odds of A or B happening (or not happening).<br \/>\n<em>Note<\/em>: <em>The overall total (bottom right box) should always equal 1 (ie: 100%)<\/em>.<\/p>\n<h2>Inside Probabilities (Intersections)<\/h2>\n<p>The &#8216;inside&#8217; of the table contains the &#8216;overlaps&#8217; (intersections) between the categories:<\/p>\n<ul>\n<li>P(A and B) = the odds of both A and B occurring<\/li>\n<li>P(A and B\u0305) = the odds of A occurring and B not occurring<\/li>\n<li>P(\u0100\u00a0and B) = the odds of A not occurring and B occurring<\/li>\n<li>P(\u0100 and B\u0305) = the odds of A not occurring and B not occurring<\/li>\n<\/ul>\n<h1>Calculating The &#8216;ANDs&#8217; (EXErCISE)<\/h1>\n<p>The <em>AND<\/em>&#8216;s can be calculated using the conditional probabilities (&#8216;givens&#8217;):<\/p>\n<ul>\n<li>P(A and B) = P(A|B)\u00d7P(B) = P(B|A)\u00d7P(A)<\/li>\n<li>P(A and B\u0305)\u00a0 = P(A|B\u0305)\u00d7P(B\u0305) = P(B\u0305|A)\u00d7P(A)<\/li>\n<li>P(\u0100\u00a0and B) = P(\u0100|B)\u00d7P(B) = P(B|\u0100)\u00d7P(\u0100)<\/li>\n<li>P(\u0100 and B\u0305) = P(\u0100|B\u0305)\u00d7P(B\u0305) = P(B\u0305|\u0100)\u00d7P(\u0100)<\/li>\n<\/ul>\n<h2>Example 17.1.1<\/h2>\n<p><strong><span style=\"color: #003366\">Problem Setup<\/span><\/strong>: Let us examine the effectiveness of two social media marketing campaigns:<\/p>\n<ul>\n<li>Let&#8217;s call them campaign <em>A<\/em> and campaign <em>B<\/em><\/li>\n<li>In each campaign, people are shown an ad<\/li>\n<li>If someone clicks on the link provided after looking at the ad, we say they &#8216;click through&#8217;<\/li>\n<\/ul>\n<p>The percentage who click through on each ad is called the &#8216;<a href=\"https:\/\/support.google.com\/google-ads\/answer\/2615875?hl=en#:~:text=Clickthrough%20rate%20(CTR)%20can%20be,your%20CTR%20would%20be%205%25.\">click-through rate<\/a>&#8216; (CTR):<\/p>\n<ul>\n<li>The CTR (click-through rate) for campaign <em>A<\/em>\u00a0is 2%<\/li>\n<li>The CTR (click-through rate) for campaign <em>B<\/em> is 5%<\/li>\n<li>If someone has already viewed ad A, the CTR for campaign <em>B<\/em> rises to 15%<\/li>\n<\/ul>\n<p><span style=\"color: #003366\"><strong>Question<\/strong><\/span>: What is the probability of someone clicking through after both ads?<\/p>\n<p><span style=\"color: #003366\"><strong>You Try<\/strong><\/span>: Can you write out the probabilities above using &#8216;stats notation&#8217;?<\/p>\n<div id=\"h5p-40\">\n<div class=\"h5p-iframe-wrapper\"><iframe id=\"h5p-iframe-40\" class=\"h5p-iframe\" data-content-id=\"40\" style=\"height:1px\" src=\"about:blank\" frameBorder=\"0\" scrolling=\"no\" title=\"Example 23.1.1 Probabilities Setup\"><\/iframe><\/div>\n<\/div>\n<p><span style=\"color: #003366\"><strong>Need Help?\u00a0<\/strong><\/span>Click below to reveal the answers (if needed).<\/p>\n<div id=\"h5p-37\">\n<div class=\"h5p-iframe-wrapper\"><iframe id=\"h5p-iframe-37\" class=\"h5p-iframe\" data-content-id=\"37\" style=\"height:1px\" src=\"about:blank\" frameBorder=\"0\" scrolling=\"no\" title=\"Example 17.1.1 - Probability Expression Setup Solutions\"><\/iframe><\/div>\n<\/div>\n<h3><span style=\"color: #003366\"><strong>Calculating the AND<\/strong><\/span>:<\/h3>\n<p>We can now calculate the odds of someone clicking through after both ads:<\/p>\n<p style=\"padding-left: 40px\">P(A and B) = P(B|A) \u00d7 P(A) = 0.15 \u00d7 0.02 = 0.003<\/p>\n<h1>Setting Up the Table (Exercise)<\/h1>\n<p>It is also possible to calculate missing values in the table. We only need to know the following:<\/p>\n<ul>\n<li>one or two of the totals<\/li>\n<li>some of the inside probabilities<\/li>\n<\/ul>\n<p>We can calculate the rest knowing that the &#8216;totals&#8217; are the sums across the rows and down the columns.<\/p>\n<h2>Example 17.1.2<\/h2>\n<p><strong><span style=\"color: #003366\">Problem Setup<\/span><\/strong>: Let us continue with the two marketing campaigns example&#8230;<\/p>\n<p><span style=\"color: #003366\"><strong>Question<\/strong><\/span>: Can you set up the contingency (cross-tabs) table for this problem?<\/p>\n<p><span style=\"color: #003366\"><strong>Solution<\/strong><\/span>: Let us first calculate the compliments for A and B. These will be the probabilities of people NOT clicking through after seeing the ad:<\/p>\n<ul>\n<li>Campaign <em>A<\/em>&#8216;s probability that someone does NOT click through = \u00a0P(\u0100) = 1\u2212P(A) =1\u22120.02 = 0.98<\/li>\n<li>Campaign <em>B<\/em>&#8216;s probability that someone does NOT click through = \u00a0P(B\u0305) = 1\u2212P(B) =1\u22120.05 = 0.95<\/li>\n<\/ul>\n<p><span style=\"color: #003366\"><strong>You try:<\/strong> <\/span>Can you add the above values and the values in Example 17.1.1 to the table?<\/p>\n<div id=\"h5p-39\">\n<div class=\"h5p-iframe-wrapper\"><iframe id=\"h5p-iframe-39\" class=\"h5p-iframe\" data-content-id=\"39\" style=\"height:1px\" src=\"about:blank\" frameBorder=\"0\" scrolling=\"no\" title=\"Contigency Table Setup\"><\/iframe><\/div>\n<\/div>\n<div>\n<h1>Solutions to Example 17.1.2 (Click here to reveal)<\/h1>\n<table class=\"grid aligncenter\">\n<tbody>\n<tr>\n<th style=\"text-align: center\"><\/th>\n<th style=\"text-align: center\">A<\/th>\n<th style=\"text-align: center\">not A<\/th>\n<th style=\"text-align: center\">Totals<\/th>\n<\/tr>\n<tr>\n<th style=\"text-align: center\">B<\/th>\n<td style=\"text-align: center\">0.003<\/td>\n<td style=\"text-align: center\"><\/td>\n<td style=\"text-align: center\">0.05<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: center\">not B<\/th>\n<td style=\"text-align: center\"><\/td>\n<td style=\"text-align: center\"><\/td>\n<td style=\"text-align: center\">0.95<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: center\">Totals<\/th>\n<td style=\"text-align: center\">0.02<\/td>\n<td style=\"text-align: center\">0.98<\/td>\n<td style=\"text-align: center\">1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h1>Calculating Missing Values in the Table (Exercise)<\/h1>\n<ul>\n<li>We can use the fact that we sum across the rows and columns to determine the totals.<\/li>\n<li>We can work backwards and subtract values from the totals to get the missing values.<\/li>\n<li>Let&#8217;s try this by continuing with the ad campaign example.<\/li>\n<\/ul>\n<h2>Example 17.1.3<\/h2>\n<p><strong><span style=\"color: #003366\">Problem Setup<\/span><\/strong>: Let us continue with the two marketing campaigns crosstabs (contigency) table&#8230;<\/p>\n<p><span style=\"color: #003366\"><strong>Question<\/strong><\/span>: Can you calculate the missing values in the table we built in Example 17.1.2?<\/p>\n<p><span style=\"color: #003366\"><strong>You try:<\/strong> <\/span>Calculate the missing values where needed and complete the CLR crosstabs table.<\/p>\n<div id=\"h5p-41\">\n<div class=\"h5p-iframe-wrapper\"><iframe id=\"h5p-iframe-41\" class=\"h5p-iframe\" data-content-id=\"41\" style=\"height:1px\" src=\"about:blank\" frameBorder=\"0\" scrolling=\"no\" title=\"Contigency Table Setup\"><\/iframe><\/div>\n<\/div>\n<div>\n<h1>Solutions to Example 17.1.3 (Click here to reveal)<\/h1>\n<table class=\"grid aligncenter\" style=\"width: 676px\">\n<tbody>\n<tr>\n<td style=\"width: 130.521px;text-align: center\"><\/td>\n<td style=\"width: 179.354px;text-align: center\"><strong>A<\/strong><\/td>\n<td style=\"width: 261.083px;text-align: center\"><strong>not A<\/strong><\/td>\n<td style=\"width: 150.708px;text-align: center\"><strong>Totals<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 130.521px;text-align: center\"><strong>B<\/strong><\/td>\n<td style=\"width: 179.354px;text-align: center\">0.003<\/td>\n<td style=\"width: 261.083px;text-align: center\">=0.05\u22120.003 = 0.047<\/td>\n<td style=\"width: 150.708px;text-align: center\">0.05<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 130.521px;text-align: center\"><strong>not B<\/strong><\/td>\n<td style=\"width: 179.354px;text-align: center\">=0.02\u22120.003 = 0.017<\/td>\n<td style=\"width: 261.083px;text-align: center\">=0.98\u2212(0.05\u22120.003) = 0.933<\/td>\n<td style=\"width: 150.708px;text-align: center\">0.95<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 130.521px;text-align: center\"><strong>Totals<\/strong><\/td>\n<td style=\"width: 179.354px;text-align: center\">0.02<\/td>\n<td style=\"width: 261.083px;text-align: center\">0.98<\/td>\n<td style=\"width: 150.708px;text-align: center\">1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h1>Key Takeaways (EXERCISE)<\/h1>\n<div class=\"textbox textbox--key-takeaways\">\n<header class=\"textbox__header\">\n<p class=\"textbox__title\">Key Takeaways: Contingency Tables<\/p>\n<\/header>\n<div class=\"textbox__content\">\n<div id=\"h5p-42\">\n<div class=\"h5p-iframe-wrapper\"><iframe id=\"h5p-iframe-42\" class=\"h5p-iframe\" data-content-id=\"42\" style=\"height:1px\" src=\"about:blank\" frameBorder=\"0\" scrolling=\"no\" title=\"Key Takeaways for AND, OR, GIVEN\"><\/iframe><\/div>\n<\/div>\n<div id=\"h5p-43\">\n<div class=\"h5p-iframe-wrapper\"><iframe id=\"h5p-iframe-43\" class=\"h5p-iframe\" data-content-id=\"43\" style=\"height:1px\" src=\"about:blank\" frameBorder=\"0\" scrolling=\"no\" title=\"Key Takeaways for Contingency Tables\"><\/iframe><\/div>\n<\/div>\n<\/div>\n<\/div>\n<h1>Your Own Notes (EXERCISE)<\/h1>\n<ul>\n<li>Are there any notes you want to take from this section? Is there anything you&#8217;d like to copy and paste below?<\/li>\n<li>These notes are for you only (they will not be stored anywhere)<\/li>\n<li>Make sure to download them at the end to use as a reference<\/li>\n<\/ul>\n<div id=\"h5p-16\">\n<div class=\"h5p-iframe-wrapper\"><iframe id=\"h5p-iframe-16\" class=\"h5p-iframe\" data-content-id=\"16\" style=\"height:1px\" src=\"about:blank\" frameBorder=\"0\" scrolling=\"no\" title=\"Key takeaways, notes and comments from this section document tool.\"><\/iframe><\/div>\n<\/div>\n<hr class=\"before-footnotes clear\" \/><div class=\"footnotes\"><ol><li id=\"footnote-1052-1\">https:\/\/libguides.library.kent.edu\/SPSS\/Crosstabs#:~:text=To%20describe%20the%20relationship%20between,other%20variable%20determine%20the%20columns. <a href=\"#return-footnote-1052-1\" class=\"return-footnote\" aria-label=\"Return to footnote 1\">&crarr;<\/a><\/li><li id=\"footnote-1052-2\">https:\/\/en.wikipedia.org\/wiki\/Contingency_table <a href=\"#return-footnote-1052-2\" class=\"return-footnote\" aria-label=\"Return to footnote 2\">&crarr;<\/a><\/li><\/ol><\/div>","protected":false},"author":865,"menu_order":4,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-1052","chapter","type-chapter","status-publish","hentry"],"part":208,"_links":{"self":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapters\/1052","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/wp\/v2\/users\/865"}],"version-history":[{"count":25,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapters\/1052\/revisions"}],"predecessor-version":[{"id":1948,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapters\/1052\/revisions\/1948"}],"part":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/parts\/208"}],"metadata":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapters\/1052\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/wp\/v2\/media?parent=1052"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapter-type?post=1052"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/wp\/v2\/contributor?post=1052"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/wp\/v2\/license?post=1052"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}