Data 605 Assignment 5
library(knitr)
library(rmdformats)
## Global options
options(max.print="31")
opts_chunk$set(echo=FALSE,
cache=TRUE,
prompt=FALSE,
tidy=TRUE,
comment=NA,
message=FALSE,
warning=FALSE)
opts_knit$set(width=31)Question 0
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.
Ans:
To prove B is a proper probability distribution, it suffies to show that its (empirical) CDF is 1 and comprises of individual pdf’s that are between 0 and 1. Here goes the checks for B.
Empirical CDF: 100000 unique values with summary
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.0000166 0.2494526 0.4988924 0.4990694 0.7485272 0.9999714
Same checks go for C.
Empirical CDF: 99999 unique values with summary
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.000004 0.249426 0.499106 0.500159 0.749656 0.999999
Both results checked out.
Find the probability that
(a) B + C < 1/2
Let B = x and C = y.
f(B,C) = f(x,y)
P(B+C > 1/2) = P(x + y < 1/2)
y < 1/2 - x
Now we integrate the function \[\begin{multline*} \begin{split} \int_{0}^{1/2}\int_{0}^{(1/2)-x} f(x,y) dxdy \\ &= \int_{0}^{1/2}\int_{0}^{(1/2)-x} 1 dxdy \\ &= \int_{0}^{1/2} ((\frac{1}{2}-x ) - 0) dy \\ &= ((\frac{1}{2}) (\frac{1}{2}) - \frac{(\frac{1}{2})^2}{2} ) - (0 - 0) \\ &= \frac{1}{4} - \frac{1}{8} \\ &= \frac{1}{8} \end{split} \end{multline*}\]
Therefore, the probability that B+C < 1/2 = 1/8 or 12.5%
(b) BC < 1/2
B = 1 and C = 1/2. Let B = x, C = y. Then P(BC < 1/2) = P(xy < 1/2).
y < 1/2x.
\[\begin{multline*} \begin{split} \int_{0}^{1/2}\int_{0}^{1} \frac{1}{2} dxdy + \int_{1/2}^{1}\int_{0}^{1/2x} f(x,y) dxdy \\ &= \int_{0}^{1/2}\frac{y}{2}dy + \int_{1/2}^{1}\int_{0}^{1/2x} 1 dxdy \\ &= \frac{1}{2} + \int_{1/2}^{1}(\frac{1}{2y} - 0) dy \\ &= \frac{1}{2} + \frac{1}{2}( \ln(1) - \ln\frac{1}{2})\\ &= \frac{1}{2} + \frac{1}{2}( \ln\frac{1}{2})\\ &\approx .85 \end{split} \end{multline*}\]
Therefore, the probability that BC < 1/2 \(\cong\) 0.85 or 85%
(c) |B - C| < 1/2
Let B = x, C = y. Then P(|B - C| < 1/2) = P(|x - y| < 1/2).
part c illustration
To find the area shaded in violet, we just need to get the area of the square and subtract the area of the 2 triangles from it.
\[\begin{multline*} \begin{split} &= 1 - \frac{(\frac{1}{2})^2}{2} * 2 \\ &= \frac{3}{4} \end{split} \end{multline*}\]
Therefore, the probability that |B-C| < 1/2 = .75 or 75%
(d) max{B,C} < 1/2
Let B = x, C = y.
P(B < 1/2, C < 1/2)
= P(B < 1/2)*P(C < 1/2)
\(= (\frac{1}{2})^2\)
\(= \frac{1}{4}\)
Therefore, the probability that max{B,C} < 1/2 = .25 or 25%
(e) min{B,C} < 1/2
Let B = x, C = y.
P(B >= 1/2, C >= 1/2)
= 1 - P(B < 1/2, C < 1/2)
\(= 1 - \frac{1}{4}\)
\(= \frac{3}{4}\)
Therefore, the probability that min{B,C} < 1/2 = .75 or 75%