Caution
Section omitted to comply with the Honor Code
Bayesian Statistics: From Concept to Data Analysis
Oren Bochman
Conditional Probability, Bayes’ Law, Homework
Section omitted to comply with the Honor Code
---
title: "Paradigms of probability - M1L1HW1"
subtitle: "Bayesian Statistics: From Concept to Data Analysis"
categories:
- Bayesian Statistics
keywords:
- Conditional Probability
- Bayes' Law
- Homework
---
:::: {.content-visible unless-profile="HC"}
::: {.callout-caution}
Section omitted to comply with the Honor Code
:::
::::
:::: {.content-hidden unless-profile="HC"}
::: {#exr-paradigms-1}
[**paradigms**]{.column-margin}
If you randomly guess the answer to this question, you have a .25 probability of being correct. Which probabilistic paradigm from Lesson 1 does this argument best demonstrate?
:::
::: {.solution .callout-tip collapse="true"}
#### Solution:
Classical
:::
::: {#exr-paradigms-2}
[**paradigms**]{.column-margin}
On a multiple-choice test, you do not know the answer to a question with three alternatives. One of the options, however, contains a keyword that the professor used disproportionately often during lectures. Rather than randomly guessing, you select the option containing the keyword, supposing you have a better than 1/3 chance of being correct.
:::
::: {.solution .callout-tip collapse="true"}
#### Solution:
Bayesian
:::
::: {#exr-paradigms-3}
[**paradigms**]{.column-margin}
On average, one in three students at your school participates in extracurricular activities. You conclude that the probability that a randomly selected student from your school participates is 1/3. Which probabilistic paradigm from Lesson 1 does this argument best demonstrate?
:::
::: {.solution .callout-tip collapse="true"}
#### Solution:
Frequentist
:::
[**Chess**]{.column-margin} For Questions [@exr-paradigms-4]-[@exr-paradigms-6], consider the following scenario:
Your friend offers a bet that she can beat you in a game of chess. If you win, she owes you USD 5, but if she wins, you owe her 3 USD.
::: {#exr-paradigms-4}
[**Chess**]{.column-margin}
Suppose she is 100% confident that she will beat you. What is her expected return for this game?
:::
::: {.solution .callout-tip collapse="true"}
#### Solution:
If she is certain she will win, then she can expect to receive 3 USD.
$3 \cdot (1) − 5 \cdot (0)$.
:::
::: {#exr-paradigms-5}
[**Chess**]{.column-margin}
Suppose she is only 50% confident that she will beat you (her `personal` probability of winning is $p=0.5$). What is her expected return now?
:::
::: {.solution .callout-tip collapse="true"}
#### Solution:
$3 \cdot (0.5) − 5 \cdot (0.5) = -1$.
:::
::: {#exr-paradigms-6}
[**Chess**]{.column-margin}
Now assuming your friend will only agree to fair bets (expected return of 0 USD), find her `personal` probability that she will win.
:::
::: {.solution .callout-tip collapse="true"}
#### Solution:
Any value of $p$ (the probability of her winning) lower than $\frac{5}{8}$ would result in a negative expected return for your friend. She would not have offered these odds for such a $p$
:::
[**Dutch book**]{.column-margin} For Questions [@exr-paradigms-7]-[@exr-paradigms-8], consider the following "Dutch book" scenario:
Suppose your friend offers a pair of bets:
- **B1**: if it rains or is overcast tomorrow, you pay him 4 USD, otherwise, he pays you 6 USD.
- **B2**: if it is sunny you pay him 5 USD, otherwise, he pays you 5 USD.
::: {#exr-paradigms-7}
[**Dutch book**]{.column-margin}
Suppose `rain` and `overcast` are the only events in consideration. If you make both bets simultaneously, this is called a "Dutch book," as you are guaranteed to win money. How much do you win regardless of the outcome?
:::
::: {.solution .callout-tip collapse="true"}
#### Solution:
```{python}
#| label: C1-L01-Ex1-1
import pandas as pd
def l01q07():
p = {'overcast':1/3,'sunny':1/3}
o1 = {'overcast':-4,'sunny':6}
o2 = {'overcast':5,'sunny':-5}
dutch_df=pd.DataFrame({'o1':o1,'o2':o2})
return dutch_df.sum(axis=1)
l01q07()
```
:::
::: {#exr-paradigms-8}
[**Dutch book**]{.column-margin}
Your friend doesn't understand the laws of probability. Let's examine the bets he offered:
1. For bet 1 to be `fair`, his probability that it is `overcast` must be .6 (you can verify this by calculating his expected return and setting it equal to 0 USD).
2. For bet 2 to be `fair`, his probability that it will be `sunny` must be .5.
This results in a "Dutch book" because your friend's probabilities are not coherent. They do not add up to 1.
What do they add up to?
:::
::: {.solution .callout-tip .column-page-inset-right collapse="true"}
#### Solution:
$$
\begin{aligned}
0 & \stackrel{set}{=} \mathbb{E}(B1) && \text{fairness defn}
\\ &= -4 \mathbb{P}r( overcast) + 6 \mathbb{P}r(sunny) && \text{bet 1 terms}
\\ &= -4 \mathbb{P}r( overcast) + 6 [1-\mathbb{P}r( overcast)] && \text{prob. complement}
\\ &= -4 \mathbb{P}r( overcast) + 6-6\mathbb{P}r( overcast) && \text{expanding}
\\ 10 \mathbb{P}r(overcast) &= 6 && \text{collecting}
\\ \mathbb{P}r(overcast) &= 0.6
\\
\\ 0 & \stackrel{set}{=} \mathbb{E}(B2) && \text{fairness def}
\\ &= 5 \mathbb{P}r(overcast) - 5 \mathbb{P}r(sunny) && \text{bet 2 terms}
\\ &= 5 [1-\mathbb{P}r(sunny)] - 5 \mathbb{P}r(sunny) && \text{prob. complement}
\\ &= 5 -5 \mathbb{P}r(sunny) - 5 \mathbb{P}r(sunny) && \text{expanding }
\\ 10 \mathbb{P}r(sunny) &= 5 && \text{ collecting}
\\ \mathbb{P}r(sunny) &= 0.5
\\ \therefore \mathbb{P}r(sunny) + \mathbb{P}r( overcast) &= 1.1 && \text{incoherent (dutch book)}
\end{aligned}
$$
:::
note:
These exercises introduced some bets and let us look at different notions of a fair bet $B1$ more concretely. We determine fairness by setting Expected payoffs to be zero for the opposite bet $\hat{B1}$
$$
\begin{aligned}
\mathbb{E}[\mathbb{P}r(B1) - \mathbb{P}r(\bar{B1})] &= \text{payoff}(B1) \times \mathbb{P}r(B1) - \text{payoff}(\bar{B1}) \times \mathbb{P}r(\bar{B1}) = 0 \\
&= \text{payoff}(B1) \times \mathbb{P}r(B1) - \text{payoff}(\bar{B1}) \times 1(- \mathbb{P}r(B1)) = 0
\end{aligned}
$$
We also saw a couple of bets that are not coherent - I.E. although the events are mutually exclusive, their probabilities do not add up to one. This means some combinations will always lose and others always win money. We call this a `Dutch Book`
::::