Data 605 Assignment 5
Create Two Uniform Distributions
B <- runif(10000000, min = 0, max = 1)
C <- runif(10000000, min = 0, max = 1)
hist(B)
hist(C)
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
B + C < 1/2.
.125
X <- B + C
hist(X, main = "Histogram of B + C")
sum(X < .5) / 10000000
## [1] 0.1250159
BC < 1/2
.846
X <- B * C
hist(X, main = "Histogram of B x C")
sum(X < .5) / 10000000
## [1] 0.8467004
|B − C| < 1/2
.75
X <- abs(B - C)
hist(X, main = "Histogram of |B − C|")
sum(X < .5) / 10000000
## [1] 0.7499855
max{B,C} < 1/2
.25
X <- pmax(B,C)
hist(X, main = "Histogram of max{B,C}")
sum(X < .5) / 10000000
## [1] 0.2501383
min{B,C} < 1/2
.75
X <- pmin(B,C)
hist(X, main = "Histogram of min{B,C}")
sum(X < .5) / 10000000
## [1] 0.7499471