Last year, I noticed that Snickers bars seem to taste different in different countries, but I was not sure. So my partner Nellissa and I conducted a little experiment that involved a lot of chocolate and a little Bayesian statistics.
We wanted to establish whether Snickers bars from different countries taste different or not. To this end, we collected three Snickers bars, one from England (GB), one from Germany (DE), and one from Vietnam (VN). There are five plausible hypothesis:
All Snickers bars taste the same: H=
All Snickers bars taste different: H=
The German and English bars are identical, but the Vietnamese is different: HVN
The German and Vietnamese bars are identical, but the English is different: HGB
The English and Vietnamese bars are identical, but the German is different: HDE
FIGURE 1: Slicing up Snickers bars from three different countries in preparation of the experiment.
During the experiment we sliced the three bars into 12 slices each. Then we randomly paired slices and assessed whether they tasted the same or not. For example, one measurement may result in the observation DE=GB and another measurement may result in GB=VN. In addition, we also compare Snickers bars to themselves, so we might obtain VN=VN. We can perform a Bayesian update (explained below) on the above hypotheses after each measurement.
The measurement is subjective and may be affected by substantial noise. In particular, given two samples the experimenter may decide they taste different, even though they are equal, or vice versa. For simplicity, we assume a single failure rate ϵ for all experiments. Given one sample pair, the probability that any experimenter misjudges the equality of the samples is ϵ, thus ϵ∈[0,1].
To make the five hypotheses that we have introduced above more explicit, we write down the outcome probabilities of an experiment (likelihoods), given that the hypothesis k is true and ϵ is known.
Before we performed the experiment, we formulated the following prior beliefs. We assigned equal probabilities to all five hypothesis, i.e.
P(H=)=P(H=)=P(HGB)=P(HDE)=P(HVN)=1/5
In addition, we were uncertain about the failure rate ϵ. Therefore, we split each of the five hypotheses into sub-hypotheses with different values for ϵ. Specifically, we define the cases {ϵ∈[0.0,0.1],ϵ∈[0.1,0.2],…,ϵ∈[0.9,1.0]} and assign the following prior probabilities to the different epsilons:
FIGURE 2: Prior probability mass distribution for the failure rate ϵ. The probabilities are chosen subjectively, arguing that our failure rate is probably not greater than 50%, but most likely around 25%. Of course we might be over-confident in our sense of taste, but the data will show if that is the case.
For simplicity we assumed that Nellissa and I both have the same failure rate, and we also assumed that ϵ is independent of the hypothesis, i.e.
P(Hk,ϵ)=P(Hk)P(ϵ).
Thus, we can display the whole probability space in a contour plot, as shown in Figure 3.
FIGURE 3: Contour plot of the assumed prior probability distribution. Darker colors correspond to higher probability.
When we collect a datum such as DE=VN, we update our believes (probabilities) according to Bayes’ theorem:
P(Hk,ϵ∣x)=P(x∣Hk,ϵ)P(Hk,ϵ)/P(x).
where x is the datum and we can expand the probability to observe x into
P(x)=k,i∑P(x∣Hk,ϵi)P(Hk)P(ϵi).
With a little bit of code, we can now explore how each datum changes our belief map, according to Bayes’ theorem above:
Change of our belief map due to the data we collected. The most likely hypothesis is HVN, i.e. the German and English Snickers are identical, but the Vietnamese Snickers is different from the two.
The most probable hypothesis is thus that the German and English Snickers bars are the same, but the Vietnamese Snickers bar is different (HVN), and that our failure rate ϵ is 30% to 40%.
The conclusion changes, however, when only mine or Nellissa’s measurements are taken into account. Here is a little video, where I explore the data with a little app I wrote.
Much more insight can be gained from the belief maps shown in the video above, but I leave this to you, dear reader, to think about the results. I, for my part, have had enough Snickers bars for a lifetime.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the ...
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.