To say that "the probability of water is 0.7" is a reflection of our certainty that the globe will yield water. It is an epistemological claim about us as an observer, not an absolute, objective claim about the mechanics of the globe. With an accurate enough physical model we could predict with far greater than 0.7 accuracy whether the globe will yield water or land.
Here we use some of the code from the pymc-devs Python/pymc3 port of the Statistical Rethinking code examples.
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
def posterior_grid_approx_2m1(grid_points=5, water=3, tosses=3):
p_grid = np.linspace(0, 1, grid_points)
# Doesn't really matter what the number is here in the prior, as long as it's uniform.
prior = np.repeat(100, grid_points)
likelihood = stats.binom.pmf(water, tosses, p_grid)
unstd_posterior = likelihood * prior
posterior = unstd_posterior / unstd_posterior.sum()
return p_grid, posterior
def plot_posterior(p_grid, posterior):
plt.plot(p_grid, posterior, 'o-', label=f'success = {w}\ntosses = {n}')
plt.xlabel('probability of water', fontsize=14)
plt.ylabel('posterior probability', fontsize=14)
plt.title(f'{points} points')
plt.legend(loc=0);
points = 20
w, n = 3, 3
p_grid, posterior = posterior_grid_approx_2m1(points, w, n)
plot_posterior(p_grid, posterior)
points = 20
w, n = 3, 4
p_grid, posterior = posterior_grid_approx_2m1(points, w, n)
plot_posterior(p_grid, posterior)
points = 20
w, n = 5, 7
p_grid, posterior = posterior_grid_approx_2m1(points, w, n)
plot_posterior(p_grid, posterior)
def posterior_grid_approx_2m2(grid_points=5, water=3, tosses=3):
p_grid = np.linspace(0, 1, grid_points)
# Doesn't really matter what the number is here in the prior, as long as it's uniform.
prior = np.repeat(100, grid_points)
prior = (p_grid >= 0.5)*1
likelihood = stats.binom.pmf(water, tosses, p_grid)
unstd_posterior = likelihood * prior
posterior = unstd_posterior / unstd_posterior.sum()
return p_grid, posterior
points = 20
w, n = 3, 3
p_grid, posterior = posterior_grid_approx_2m2(points, w, n)
plot_posterior(p_grid, posterior)
points = 20
w, n = 3, 4
p_grid, posterior = posterior_grid_approx_2m2(points, w, n)
plot_posterior(p_grid, posterior)
points = 20
w, n = 5, 7
p_grid, posterior = posterior_grid_approx_2m2(points, w, n)
plot_posterior(p_grid, posterior)
Now substituting in the known values in their respective locations:
(0.3*0.5)/(0.3*0.5 + 1*0.5)
0.23076923076923075
This is a rewording of Bertrand's box paradox.
Personally, the difficulty with this problem is not the counterintuitive answer, but converting the information we know about the problem into the language of probability.
We want to know: $P(\text{black down}|\text{black up})$
$$P(\text{black down}|\text{black up}) = \frac{P(\text{black down}, \text{black up})}{P(\text{black up})}$$$$= \frac{P(\text{black down}, \text{black up})}{P(\text{black up})}$$$$= \frac{P(\text{black down}, \text{black up})}{\sum_{c \in \text{cards}}P(\text{black up}|c)P(c)}$$$$= \frac{P(\text{B/B card})}{P(\text{black up}|\text{B/B card})P(\text{B/B card})+P(\text{black up}|\text{B/W card})P(\text{B/W card})}$$We omit the third term in the denominator that corresponds to the $W/W$ card since we know it can't show a black face and so that term is 0. Substituting in known probabilities:
(1/3)/(1*(1/3) + (1/2)*(1/3))
0.6666666666666666
Substituting the values in:
(2/4)/(1*(2/4) + (1/2)*(1/4) + (0)*(1/4))
0.8
(1/6)/(1*(1/6) + (1/2)*(2/6) + (0)*(3/6))
0.5
This is a bit more overwhelming, but all the same rules apply. The sums are there to marginalize out variables, and we omit terms where we know the probability is zero.
$$P(\text{black down card 1}|\text{black up card 1},\text{white up card 2})$$$$=\frac{P(\text{B/B card 1}, \text{white up card 2})}{P(\text{black up card 1},\text{white up card 2})}$$$$=\frac{P(\text{B/B card 1})P(\text{white up card 2}|\text{B/B card 1})}{P(\text{black up card 1},\text{white up card 2})}$$$$=\frac{P(\text{B/B card 1})P(\text{white up card 2}|\text{B/B card 1},\text{B/W card 2}) + P(\text{B/B card 1})P(\text{white up card 2}|\text{B/B card 1},\text{W/W card 2})}{P(\text{black up card 1},\text{white up card 2})}$$$$=\frac{P(\text{B/B card 1})P(\text{white up card 2}|\text{B/B card 1},\text{B/W card 2}) + P(\text{B/B card 1})P(\text{white up card 2}|\text{B/B card 1},\text{W/W card 2})}{P(\text{B/B card 1})P(\text{B/W card 2, white up})+P(\text{B/B card 1})P(\text{W/W card 2, white up)}+P(\text{B/W card 1})P(\text{W/W card 2, white up)}}$$((1/3)*(1/2)*(1/2) + (1/3)*(1/2))/((1/3)*(1/2)*(1/2) + (1/3)*(1/2)*1 + (1/3)*(1/2)*(1/2))
0.75
I honestly found these hard questions in some ways easier than some of the medium ones above, because for the above questions I found a bit tricky to translate the words into the language of probability.
$$P(\text{twins}|A) = 0.1$$$$P(\text{single}|A) = 0.9$$$$P(\text{twins}|B) = 0.2$$$$P(\text{single}|B) = 0.8$$$$P(A) = P(B) = 0.5$$$$P(\text{next twins} | \text{last twins}) = \frac{P(\text{next twins},\text{last twins})}{P(\text{last twins})}$$Assuming conditional independence of the first and second births being twins, given the species:
$$\frac{P(\text{twins}|A)P(A)P(\text{twins}|A) + P(\text{twins}|B)P(B)P(\text{twins}|B)}{\sum_{s \in species} P(\text{twins}|s)P(s)}$$Substituting in the respective values:
(0.1*0.5*0.1 + 0.2*0.5*0.2)/(0.1*0.5 + 0.2*0.5)
0.16666666666666669
Substituting in the respective values:
(0.1*0.5)/(0.1*0.5 + 0.2*0.5)
0.3333333333333333
(0.1*0.9*0.5)/(0.1*0.9*0.5 + 0.2*0.8*.5)
0.36
Substituting in the respective values:
(0.8*0.5)/(0.8*0.5 + 0.35*0.5)
0.6956521739130436