{"id":1412,"date":"2023-06-22T02:22:54","date_gmt":"2023-06-22T02:22:54","guid":{"rendered":"https:\/\/content.one.lumenlearning.com\/introstatstest\/chapter\/chi-square-test-of-homogeneity-learn-it-1\/"},"modified":"2026-11-23T18:17:11","modified_gmt":"2026-11-23T18:17:11","slug":"chi-square-test-of-homogeneity-learn-it-1","status":"publish","type":"chapter","link":"https:\/\/content.one.lumenlearning.com\/introstatstest\/chapter\/chi-square-test-of-homogeneity-learn-it-1\/","title":{"raw":"Chi-Square Test of Homogeneity \u2013 Learn It 1","rendered":"Chi-Square Test of Homogeneity \u2013 Learn It 1"},"content":{"raw":"<section class=\"textbox learningGoals\">\r\n<ul>\r\n\t<li><span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Complete a chi-square test of homogeneity&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:12801,&quot;3&quot;:{&quot;1&quot;:0},&quot;12&quot;:0,&quot;15&quot;:&quot;arial&quot;,&quot;16&quot;:9}\">Complete a chi-square test of homogeneity<\/span><\/li>\r\n<\/ul>\r\n<\/section>\r\n<section class=\"textbox keyTakeaway\">\r\n<h3>[latex]\\chi^2[\/latex] test of homogeneity<\/h3>\r\n<p>A <strong>chi-square test of homogeneity<\/strong> determines if two or more populations (or subgroups of a population) have the same distribution of a single categorical variable.<\/p>\r\n<p>We use the test of homogeneity if the response variable has two or more categories and we wish to compare two or more populations (or subgroups.)<\/p>\r\n<\/section>\r\n<p>We can answer the following research question with a chi-square test of homogeneity:<\/p>\r\n<ul>\r\n\t<li>Do dogs leaving the Long Beach Animal Shelter have the same distribution of outcomes (whether the dog is adopted, returned to its owner, transferred, or euthanized) in different years?<\/li>\r\n<\/ul>\r\n<p>We could compare as many years as we like, but let\u2019s look at the three most recent years in the data set (2022, 2023, and 2024) and compare the outcome distributions for dogs leaving the shelter. We can look at this information in a <strong>contingency table <\/strong>(i.e., a <strong>two-way table<\/strong>), where each row represents the outcome distribution for one year. The following table gives the number of dogs with each outcome in each year.[footnote]City of Long Beach, Animal Care Services. (n.d.). Animal shelter intakes and outcomes [Data set]. City of Long Beach Open Data. https:\/\/data.longbeach.gov\/explore\/dataset\/animal-shelter-intakes-and-outcomes\/information\/ Accessed via TidyTuesday, 2025-03-04: https:\/\/github.com\/rfordatascience\/tidytuesday\/tree\/main\/data\/2025\/2025-03-04[\/footnote] Notice that in this table, we are displaying the counts for the categories of one categorical variable (<em>outcome<\/em>) for three different populations (each population is all the dogs leaving the shelter in a single year).<\/p>\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td>&nbsp;<\/td>\r\n<td><strong>Adopted<\/strong><\/td>\r\n<td><strong>Returned to Owner<\/strong><\/td>\r\n<td><strong>Transferred<\/strong><\/td>\r\n<td><strong>Euthanized<\/strong><\/td>\r\n<td><strong>Total<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>2022<\/strong><\/td>\r\n<td>422<\/td>\r\n<td>303<\/td>\r\n<td>66<\/td>\r\n<td>46<\/td>\r\n<td>837<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>2023<\/strong><\/td>\r\n<td>575<\/td>\r\n<td>331<\/td>\r\n<td>91<\/td>\r\n<td>96<\/td>\r\n<td>1,093<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>2024<\/strong><\/td>\r\n<td>632<\/td>\r\n<td>347<\/td>\r\n<td>42<\/td>\r\n<td>122<\/td>\r\n<td>1,143<\/td>\r\n<\/tr>\r\n<tr>\r\n<td><strong>Total <\/strong><\/td>\r\n<td>1,629<\/td>\r\n<td>981<\/td>\r\n<td>199<\/td>\r\n<td>264<\/td>\r\n<td>3,073<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<section class=\"textbox proTip\"><strong>A note about these data:<\/strong> These counts come from the records of a single shelter, not from random samples of dogs, so the results describe this shelter and should not be generalized to other shelters. We treat each year\u2019s dogs as a sample from that year so that we can practice the test. We also include only the four outcomes shown; the shelter records other outcomes (for example, \u201crescue\u201d) that we leave out.<\/section>\r\n<p>Notice that the different years have different numbers of dogs, so it can be useful to look at the relative frequency distribution for each year as well (i.e., the proportions of dogs that have each outcome for each year).<\/p>\r\n<section class=\"textbox example\">\r\n<p class=\"para\"><span style=\"font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;\"><b>Relative Frequencies<\/b><\/span><\/p>\r\n<p class=\"para\"><span style=\"font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;\">Since [latex]422[\/latex] dogs were adopted in 2022 and [latex]837[\/latex] dogs left the shelter in 2022 in total, the relative frequency (or proportion) of dogs that were adopted in 2022 is:<\/span><\/p>\r\n<p style=\"text-align: center;\">[latex]\\dfrac{422}{837}=0.504=50.4\\%[\/latex]<\/p>\r\n<p>In finding a similar proportion for each outcome, we find that the relative frequency distribution of outcomes for all three years is as displayed in the following table.<\/p>\r\n<div align=\"center\">\r\n<table style=\"width: 99.294%;\">\r\n<tbody>\r\n<tr>\r\n<td style=\"width: 9.17587%;\">\u00a0<\/td>\r\n<td style=\"width: 21.0705%;\"><strong>Percentage Adopted<\/strong><\/td>\r\n<td style=\"width: 19.966%;\"><strong>Percentage Returned to Owner<\/strong><\/td>\r\n<td style=\"width: 19.5412%;\"><strong>Percentage Transferred<\/strong><\/td>\r\n<td style=\"width: 19.2014%;\"><strong>Percentage Euthanized<\/strong><\/td>\r\n<td style=\"width: 9.7706%;\"><strong>Total<\/strong><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 9.17587%;\"><strong>2022<\/strong><\/td>\r\n<td style=\"width: 21.0705%;\">[latex]50.4\\%[\/latex]<\/td>\r\n<td style=\"width: 19.966%;\">[latex]36.2\\%[\/latex]<\/td>\r\n<td style=\"width: 19.5412%;\">[latex]7.9\\%[\/latex]<\/td>\r\n<td style=\"width: 19.2014%;\">[latex]5.5\\%[\/latex]<\/td>\r\n<td style=\"width: 9.7706%;\">\r\n<p>[latex]100\\%[\/latex]<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 9.17587%;\"><strong>2023<\/strong><\/td>\r\n<td style=\"width: 21.0705%;\">[latex]52.6\\%[\/latex]<\/td>\r\n<td style=\"width: 19.966%;\">[latex]30.3\\%[\/latex]<\/td>\r\n<td style=\"width: 19.5412%;\">[latex]8.3\\%[\/latex]<\/td>\r\n<td style=\"width: 19.2014%;\">[latex]8.8\\%[\/latex]<\/td>\r\n<td style=\"width: 9.7706%;\">[latex]100\\%[\/latex]<\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"width: 9.17587%;\"><strong>2024<\/strong><\/td>\r\n<td style=\"width: 21.0705%;\">[latex]55.3\\%[\/latex]<\/td>\r\n<td style=\"width: 19.966%;\">[latex]30.4\\%[\/latex]<\/td>\r\n<td style=\"width: 19.5412%;\">[latex]3.7\\%[\/latex]<\/td>\r\n<td style=\"width: 19.2014%;\">[latex]10.7\\%[\/latex]<\/td>\r\n<td style=\"width: 9.7706%;\">\r\n<p>[latex]100\\%[\/latex]<\/p>\r\n<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p style=\"text-align: left;\">Using only the relative frequencies, do these distributions look significantly different? We'll use a chi-square test of homogeneity to find out.<\/p>\r\n<\/div>\r\n<\/section>\r\n<p>In comparing the outcome distributions for these years, we\u2019ll build on two ideas we\u2019ve seen before. We\u2019ve already seen a test for determining whether two population proportions are equal: the two-proportion [latex]z[\/latex]-test. For example, we could think of the dogs leaving the shelter in each year as a sample and consider whether the proportion of dogs adopted in 2022 is the same as the proportion of dogs adopted in 2023.<\/p>\r\n<p>However, in this case, we\u2019re generalizing on that idea by considering more than two populations and looking at the entire distribution of outcomes for all values of the categorical variable. Secondly, we\u2019ll be building on the previous activity by using a chi-square test, but instead of comparing a distribution of counts to a theoretical model, we\u2019re comparing distributions of a categorical variable (in this case, <em>outcome<\/em>) among different populations (in this case, there are three populations: all dogs leaving the shelter in each of three different years).<\/p>\r\n<section class=\"textbox proTip\">The word \u201chomogeneous\u201d means the same or similar, so the <strong>chi-square test of homogeneity<\/strong> is asking whether or not two or more distributions of a categorical variable are the same.In short, a chi-square test of homogeneity compares distributions of one categorical variable for multiple populations.<\/section>\r\n<section class=\"textbox tryIt\">[ohm2_question hide_question_numbers=1 ]2399[\/ohm2_question]<\/section>","rendered":"<section class=\"textbox learningGoals\">\n<ul>\n<li><span data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Complete a chi-square test of homogeneity&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:12801,&quot;3&quot;:{&quot;1&quot;:0},&quot;12&quot;:0,&quot;15&quot;:&quot;arial&quot;,&quot;16&quot;:9}\">Complete a chi-square test of homogeneity<\/span><\/li>\n<\/ul>\n<\/section>\n<section class=\"textbox keyTakeaway\">\n<h3>[latex]\\chi^2[\/latex] test of homogeneity<\/h3>\n<p>A <strong>chi-square test of homogeneity<\/strong> determines if two or more populations (or subgroups of a population) have the same distribution of a single categorical variable.<\/p>\n<p>We use the test of homogeneity if the response variable has two or more categories and we wish to compare two or more populations (or subgroups.)<\/p>\n<\/section>\n<p>We can answer the following research question with a chi-square test of homogeneity:<\/p>\n<ul>\n<li>Do dogs leaving the Long Beach Animal Shelter have the same distribution of outcomes (whether the dog is adopted, returned to its owner, transferred, or euthanized) in different years?<\/li>\n<\/ul>\n<p>We could compare as many years as we like, but let\u2019s look at the three most recent years in the data set (2022, 2023, and 2024) and compare the outcome distributions for dogs leaving the shelter. We can look at this information in a <strong>contingency table <\/strong>(i.e., a <strong>two-way table<\/strong>), where each row represents the outcome distribution for one year. The following table gives the number of dogs with each outcome in each year.<a class=\"footnote\" title=\"City of Long Beach, Animal Care Services. (n.d.). Animal shelter intakes and outcomes [Data set]. City of Long Beach Open Data. https:\/\/data.longbeach.gov\/explore\/dataset\/animal-shelter-intakes-and-outcomes\/information\/ Accessed via TidyTuesday, 2025-03-04: https:\/\/github.com\/rfordatascience\/tidytuesday\/tree\/main\/data\/2025\/2025-03-04\" id=\"return-footnote-1412-1\" href=\"#footnote-1412-1\" aria-label=\"Footnote 1\"><sup class=\"footnote\">[1]<\/sup><\/a> Notice that in this table, we are displaying the counts for the categories of one categorical variable (<em>outcome<\/em>) for three different populations (each population is all the dogs leaving the shelter in a single year).<\/p>\n<table>\n<tbody>\n<tr>\n<td>&nbsp;<\/td>\n<td><strong>Adopted<\/strong><\/td>\n<td><strong>Returned to Owner<\/strong><\/td>\n<td><strong>Transferred<\/strong><\/td>\n<td><strong>Euthanized<\/strong><\/td>\n<td><strong>Total<\/strong><\/td>\n<\/tr>\n<tr>\n<td><strong>2022<\/strong><\/td>\n<td>422<\/td>\n<td>303<\/td>\n<td>66<\/td>\n<td>46<\/td>\n<td>837<\/td>\n<\/tr>\n<tr>\n<td><strong>2023<\/strong><\/td>\n<td>575<\/td>\n<td>331<\/td>\n<td>91<\/td>\n<td>96<\/td>\n<td>1,093<\/td>\n<\/tr>\n<tr>\n<td><strong>2024<\/strong><\/td>\n<td>632<\/td>\n<td>347<\/td>\n<td>42<\/td>\n<td>122<\/td>\n<td>1,143<\/td>\n<\/tr>\n<tr>\n<td><strong>Total <\/strong><\/td>\n<td>1,629<\/td>\n<td>981<\/td>\n<td>199<\/td>\n<td>264<\/td>\n<td>3,073<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<section class=\"textbox proTip\"><strong>A note about these data:<\/strong> These counts come from the records of a single shelter, not from random samples of dogs, so the results describe this shelter and should not be generalized to other shelters. We treat each year\u2019s dogs as a sample from that year so that we can practice the test. We also include only the four outcomes shown; the shelter records other outcomes (for example, \u201crescue\u201d) that we leave out.<\/section>\n<p>Notice that the different years have different numbers of dogs, so it can be useful to look at the relative frequency distribution for each year as well (i.e., the proportions of dogs that have each outcome for each year).<\/p>\n<section class=\"textbox example\">\n<p class=\"para\"><span style=\"font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;\"><b>Relative Frequencies<\/b><\/span><\/p>\n<p class=\"para\"><span style=\"font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;\">Since [latex]422[\/latex] dogs were adopted in 2022 and [latex]837[\/latex] dogs left the shelter in 2022 in total, the relative frequency (or proportion) of dogs that were adopted in 2022 is:<\/span><\/p>\n<p style=\"text-align: center;\">[latex]\\dfrac{422}{837}=0.504=50.4\\%[\/latex]<\/p>\n<p>In finding a similar proportion for each outcome, we find that the relative frequency distribution of outcomes for all three years is as displayed in the following table.<\/p>\n<div style=\"margin: auto;\">\n<table style=\"width: 99.294%;\">\n<tbody>\n<tr>\n<td style=\"width: 9.17587%;\">\u00a0<\/td>\n<td style=\"width: 21.0705%;\"><strong>Percentage Adopted<\/strong><\/td>\n<td style=\"width: 19.966%;\"><strong>Percentage Returned to Owner<\/strong><\/td>\n<td style=\"width: 19.5412%;\"><strong>Percentage Transferred<\/strong><\/td>\n<td style=\"width: 19.2014%;\"><strong>Percentage Euthanized<\/strong><\/td>\n<td style=\"width: 9.7706%;\"><strong>Total<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 9.17587%;\"><strong>2022<\/strong><\/td>\n<td style=\"width: 21.0705%;\">[latex]50.4\\%[\/latex]<\/td>\n<td style=\"width: 19.966%;\">[latex]36.2\\%[\/latex]<\/td>\n<td style=\"width: 19.5412%;\">[latex]7.9\\%[\/latex]<\/td>\n<td style=\"width: 19.2014%;\">[latex]5.5\\%[\/latex]<\/td>\n<td style=\"width: 9.7706%;\">\n[latex]100\\%[\/latex]\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 9.17587%;\"><strong>2023<\/strong><\/td>\n<td style=\"width: 21.0705%;\">[latex]52.6\\%[\/latex]<\/td>\n<td style=\"width: 19.966%;\">[latex]30.3\\%[\/latex]<\/td>\n<td style=\"width: 19.5412%;\">[latex]8.3\\%[\/latex]<\/td>\n<td style=\"width: 19.2014%;\">[latex]8.8\\%[\/latex]<\/td>\n<td style=\"width: 9.7706%;\">[latex]100\\%[\/latex]<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 9.17587%;\"><strong>2024<\/strong><\/td>\n<td style=\"width: 21.0705%;\">[latex]55.3\\%[\/latex]<\/td>\n<td style=\"width: 19.966%;\">[latex]30.4\\%[\/latex]<\/td>\n<td style=\"width: 19.5412%;\">[latex]3.7\\%[\/latex]<\/td>\n<td style=\"width: 19.2014%;\">[latex]10.7\\%[\/latex]<\/td>\n<td style=\"width: 9.7706%;\">\n[latex]100\\%[\/latex]\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align: left;\">Using only the relative frequencies, do these distributions look significantly different? We&#8217;ll use a chi-square test of homogeneity to find out.<\/p>\n<\/div>\n<\/section>\n<p>In comparing the outcome distributions for these years, we\u2019ll build on two ideas we\u2019ve seen before. We\u2019ve already seen a test for determining whether two population proportions are equal: the two-proportion [latex]z[\/latex]-test. For example, we could think of the dogs leaving the shelter in each year as a sample and consider whether the proportion of dogs adopted in 2022 is the same as the proportion of dogs adopted in 2023.<\/p>\n<p>However, in this case, we\u2019re generalizing on that idea by considering more than two populations and looking at the entire distribution of outcomes for all values of the categorical variable. Secondly, we\u2019ll be building on the previous activity by using a chi-square test, but instead of comparing a distribution of counts to a theoretical model, we\u2019re comparing distributions of a categorical variable (in this case, <em>outcome<\/em>) among different populations (in this case, there are three populations: all dogs leaving the shelter in each of three different years).<\/p>\n<section class=\"textbox proTip\">The word \u201chomogeneous\u201d means the same or similar, so the <strong>chi-square test of homogeneity<\/strong> is asking whether or not two or more distributions of a categorical variable are the same.In short, a chi-square test of homogeneity compares distributions of one categorical variable for multiple populations.<\/section>\n<section class=\"textbox tryIt\"><iframe loading=\"lazy\" id=\"ohm2399\" class=\"resizable\" src=\"https:\/\/ohm.one.lumenlearning.com\/multiembedq.php?id=2399&theme=lumen&iframe_resize_id=ohm2399&source=tnh\" width=\"100%\" height=\"150\"><\/iframe><\/section>\n<hr class=\"before-footnotes clear\" \/><div class=\"footnotes\"><ol><li id=\"footnote-1412-1\">City of Long Beach, Animal Care Services. (n.d.). Animal shelter intakes and outcomes [Data set]. City of Long Beach Open Data. https:\/\/data.longbeach.gov\/explore\/dataset\/animal-shelter-intakes-and-outcomes\/information\/ Accessed via TidyTuesday, 2025-03-04: https:\/\/github.com\/rfordatascience\/tidytuesday\/tree\/main\/data\/2025\/2025-03-04 <a href=\"#return-footnote-1412-1\" class=\"return-footnote\" aria-label=\"Return to footnote 1\">&crarr;<\/a><\/li><\/ol><\/div>","protected":false},"author":8,"menu_order":19,"template":"","meta":{"_candela_citation":"[]","pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-1412","chapter","type-chapter","status-publish","hentry"],"part":1388,"module-header":"learn_it","content_attributions":[],"internal_book_links":[],"video_content":null,"cc_video_embed_content":{"cc_scripts":"","media_targets":[]},"try_it_collection":null,"_links":{"self":[{"href":"https:\/\/content.one.lumenlearning.com\/introstatstest\/wp-json\/pressbooks\/v2\/chapters\/1412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/content.one.lumenlearning.com\/introstatstest\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/content.one.lumenlearning.com\/introstatstest\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/introstatstest\/wp-json\/wp\/v2\/users\/8"}],"version-history":[{"count":14,"href":"https:\/\/content.one.lumenlearning.com\/introstatstest\/wp-json\/pressbooks\/v2\/chapters\/1412\/revisions"}],"predecessor-version":[{"id":7185,"href":"https:\/\/content.one.lumenlearning.com\/introstatstest\/wp-json\/pressbooks\/v2\/chapters\/1412\/revisions\/7185"}],"part":[{"href":"https:\/\/content.one.lumenlearning.com\/introstatstest\/wp-json\/pressbooks\/v2\/parts\/1388"}],"metadata":[{"href":"https:\/\/content.one.lumenlearning.com\/introstatstest\/wp-json\/pressbooks\/v2\/chapters\/1412\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/content.one.lumenlearning.com\/introstatstest\/wp-json\/wp\/v2\/media?parent=1412"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/introstatstest\/wp-json\/pressbooks\/v2\/chapter-type?post=1412"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/introstatstest\/wp-json\/wp\/v2\/contributor?post=1412"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/introstatstest\/wp-json\/wp\/v2\/license?post=1412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}