{"id":2916,"date":"2024-07-26T22:16:05","date_gmt":"2024-07-27T02:16:05","guid":{"rendered":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/?post_type=chapter&#038;p=2916"},"modified":"2024-07-27T02:38:12","modified_gmt":"2024-07-27T06:38:12","slug":"chi-squared-test-example","status":"publish","type":"chapter","link":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/chapter\/chi-squared-test-example\/","title":{"raw":"Chi-Squared Test Example","rendered":"Chi-Squared Test Example"},"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\nSolve a Chi-Squared Test for Independence problem both with manual and Excel calculations.\r\n\r\n<\/div>\r\n<\/div>\r\nLet us now 'dive in' to an example where we use a Chi-Squared Test for Independence. Before we do, let us recap the steps we need to perform the Chi-Squared Test for Independence:\r\n<ol>\r\n \t<li>State H<sub>0<\/sub> and H<sub>A<\/sub><\/li>\r\n \t<li>Calculate the expected frequencies (values)<\/li>\r\n \t<li>Calculate the \u03c7<sup>2<\/sup> test statistic<\/li>\r\n \t<li>Compute the p-value<\/li>\r\n \t<li>Make a decision<\/li>\r\n \t<li>Draw a conclusion<\/li>\r\n<\/ol>\r\n<h2>Example 67.1<\/h2>\r\n<span style=\"color: #003366\"><strong>Problem Setup:<\/strong> <span style=\"color: #000000\">Analysts who work on the popular game '<a style=\"color: #000000\" href=\"https:\/\/www.dictionary.com\/e\/what-even-is-a-fortnight-and-why-was-it-trending\/\">Fortnight<\/a>' are trying to determine who they should target their in-app purchases to. In particular, they want to promote a premium add-on pack to users. They are wondering if the level of the player in the app might influence their likelihood to purchase the add-on. See the table below for the purchase results per level for randomly selected players:<\/span><\/span>\r\n<table class=\"grid aligncenter\" style=\"border-collapse: collapse;width: 59.5014%;height: 90px\" border=\"0\">\r\n<tbody>\r\n<tr style=\"height: 18px\">\r\n<th class=\"shaded\" style=\"width: 26.6042%;height: 18px;text-align: center\">Level<\/th>\r\n<th class=\"shaded\" style=\"width: 21.5624%;height: 18px;text-align: center\">Purchased Add-On<\/th>\r\n<th class=\"shaded\" style=\"width: 22.6735%;height: 18px;text-align: center\">Did Not Purchase<\/th>\r\n<th class=\"shaded\" style=\"width: 27.0457%;height: 18px;text-align: center\">Total<\/th>\r\n<\/tr>\r\n<tr style=\"height: 18px\">\r\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Bronze<\/th>\r\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">60<\/td>\r\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">40<\/td>\r\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>100<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 18px\">\r\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Silver<\/th>\r\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">67<\/td>\r\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">63<\/td>\r\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>130<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 18px\">\r\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Gold or Higher<\/th>\r\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">49<\/td>\r\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">41<\/td>\r\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>90<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 18px\">\r\n<th class=\"shaded\" style=\"width: 26.6042%;height: 18px;text-align: center\">Total<\/th>\r\n<th class=\"shaded\" style=\"width: 21.5624%;height: 18px;text-align: center\"><strong>176<\/strong><\/th>\r\n<th class=\"shaded\" style=\"width: 22.6735%;text-align: center;height: 18px\"><strong>144<\/strong><\/th>\r\n<th class=\"shaded\" style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>320<\/strong><\/th>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<span style=\"color: #003366\"><strong>Question<\/strong><\/span>: Does the player's level affect whether they will purchase the premium add-on pack? Test at the 5% level of significance.\r\n\r\n<span style=\"color: #003366\"><strong>You Try<\/strong><\/span>: Try setting up and solving this problem yourself. Click the sections below to reveal the solutions when you are ready or need help.\r\n<h1>1. The Hypotheses<\/h1>\r\nThe hypotheses for a contingency table question are always the same format. The Null hypothesis reflects the idea that there is no difference between the groups with respect to preference (i.e., independence). The alternative reflects the idea that there is a difference between the groups with respect to preference (i.e., dependence). There are\u00a0two common methods to state the hypotheses:\r\n<h2>Method 1<\/h2>\r\nLet us examine the percent of players from each level who do purchase the add-on and do the analysis on them:\r\n<ul>\r\n \t<li>[latex]P_B[\/latex] = percent of bronze level players who purchase the add-on<\/li>\r\n \t<li>[latex]P_S[\/latex] = percent of silver level players who purchase the add-on<\/li>\r\n \t<li>[latex]P_G[\/latex] = percent of gold or higher level players who purchase the add-on<\/li>\r\n<\/ul>\r\nWe assume, if whether or not they purchase the add-on is is independent of their level:\r\n\r\n[latex]H_0:\u00a0 P_B= P_S= P_G \\leftarrow[\/latex] percent who purchase the add-on is the same amongst all levels of players\r\n\r\n[latex]H_A: [\/latex] At least one of [latex]P_B, P_S, P_G[\/latex] is not equal [latex]\\leftarrow [\/latex] percent who purchase the add-on is not the same amongst all levels of players.\r\n<h2>Method 2:<\/h2>\r\nAlternatively you can formulate the hypotheses this way:\r\n<p style=\"padding-left: 40px\">[latex]H_0[\/latex]: Likelihood to purchase add-on is independent of player level.<\/p>\r\n<p style=\"padding-left: 40px\">[latex]H_A[\/latex]: Likelihood to purchase add-on is dependent on player level.<\/p>\r\n\r\n<h1>2. The Expected Values<\/h1>\r\nWe will use the following formula for our expected values:\r\n\r\n\\[Exp_i = \\frac{\\text{Row Total}\\times \\text{Column Total}}{\\text{Sample Size}}\\]\r\n\r\nLet us calculate the expected values within the table:\r\n<table class=\"grid aligncenter\" style=\"border-collapse: collapse;width: 59.5014%;height: 90px\" border=\"0\">\r\n<tbody>\r\n<tr style=\"height: 18px\">\r\n<th class=\"shaded\" style=\"width: 26.6042%;height: 18px;text-align: center\">Level<\/th>\r\n<th class=\"shaded\" style=\"width: 21.5624%;height: 18px;text-align: center\">Purchased Add-On<\/th>\r\n<th class=\"shaded\" style=\"width: 22.6735%;height: 18px;text-align: center\">Did Not Purchase<\/th>\r\n<th class=\"shaded\" style=\"width: 27.0457%;height: 18px;text-align: center\">Total<\/th>\r\n<\/tr>\r\n<tr style=\"height: 18px\">\r\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Bronze<\/th>\r\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">[latex]\\frac{100\\times176}{320}=55 [\/latex]<\/td>\r\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">[latex]\\frac{100\\times144}{320}=45 [\/latex]<\/td>\r\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>100<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 18px\">\r\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Silver<\/th>\r\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">[latex]\\frac{130\\times176}{320}=71.5 [\/latex]<\/td>\r\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">[latex]\\frac{130\\times144}{320}=58.5 [\/latex]<\/td>\r\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>130<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 18px\">\r\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Gold or Higher<\/th>\r\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">[latex]\\frac{90\\times176}{320}=49.5 [\/latex]<\/td>\r\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">[latex]\\frac{90\\times144}{320}=40.5 [\/latex]<\/td>\r\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><b>90<\/b><\/td>\r\n<\/tr>\r\n<tr style=\"height: 18px\">\r\n<th class=\"shaded\" style=\"width: 26.6042%;height: 18px;text-align: center\">Total<\/th>\r\n<th class=\"shaded\" style=\"width: 21.5624%;height: 18px;text-align: center\">176<\/th>\r\n<th class=\"shaded\" style=\"width: 22.6735%;text-align: center;height: 18px\">144<\/th>\r\n<th class=\"shaded\" style=\"width: 27.0457%;height: 18px;text-align: center\">320<\/th>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<h1>3. The \u03c7<sup>2<\/sup> Test Statistic<\/h1>\r\nWe will use the following formula to calculate the \u03c7<sup>2<\/sup> test statistic:\r\n\r\n\\[ \\chi^2_{test} = \\sum \\frac{(obs - exp)^2}{exp} \\]\r\n\r\nLet us calculate the differences between the observed (actual) and expected (exp) values within the table:\r\n<table class=\"grid aligncenter\" style=\"border-collapse: collapse;width: 59.5014%;height: 90px\" border=\"0\">\r\n<tbody>\r\n<tr style=\"height: 18px\">\r\n<th class=\"shaded\" style=\"width: 26.6042%;height: 18px;text-align: center\">Level<\/th>\r\n<th class=\"shaded\" style=\"width: 21.5624%;height: 18px;text-align: center\">Purchased Add-On<\/th>\r\n<th class=\"shaded\" style=\"width: 22.6735%;height: 18px;text-align: center\">Did Not Purchase<\/th>\r\n<th class=\"shaded\" style=\"width: 27.0457%;height: 18px;text-align: center\">Total<\/th>\r\n<\/tr>\r\n<tr style=\"height: 18px\">\r\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Bronze<\/th>\r\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">[latex]\\frac{(60-55)^2}{55}=0.4545 [\/latex]<\/td>\r\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">[latex]\\frac{(40-45)^2}{45}=0.5556 [\/latex]<\/td>\r\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>1.0101<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 18px\">\r\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Silver<\/th>\r\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">[latex]\\frac{(67-71.5)^2}{71.5}=0.2832 [\/latex]<\/td>\r\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">[latex]\\frac{(63-58.5)^2}{58.5}=0.3452 [\/latex]<\/td>\r\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>0.6294<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 18px\">\r\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Gold or Higher<\/th>\r\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">[latex]\\frac{(49-49.5)^2}{49.5}=0.0051 [\/latex]<\/td>\r\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">[latex]\\frac{(41-40.5)^2}{40.5}=0.0062 [\/latex]<\/td>\r\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>0.0112<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 18px\">\r\n<th class=\"shaded\" style=\"width: 26.6042%;height: 18px;text-align: center\">Total<\/th>\r\n<th class=\"shaded\" style=\"width: 21.5624%;height: 18px;text-align: center\"><strong>0.7428<\/strong><\/th>\r\n<th class=\"shaded\" style=\"width: 22.6735%;text-align: center;height: 18px\"><strong>0.9079<\/strong><\/th>\r\n<th class=\"shaded\" style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>1.6507<\/strong><\/th>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\nThis gives [latex] \\chi^2_{test} = 0.4545 + 0.5556 + 0.2832 + 0.3452 + 0.7428 + 0.9079 = 1.6507 [\/latex]\r\n<h1>4a. The Degrees of Freedom<\/h1>\r\nTo determine the p-value, we first need to calculate the degrees of freedom:\r\n\r\n\\[ \\text{Degrees of Freedom} = df = (\\text{#} rows - 1)\\times (\\text{#} columns - 1) = (3-1) \\times (2-1) = 2 \\times 1 = 2 \\]\r\n\r\nFor the number of rows and columns, we only count the rows and columns that include values (not the totals or headers).\r\n<h1>4B. The P-Value<\/h1>\r\nWe can now calculate the p-value using Excel's CHISQ.DIST.RT() function:\r\n\r\n\\[ \\text{p-value} = \\text{CHISQ.DIST.RT}(1.6507, 2) = 0.438083\\]\r\n<h1>5. The Decision<\/h1>\r\nBecause the p-value = 0.4381 is greater than (&gt;) the level of significance (5%), we cannot reject H<sub>0<\/sub>.\r\n<h1>6. The Conclusion<\/h1>\r\nBecause we cannot reject H<sub>0<\/sub>, there is not sufficient evidence to conclude that whether or not a player purchases the add-on is dependent on the player's level. What does this mean for the analysts? They should not use the player's level when attempting trying to decide who to target when promoting the add-on pack.\r\n<h1>Excel Solutions (VIDEO)<\/h1>\r\nLet us now perform all of the calculations using Excel:\r\n\r\nhttps:\/\/youtu.be\/sJUPo9kP6Z0\r\n\r\n<a href=\"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-content\/uploads\/sites\/2128\/2024\/07\/Example67.1.xlsx\">Click here<\/a> to download the Excel solutions for this problem","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>Solve a Chi-Squared Test for Independence problem both with manual and Excel calculations.<\/p>\n<\/div>\n<\/div>\n<p>Let us now &#8216;dive in&#8217; to an example where we use a Chi-Squared Test for Independence. Before we do, let us recap the steps we need to perform the Chi-Squared Test for Independence:<\/p>\n<ol>\n<li>State H<sub>0<\/sub> and H<sub>A<\/sub><\/li>\n<li>Calculate the expected frequencies (values)<\/li>\n<li>Calculate the \u03c7<sup>2<\/sup> test statistic<\/li>\n<li>Compute the p-value<\/li>\n<li>Make a decision<\/li>\n<li>Draw a conclusion<\/li>\n<\/ol>\n<h2>Example 67.1<\/h2>\n<p><span style=\"color: #003366\"><strong>Problem Setup:<\/strong> <span style=\"color: #000000\">Analysts who work on the popular game &#8216;<a style=\"color: #000000\" href=\"https:\/\/www.dictionary.com\/e\/what-even-is-a-fortnight-and-why-was-it-trending\/\">Fortnight<\/a>&#8216; are trying to determine who they should target their in-app purchases to. In particular, they want to promote a premium add-on pack to users. They are wondering if the level of the player in the app might influence their likelihood to purchase the add-on. See the table below for the purchase results per level for randomly selected players:<\/span><\/span><\/p>\n<table class=\"grid aligncenter\" style=\"border-collapse: collapse;width: 59.5014%;height: 90px\">\n<tbody>\n<tr style=\"height: 18px\">\n<th class=\"shaded\" style=\"width: 26.6042%;height: 18px;text-align: center\">Level<\/th>\n<th class=\"shaded\" style=\"width: 21.5624%;height: 18px;text-align: center\">Purchased Add-On<\/th>\n<th class=\"shaded\" style=\"width: 22.6735%;height: 18px;text-align: center\">Did Not Purchase<\/th>\n<th class=\"shaded\" style=\"width: 27.0457%;height: 18px;text-align: center\">Total<\/th>\n<\/tr>\n<tr style=\"height: 18px\">\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Bronze<\/th>\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">60<\/td>\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">40<\/td>\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>100<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 18px\">\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Silver<\/th>\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">67<\/td>\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">63<\/td>\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>130<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 18px\">\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Gold or Higher<\/th>\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">49<\/td>\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">41<\/td>\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>90<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 18px\">\n<th class=\"shaded\" style=\"width: 26.6042%;height: 18px;text-align: center\">Total<\/th>\n<th class=\"shaded\" style=\"width: 21.5624%;height: 18px;text-align: center\"><strong>176<\/strong><\/th>\n<th class=\"shaded\" style=\"width: 22.6735%;text-align: center;height: 18px\"><strong>144<\/strong><\/th>\n<th class=\"shaded\" style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>320<\/strong><\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"color: #003366\"><strong>Question<\/strong><\/span>: Does the player&#8217;s level affect whether they will purchase the premium add-on pack? Test at the 5% level of significance.<\/p>\n<p><span style=\"color: #003366\"><strong>You Try<\/strong><\/span>: Try setting up and solving this problem yourself. Click the sections below to reveal the solutions when you are ready or need help.<\/p>\n<h1>1. The Hypotheses<\/h1>\n<p>The hypotheses for a contingency table question are always the same format. The Null hypothesis reflects the idea that there is no difference between the groups with respect to preference (i.e., independence). The alternative reflects the idea that there is a difference between the groups with respect to preference (i.e., dependence). There are\u00a0two common methods to state the hypotheses:<\/p>\n<h2>Method 1<\/h2>\n<p>Let us examine the percent of players from each level who do purchase the add-on and do the analysis on them:<\/p>\n<ul>\n<li>[latex]P_B[\/latex] = percent of bronze level players who purchase the add-on<\/li>\n<li>[latex]P_S[\/latex] = percent of silver level players who purchase the add-on<\/li>\n<li>[latex]P_G[\/latex] = percent of gold or higher level players who purchase the add-on<\/li>\n<\/ul>\n<p>We assume, if whether or not they purchase the add-on is is independent of their level:<\/p>\n<p>[latex]H_0:\u00a0 P_B= P_S= P_G \\leftarrow[\/latex] percent who purchase the add-on is the same amongst all levels of players<\/p>\n<p>[latex]H_A:[\/latex] At least one of [latex]P_B, P_S, P_G[\/latex] is not equal [latex]\\leftarrow[\/latex] percent who purchase the add-on is not the same amongst all levels of players.<\/p>\n<h2>Method 2:<\/h2>\n<p>Alternatively you can formulate the hypotheses this way:<\/p>\n<p style=\"padding-left: 40px\">[latex]H_0[\/latex]: Likelihood to purchase add-on is independent of player level.<\/p>\n<p style=\"padding-left: 40px\">[latex]H_A[\/latex]: Likelihood to purchase add-on is dependent on player level.<\/p>\n<h1>2. The Expected Values<\/h1>\n<p>We will use the following formula for our expected values:<\/p>\n<p>\\[Exp_i = \\frac{\\text{Row Total}\\times \\text{Column Total}}{\\text{Sample Size}}\\]<\/p>\n<p>Let us calculate the expected values within the table:<\/p>\n<table class=\"grid aligncenter\" style=\"border-collapse: collapse;width: 59.5014%;height: 90px\">\n<tbody>\n<tr style=\"height: 18px\">\n<th class=\"shaded\" style=\"width: 26.6042%;height: 18px;text-align: center\">Level<\/th>\n<th class=\"shaded\" style=\"width: 21.5624%;height: 18px;text-align: center\">Purchased Add-On<\/th>\n<th class=\"shaded\" style=\"width: 22.6735%;height: 18px;text-align: center\">Did Not Purchase<\/th>\n<th class=\"shaded\" style=\"width: 27.0457%;height: 18px;text-align: center\">Total<\/th>\n<\/tr>\n<tr style=\"height: 18px\">\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Bronze<\/th>\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">[latex]\\frac{100\\times176}{320}=55[\/latex]<\/td>\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">[latex]\\frac{100\\times144}{320}=45[\/latex]<\/td>\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>100<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 18px\">\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Silver<\/th>\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">[latex]\\frac{130\\times176}{320}=71.5[\/latex]<\/td>\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">[latex]\\frac{130\\times144}{320}=58.5[\/latex]<\/td>\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>130<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 18px\">\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Gold or Higher<\/th>\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">[latex]\\frac{90\\times176}{320}=49.5[\/latex]<\/td>\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">[latex]\\frac{90\\times144}{320}=40.5[\/latex]<\/td>\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><b>90<\/b><\/td>\n<\/tr>\n<tr style=\"height: 18px\">\n<th class=\"shaded\" style=\"width: 26.6042%;height: 18px;text-align: center\">Total<\/th>\n<th class=\"shaded\" style=\"width: 21.5624%;height: 18px;text-align: center\">176<\/th>\n<th class=\"shaded\" style=\"width: 22.6735%;text-align: center;height: 18px\">144<\/th>\n<th class=\"shaded\" style=\"width: 27.0457%;height: 18px;text-align: center\">320<\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<h1>3. The \u03c7<sup>2<\/sup> Test Statistic<\/h1>\n<p>We will use the following formula to calculate the \u03c7<sup>2<\/sup> test statistic:<\/p>\n<p>\\[ \\chi^2_{test} = \\sum \\frac{(obs &#8211; exp)^2}{exp} \\]<\/p>\n<p>Let us calculate the differences between the observed (actual) and expected (exp) values within the table:<\/p>\n<table class=\"grid aligncenter\" style=\"border-collapse: collapse;width: 59.5014%;height: 90px\">\n<tbody>\n<tr style=\"height: 18px\">\n<th class=\"shaded\" style=\"width: 26.6042%;height: 18px;text-align: center\">Level<\/th>\n<th class=\"shaded\" style=\"width: 21.5624%;height: 18px;text-align: center\">Purchased Add-On<\/th>\n<th class=\"shaded\" style=\"width: 22.6735%;height: 18px;text-align: center\">Did Not Purchase<\/th>\n<th class=\"shaded\" style=\"width: 27.0457%;height: 18px;text-align: center\">Total<\/th>\n<\/tr>\n<tr style=\"height: 18px\">\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Bronze<\/th>\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">[latex]\\frac{(60-55)^2}{55}=0.4545[\/latex]<\/td>\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">[latex]\\frac{(40-45)^2}{45}=0.5556[\/latex]<\/td>\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>1.0101<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 18px\">\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Silver<\/th>\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">[latex]\\frac{(67-71.5)^2}{71.5}=0.2832[\/latex]<\/td>\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">[latex]\\frac{(63-58.5)^2}{58.5}=0.3452[\/latex]<\/td>\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>0.6294<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 18px\">\n<th style=\"width: 26.6042%;height: 18px;text-align: center\">Gold or Higher<\/th>\n<td style=\"width: 21.5624%;height: 18px;text-align: center\">[latex]\\frac{(49-49.5)^2}{49.5}=0.0051[\/latex]<\/td>\n<td style=\"width: 22.6735%;text-align: center;height: 18px\">[latex]\\frac{(41-40.5)^2}{40.5}=0.0062[\/latex]<\/td>\n<td style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>0.0112<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 18px\">\n<th class=\"shaded\" style=\"width: 26.6042%;height: 18px;text-align: center\">Total<\/th>\n<th class=\"shaded\" style=\"width: 21.5624%;height: 18px;text-align: center\"><strong>0.7428<\/strong><\/th>\n<th class=\"shaded\" style=\"width: 22.6735%;text-align: center;height: 18px\"><strong>0.9079<\/strong><\/th>\n<th class=\"shaded\" style=\"width: 27.0457%;height: 18px;text-align: center\"><strong>1.6507<\/strong><\/th>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>This gives [latex]\\chi^2_{test} = 0.4545 + 0.5556 + 0.2832 + 0.3452 + 0.7428 + 0.9079 = 1.6507[\/latex]<\/p>\n<h1>4a. The Degrees of Freedom<\/h1>\n<p>To determine the p-value, we first need to calculate the degrees of freedom:<\/p>\n<p>\\[ \\text{Degrees of Freedom} = df = (\\text{#} rows &#8211; 1)\\times (\\text{#} columns &#8211; 1) = (3-1) \\times (2-1) = 2 \\times 1 = 2 \\]<\/p>\n<p>For the number of rows and columns, we only count the rows and columns that include values (not the totals or headers).<\/p>\n<h1>4B. The P-Value<\/h1>\n<p>We can now calculate the p-value using Excel&#8217;s CHISQ.DIST.RT() function:<\/p>\n<p>\\[ \\text{p-value} = \\text{CHISQ.DIST.RT}(1.6507, 2) = 0.438083\\]<\/p>\n<h1>5. The Decision<\/h1>\n<p>Because the p-value = 0.4381 is greater than (&gt;) the level of significance (5%), we cannot reject H<sub>0<\/sub>.<\/p>\n<h1>6. The Conclusion<\/h1>\n<p>Because we cannot reject H<sub>0<\/sub>, there is not sufficient evidence to conclude that whether or not a player purchases the add-on is dependent on the player&#8217;s level. What does this mean for the analysts? They should not use the player&#8217;s level when attempting trying to decide who to target when promoting the add-on pack.<\/p>\n<h1>Excel Solutions (VIDEO)<\/h1>\n<p>Let us now perform all of the calculations using Excel:<\/p>\n<p><iframe loading=\"lazy\" id=\"oembed-1\" title=\"Chi Squared Test for Independence (Cross Tabs)\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/sJUPo9kP6Z0?feature=oembed&#38;rel=0\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p><a href=\"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-content\/uploads\/sites\/2128\/2024\/07\/Example67.1.xlsx\">Click here<\/a> to download the Excel solutions for this problem<\/p>\n","protected":false},"author":865,"menu_order":2,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-2916","chapter","type-chapter","status-publish","hentry"],"part":2679,"_links":{"self":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapters\/2916","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\/2916\/revisions"}],"predecessor-version":[{"id":2975,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapters\/2916\/revisions\/2975"}],"part":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/parts\/2679"}],"metadata":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapters\/2916\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/wp\/v2\/media?parent=2916"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/pressbooks\/v2\/chapter-type?post=2916"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/wp\/v2\/contributor?post=2916"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/pressbooks.bccampus.ca\/1130sandbox\/wp-json\/wp\/v2\/license?post=2916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}