Easy

2E1

The expressions that corresponds to the statement “The probability of Rain on Monday” are: Pr(rain|Monday) and Pr(rain,Monday) / Pr(Monday)

2E2

The statement that corresponds to Pr(Monday|rain) is “The probability that it is Monday, given that it is raining.

2E3

Pr(Monday|rain) and Pr(rain|Monday) * Pr(Monday) / Pr(rain)

2E4

Given our limited knowledge and the results of the experiment, we believe that the true proportion of water in the globe is 0.7.

Medium

2M1

1:

#Grid approximation with 1000 points
prior <- rep(1, 1000)
p_grid <- seq(from=0, to=1, length.out = 1000)

likelihood <- dbinom(3, 3, prob = p_grid)

unstd.posterior <- prior * likelihood

posterior <- unstd.posterior / sum(unstd.posterior)
plot(p_grid, posterior, type="b",
     ylab="Posterior Probability",
     xlab = "Probability of Water")

2:

#Grid approximation with 1000 points
prior <- rep(1, 1000)
p_grid <- seq(from=0, to=1, length.out = 1000)

likelihood <- dbinom(3, 4, prob = p_grid)

unstd.posterior <- prior * likelihood

posterior <- unstd.posterior / sum(unstd.posterior)
plot(p_grid, posterior, type="b",
     ylab="Posterior Probability",
     xlab = "Probability of Water")

3:

#Grid approximation with 1000 points
prior <- rep(1, 1000)
p_grid <- seq(from=0, to=1, length.out = 1000)

likelihood <- dbinom(5, 7, prob = p_grid)

unstd.posterior <- prior * likelihood

posterior <- unstd.posterior / sum(unstd.posterior)
plot(p_grid, posterior, type="b",
     ylab="Posterior Probability",
     xlab = "Probability of Water")

2M2

1:

prior <- ifelse(p_grid < 0.5, 0, 1)
p_grid <- seq(from=0, to=1, length.out = 1000)

likelihood <- dbinom(3, 3, prob = p_grid)

unstd.posterior <- prior * likelihood

posterior <- unstd.posterior / sum(unstd.posterior)
plot(p_grid, posterior, type="b",
     ylab="Posterior Probability",
     xlab = "Probability of Water")

2:

prior <- ifelse(p_grid < 0.5, 0, 1)
p_grid <- seq(from=0, to=1, length.out = 1000)

likelihood <- dbinom(3, 4, prob = p_grid)

unstd.posterior <- prior * likelihood

posterior <- unstd.posterior / sum(unstd.posterior)
plot(p_grid, posterior, type="b",
     ylab="Posterior Probability",
     xlab = "Probability of Water")

3:

prior <- ifelse(p_grid < 0.5, 0, 1)
p_grid <- seq(from=0, to=1, length.out = 1000)

likelihood <- dbinom(5, 7, prob = p_grid)

unstd.posterior <- prior * likelihood

posterior <- unstd.posterior / sum(unstd.posterior)
plot(p_grid, posterior, type="b",
     ylab="Posterior Probability",
     xlab = "Probability of Water")

2M3

Pr(water|Earth) = 0.7 so Pr(land|Earth) = 0.3 Pr(land|Mars) = 1

Pr(Mars) = 0.5 Pr(Earth) = 0.5

We want Pr(Earth|land):

Pr(Earth|land) = Pr(land|Earth) * Pr(Earth) / Pr(land)

which expands to:

Pr(Earth|land) = Pr(land|Earth) * Pr(Earth) / (Pr(land|Earth) * Pr(Earth) + Pr(land|Mars) * Pr(Mars))

which ends up being:

Pr(Earth|land) = 0.3 * 0.5 /(0.3 * 0.5 + 1 * 0.5)

0.3 * 0.5 /(0.3 * 0.5 +1 * 0.5)
## [1] 0.2307692

2M4

Card1: B/B Card2: B/W Card3: W/W

If we observed one black side up, there are 2 ways of producing the black side up if we pick the B/B card and one way if we pick the B/W card, so in total, 2 of 3 ways are consistent with the other side of the card being black. The answer is 2/3.

2M5

With an extra B/B card:

