2.6 Example Pop vs Soda vs Coke

Define the prior probability model.

prior <- c("midwest" = 0.21, "northeast" = 0.17, "south" = 0.38, "west" = 0.24)
Prior probability model
region midwest northeast south west
probability 21.0% 17.0% 38.0% 24.0%
likelihood <- pop_vs_soda |> 
  tabyl(pop, region) |> 
  adorn_percentages("col") |> 
  filter(pop) |> 
  select(-pop)
Data model (likelihoods)
region midwest northeast south west
likelihood 64.5% 27.3% 7.9% 29.4%
posterior <- prior * likelihood / sum(prior * likelihood)
Posterior porbability model
midwest northeast south west
prior 21.0% 17.0% 38.0% 24.0%
likelihood 64.5% 27.3% 7.9% 29.4%
posterior 47.9% 16.4% 10.7% 25.0%

We can summarize the key observations from this analysis is the form of the below graph.