September 23rd, 2019
Choose independently two numbers B and C at random from the interval [0, 1] with uniform density. Prove that B and C are proper probability distributions. Note that the point (B,C) is then chosen at random in the unit square. Find the probability that
I am going to solve this problem by sumilating this data with 10,000 observations for each of these values (B and C). I will create a data frame with values from this dataset and calculate the probability based on the ratio of my observations. 10,000 observations should give me a large enough dataset for an accurate calculation.
n <- 10000
y <- as.data.frame(runif(n, min=0, max=1)+(runif(n, min=0, max=1)))
sum(punif(y<0.5, min=0, max=1)) / n
## [1] 0.1253
n <- 10000
y <- as.data.frame(runif(n, min=0, max=1)*(runif(n, min=0, max=1)))
sum(punif(y<0.5, min=0, max=1)) / n
## [1] 0.8514
n <- 10000
y <- as.data.frame(abs((runif(n, min=0, max=1)-(runif(n, min=0, max=1)))))
sum(punif(y<0.5, min=0, max=1)) / n
## [1] 0.7484
n <- 10000
y <- as.data.frame(pmax((runif(n, min=0, max=1)),(runif(n, min=0, max=1))))
sum(punif(y<0.5, min=0, max=1)) / n
## [1] 0.2522
n <- 10000
y <- as.data.frame(pmin((runif(n, min=0, max=1)),(runif(n, min=0, max=1))))
sum(punif(y<0.5, min=0, max=1)) / n
## [1] 0.7484