bayes-rules / bayesrules

📦 R package for Supplemental Materials for the Bayes Rules! Book
https://bayes-rules.github.io/bayesrules/docs/
GNU General Public License v3.0
70 stars 10 forks source link

Inconsistency in Chapter 2.2 : Pop vs Soda vs Coke and bayesrules package #86

Closed slackline closed 2 years ago

slackline commented 2 years ago

Just started working my way through your book, thanks for making it freely available on line.

In Chapter 2.2 the table 2.5 shows...

region M N S W Total
probability 0.21 0.17 0.38 0.24 1

Where...

M = Midwest N = Northeast S = South W = West

But if I load bayesrules package the frequencies match but the regions are different...

library(bayesrules)
library(janitor)
library(tidyverse)
data(pop_vs_soda)
pop_vs_soda |>
  tabyl(region)
+     region      n   percent
   midwest 145096 0.3876981
 northeast  77188 0.2062472
     south  90164 0.2409192
      west  61802 0.1651356 

Its not the South (S) that is the most populous, rather its Midwest (M).

The percentages of pop by region tally with the book...

  tabyl(pop, region) |>
  adorn_percentages("col")
+ +    pop   midwest northeast      south      west
 FALSE 0.3552958 0.7266026 0.92077769 0.7057215
  TRUE 0.6447042 0.2733974 0.07922231 0.2942785

Version of bayesrules installed is 0.0.2 which I installed this evening.

Couldn't find the source bookdown code to submit an issue there hence raising it here.

ajohns24 commented 2 years ago

Thanks for catching this @slackline! In the coming weeks, we'll fix this in the online book...and hopefully be able to fix it in the print version before it goes to press.

slackline commented 2 years ago

You're welcome @ajohns24 and not a problem at all.

ajohns24 commented 2 years ago

I re-read this section. The population statistics are taken from the census, not the survey data (which doesn't reflect regional breakdowns). This is stated in the discussion, though admittedly easy to miss.

slackline commented 2 years ago

My apologies @ajohns24 I should have read the whole section, I hope I didn't waste too much of your time.

ajohns24 commented 2 years ago

Absolutely no apologies!

On Wed, Dec 1, 2021 at 10:25 AM slackline @.***> wrote:

My apologies @ajohns24 https://github.com/ajohns24 I should have read the whole section, I hope I didn't waste too much of your time.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bayes-rules/bayesrules/issues/86#issuecomment-983809535, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADDOVOSKKNIPH3BWQJBXJM3UOZD67ANCNFSM5GWFP6XA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- Alicia Johnson she/her Associate Professor Mathematics, Statistics, and Computer Science Macalester College