The more you toss, the more you learn
Imagine you are a frequentist (just for a day), and you've been tasked with estimating the probability of tossing heads with a (possibly biased) coin, but without observing any tosses. What would you say? It's impossible, there is no data! Then, you are allowed to flip the coin once. You get tails. What do you say now? Well, if that's all your data, you'd say the heads probability is 0%.
You can probably feel deep inside that these answers are not the best ones. But what would be better? What would a Bayesian say? Let's find out! numpy
and seaborn
have been imported for you as np
and sns
, respectively.
This exercise is part of the course
Bayesian Data Analysis in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Estimate and plot heads probability based on no data
heads_prob_nodata = ____
____(____, shade=True, label="no data")
plt.show()