Homework 7

Exercise 1

Let \(X_1, X_2, . . . , X_n\) be \(n\) mutually independent random variables, each of which is uniformly distributed on the integers from \(1\) to \(k\). Let Y denote the minimum of the \(X_i’\)s. Find the distribution of \(Y\) .

Solution

\[ \text{We are trying to find that the minimum of } X_1, X_2, . . . , X_n \text{is less than or equal to } y,\\ \text{denoted as } P(Y \leq y).\\ \text{Since each } X_i \text{is uniformly distributed on the integers from } 1 \text{ to } k, \\ \text{ the probability that } X_i>y \text{ is } \frac{k-y}{k} \text{for each } i.\\ \text{Given that } X_1, X_2,...,X_n\\ \text{ are independent, the probability that all of them are greater than y is the product of their individual probabilities.}\\ \text{The probability that Y is less than or equal to y is the complement of the probability that all } X_i's \text{ are greater than y.}\\ P(Y\leq y) = 1 - P(Y>y)\\ = 1 - P(min\{ X_1, X_2,...,X_n \}>y)\\ = 1-P(X_1>y,X_2>y,...,X_3>y)\\ = 1 -(\frac{k-y}{k})^n. \\ P(Y\leq y-1) = 1- (\frac{k-y+1}{k})^n\\ m(Y) = P(Y\leq y) = P(Y\leq y) - P(Y \leq y-1)\\ = 1- (\frac{k-y}{k})^n - 1 + (\frac{k-y+1}{k})^n\\ \text{Therefore, the PMF of Y is: }\\ =\frac{(k-y)^n(k-y+1)^n}{k^n} \]

Exercise 2

Your organization owns a copier (future lawyers, etc.) or MRI (future doctors). This machine has a manufacturer’s expected lifetime of 10 years. This means that we expect one failure every ten years. (Include the probability statements and R Code for each part.).

Part A: Geometric

What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as a geometric. (Hint: the probability is equivalent to not failing during the first 8 years..)

Solution:

We’ll let \(X\) equal the number of years \[ p = 1/10\\ P(X > 8) = 1 - P(X\leq 8)\\ P(X\leq 8) = (1-p)^k = (1- 1/10)^8 = (9/10)^8 \approx 0.430 \]

p <- 1/10
# number of years
n <- 8
# probability that the machine will fail after 8 years
1-pgeom(n-1,p, lower.tail = TRUE)
## [1] 0.4304672
# expected value
expected_value <- 1/p
expected_value
## [1] 10
# standard deviation
standard_deviation <- sqrt((1-p)/(p^2))
standard_deviation
## [1] 9.486833

Part B: Exponential

What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as an exponential.

Solution:

\[ P(X>8) = 1 - P(X\leq 8)\\ P(X\leq 8) = \int_0^8 \lambda e^{-\lambda w} dw = [-e^{-\lambda w}]_0^8 = 1- e^{-8\lambda}\\ P(X>8) = 1 - P(X\leq8) = 1- (1-e^{-8\lambda}) = e^{-8(1/10)} = e^{-8/10} \approx 0.4493\\ E[X] = \frac{1}{\lambda} = \frac{1}{1/10} = 10\\ SD[X] = \sqrt{Var[X]} = \sqrt{\lambda^2} = \sqrt{10^2} = 10 \]

# probability
p <- 1/10
# number of years
n <- 8
# probability that the machine will fail after 8 years
1-pexp(n, p)
## [1] 0.449329
# expected value
expected_val <- 1/p
expected_val
## [1] 10
# standard deviation
sqrt(expected_val^2)
## [1] 10

Part C: Binomial

What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as a binomial. (Hint: 0 success in 8 years)

Solution:

We need to calculate the probability that there are 0 failures in the first 8 years.

\[ (X\leq 8) = \Sigma_0^n {n\choose k}p^k (1-p)^n-k\\ = \Sigma_0^8 {8\choose k} (1/10)^k (9/10)^{8-k}\\ E[X] = np = \frac{1}{10} \cdot 8 = 0.8\\ SD[X] = \sqrt{np(1-p)} = \sqrt{8 \cdot (\frac{1}{10}) (1-\frac{1}{10})} \approx 0.8485 \]

# probability
p <- 1/10
# number of years
n <- 8
# number of failures in first 8 years
failures <- 0
# probability that the machine will fail after 8 years
pbinom(failures,n,p)
## [1] 0.4304672
# expected value
expected_value <- n*p
expected_value
## [1] 0.8
# standard deviation
sqrt(n*p*(1-p))
## [1] 0.8485281

Part D: Poisson

What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as a Poisson.

Solution:

We need to calculate the probability that there are no failures in the first 8 years.

\[ P(X\leq 8) = \Sigma_0^8 \frac{\lambda^x e^{-\lambda}}{x!}\\ E[X] = \lambda = \frac{np}{t} = \frac{\frac{1}{10}\cdot 8}{1} = 0.8\\ \sigma = \sqrt{\lambda} = \sqrt{0.8} \approx 0.8944 \]

# number of years
n <- 8
# probability 
p <- 1/10
# time
t <-1
# number of failures in 8 years 
failures <- 0
# average rate failure per year
lambda <- (n*p)/t
# probability that the machine will fail after 8 years
ppois(failures, lambda)
## [1] 0.449329
# expected value
lambda
## [1] 0.8
# standard deviation
sqrt(lambda)
## [1] 0.8944272