d <-
tibble(
# definiere die Hypothesen (das "Gitter"):
p_Gitter = 0:100 / 101,
# bestimme den Priori-Wert:
Priori = 1) %>%
mutate(
# berechne Likelihood für jeden Gitterwert:
Likelihood = p_Gitter,
# berechen unstand. Posteriori-Werte:
unstd_Post = Likelihood * Priori,
# berechne stand. Posteriori-Werte (summiert zu 1):
Post = unstd_Post / sum(unstd_Post)) kekse02
probability
bayesbox
num
paper
Aufgabe
In Think Bayes stellt Allen Downey folgende Aufgabe:
“Next let’s solve a cookie problem with 101 bowls:
Bowl 0 contains 0% vanilla cookies,
Bowl 1 contains 1% vanilla cookies,
Bowl 2 contains 2% vanilla cookies,
and so on, up to
Bowl 99 contains 99% vanilla cookies, and
Bowl 100 contains all vanilla cookies.
As in the previous version, there are only two kinds of cookies, vanilla and chocolate. So Bowl 0 is all chocolate cookies, Bowl 1 is 99% chocolate, and so on.
Suppose we choose a bowl at random, choose a cookie at random, and it turns out to be vanilla. What is the probability that the cookie came from Bowl \(x\), for each value of \(x\)?”
Hinweise:
- Untersuchen Sie die Hypothesen \(\pi_0 = 0, \pi_1 = 0.1, \pi_2 = 0.2, ..., \pi_{10} = 1\) für die Trefferwahrscheinlichkeit
- Erstellen Sie ein Bayes-Gitter zur Lösung dieser Aufgabe.
- Gehen Sie davon aus, dass Sie (apriori) indifferent gegenüber der Hypothesen zu den Parameterwerten sind.
- Geben Sie Prozentzahlen immer als Anteil an und lassen Sie die führende Null weg (z.B. .42).
Lösung
| p_Gitter | Priori | Likelihood | unstd_Post | Post |
|---|---|---|---|---|
| 0.00 | 1 | 0.00 | 0.00 | 0 |
| 0.01 | 1 | 0.01 | 0.01 | 0 |
| 0.02 | 1 | 0.02 | 0.02 | 0 |
| 0.03 | 1 | 0.03 | 0.03 | 0 |
| 0.04 | 1 | 0.04 | 0.04 | 0 |
| 0.05 | 1 | 0.05 | 0.05 | 0 |
| 0.06 | 1 | 0.06 | 0.06 | 0 |
| 0.07 | 1 | 0.07 | 0.07 | 0 |
| 0.08 | 1 | 0.08 | 0.08 | 0 |
| 0.09 | 1 | 0.09 | 0.09 | 0 |

Aufgabenname: kekse02
Categories:
- probability
- bayesbox
- num