Data606 Week 7 assignment.

1. Let X1, X2, . . . , Xn 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 Xi’s. Find the distribution of Y

below is the distribution of Y. This looks to be rightly skewed.

k = 50
n = 50

#taking 1000 times samples - minmum from 50 samples.  

Y <- replicate(100, min(floor(runif(n, min = 1, max = k))))

hist(Y)

  1. 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.).

a. 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..)

\[ E(x) = (1-p)p \] \[ E(x) = 10y, (1-p)p = 10\] \[ p = 1/11 \] \[ P(machine_in_k_year) = (1-p)^k-1 * p \] According to the geometric discribution, we can find using pgeom function by ignoring the lower tail.

p_after8_years = pgeom(8, prob = 1/11, lower.tail = FALSE) 
p_after8_years
## [1] 0.4240976

\[ V(x) = (1-p)/p^2 \] \[ SD(X) = sqrt(V(X)) \]

var <- (1-1/11)/(1/11)^2
var
## [1] 110
sd = sqrt(var)
sd
## [1] 10.48809

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

\[ E(X)=1/λ= 10\]

\[ λ = 1/10 \] \[ V(x) = 1/λ^2 = 1/100 \] \[ SD = sqrt(V(x))= 1/10 \]

\[ P(fail_after_8_years) = 1- p(fail_with_in_8years)\] \[ p(fail_with_in_8years) = 1-e^λx = 1-e^(-1* 0.1*8) \]

p <- 1- (1- 2.71828^(-1*0.8))
p 
## [1] 0.4493292

c. 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)

\[ E(X=failed) = np = 1 , p = 1/10 \] \[ V(x) = np(1-p) \]

var <- 10*(1/10)*(9/10)
var
## [1] 0.9
sd <- sqrt(var)
sd
## [1] 0.9486833
p_fail_with_in_8_years <- pbinom(0, size = 8, prob = 1/10)
p_fail_after_8_years <- 1- p_fail_with_in_8_years
p_fail_after_8_years
## [1] 0.5695328

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

\[ E(x) = λ \] \[ V(x) = λ \]

sd <- sqrt(10)
sd
## [1] 3.162278

\[ P(x) = (λ^x* e^-λ)/x! \]

p<-(10^(8) * exp(-10))/factorial(8)
p
## [1] 0.112599