To help my thoughts, I define:
p_rain <- 1/3 p_monday <- 1/7
(1) Yes: the probability of rain is independent of which day it is; knowing the day does not give you any new information (2) Yes: the is simply the notation of the verbal sentence (3) No: the chance that it is Monday is independent of which weather it is. The probability of Monday is something else than the probability of rain. Note that their values are the same in countries with a chance of rain of 1/7 (4) Yes: the chance of rain and Monday are 1/21 (it happens once per 21 days on average). Dividing this by the chance it is Monday, results in the chance it rains. You could read the notation as 'the chance of rain and Monday per chance it is Monday'
p_rain <- p_rain # 1 p_rain_on_monday <- p_rain #2 p_monday_on_rainy_day <- p_monday # 3 p_rain_and_monday_per_monday <- p_rain * p_monday / p_monday # 4
Now the answers
answer_1 <- p_rain_on_monday == p_rain answer_2 <- p_rain_on_monday == p_rain_on_monday answer_3 <- p_rain_on_monday == p_monday_on_rainy_day answer_4 <- p_rain_on_monday == p_rain_and_monday_per_monday
Answers:
r answer_1
r answer_2
r answer_3
r answer_4
Pr(rain, Monday)
Pr(rain| Monday)
Pr(Monday| rain)
Pr(Monday, rain)
If the probability of water is 70%, this means that 70% of the Earth is covered with water.
This is the number of probabilities we will investigate:
n_probabilities <- 20 testit::assert(n_probabilities >= 1)
Our experiment involves throwing n_throws
times and observing
water n_water
times.
n_throws <- 9 n_water <- 6 testit::assert(n_water <= n_throws)
Here we create a range of n_probabilities
probabilities from 0 to 1.
p_grid <- seq(from = 0, to = 1, length.out = n_probabilities) plot(p_grid, main = "The p_grid values")
Our prior knowledge is that we assume all probabilities are equally likely:
prior <- rep(1, n_probabilities) plot(prior, main = "Prior", type = "b")
Using the binomial distribution, we can calculatethe likelihood
of having n_water
times water out of n_throws
throws, for
our range of probabilities:
likelihood <- dbinom(n_water, size = n_throws, prob = p_grid) plot(likelihood, main = "Likelihood", type = "b")
We can get our marginal posterior:
posterior <- likelihood * prior / sum(likelihood * prior) #unstd_posterior <- likelihood * prior / sum(likelihood * prior) #posterior <- unstd_posterioir / sum(unstd_posterior) plot(p_grid, posterior, main = "Posterior", type = "b")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.