If we observe one black side up, there are 4 ways of producing the black side up (2 for each B/B card) and 1 for picking the B/W card. The total probability that the other side is black is thus: 4/5

2M6

Card1: B/B Card2: B/W Card3: W/W

Black sides are heavier than cards with white sides so it is less likely that a card with black sides is pulled from the bag.

There are still 2 ways for B/B to produce a black side up, 1 way for B/W and zero ways for W/W. But according to the prior information, there is 1 way to get the B/B card, 2 ways to get the B/W card and 3 ways to get the W/W card so:

The total ways for the B/B card to produce a black side up are 2 * 1 and the total ways for the B/W card to produce a black side up are 1 * 2.

So, there are 4 ways total to see a black side up and 2 of these come from the B/B card so:

2/4
## [1] 0.5

2M7

Card1: B/B Card2: B/W Card3: W/W

The B/B card has 2 ways to produce an observation with the black side up. This leaves the B/W and the W/W card with the job of producing the next observation. The B/W has only 1 way to produce a white side up while the W/W has 2 ways. So there are 3 ways to get the second card to show the white side up. Assuming the first card is B/B, there are 6 ways to see the BW sequence.

If however the B/W card is drawn first, there is 1 way for it to show the black side up. This leaves the other two cards to show the white side up. The B/B can’t show white while W/W has 2 ways to show white up so that is 2 ways to see the sequence Black and White when the first card drawn is B/W.

The probability is thus: 8 total ways of producing the sequence BW with 6 ways with B/B being drawn first.

6/8
## [1] 0.75

2H1

We are trying to find the probability that the second birth is twins, knowing that the first birth was twins.

Pr(twin2|twin1) = Pr(twin1 & twin2) / Pr(twins)

Pr(twins) = 1/2 * (0.1) + 1/2 * (0.2) for species A and B respectively

Pr of a Species A female having two twins is: 1/2 * (0.1 * 0.1)

Pr of a Species B female having two twins is: 1/2 * (0.2 * 0.2)

Thus:

Pr_twins <- 0.5 * 0.1 + 0.5 * 0.2
Pr_twin1and2 <- 0.5 * (0.1 * 0.1) + 0.5 * (0.2 * 0.2)

Final_pr <- Pr_twin1and2 / Pr_twins
Final_pr
## [1] 0.1666667

2H2

We are now trying to find Pr(SpeciesA|Twins)

According to Bayes’ Theorem this equals:

Pr(Twins|SpeciesA) * Pr(SpeciesA) / Pr(Twins)

The result thus is:

(0.1 * 0.5) / 0.15
## [1] 0.3333333

2H3

Now this is an interesting problem concerning Bayesian Updating.

From the previous problem we know the posterior probability of being Species A is 1/3. This will be the new prior for this problem

We are thus trying to find Pr(SpeciesA|Singleton) = Pr(Singleton|SpeciesA) * Pr(SpeciesA) / Pr(Singleton)

This ends up being:

SpeciesA <- 1/3
Singleton <- 1/3 * (0.9) + 2/3 * (0.8)

Final_Pr <- (0.9 * SpeciesA) / Singleton
Final_Pr
## [1] 0.36

2H4

Pr(+|SpeciesA) = 0.8 Pr(+|SpeciesB) = 0.65

Without previous information

Pr(SpeciesA|+) = Pr(+|SpeciesA) * Pr(SpeciesA) / Pr(+) (which expands to Pr(+|SpeciesA) * Pr(SpeciesA) + Pr(+|SpeciesB) * Pr(SpeciesB))

Pr(+) = 0.8 * 0.5 + 0.65 * 0.5 Pr(SpeciesA) = 0.5

positive_prob <- 0.8 * 0.5 + 0.65 * 0.5
SpeciesA <- 0.5
Final_Pr <- (0.8 * 0.5) / positive_prob
Final_Pr
## [1] 0.5517241

With previous information

Pr(SpeciesA) = 0.36

positive_prob <- 0.36 * 0.8 + (1-0.36) * 0.65
SpeciesA <- 0.36
Final_Pr <- (0.8 * 0.36) / positive_prob
Final_Pr
## [1] 0.4090909