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 .

If Y is the minimum of the Xi’s and each Xi has k possibilities, then the total # of possibilities for X1, X2,…Xn is \(k^n\) , which becomes our denominator. The number of options we now know, so we need to find the number where no Xi’s = 1, which would become \((k-1)^n\)To get Y=1, \[\frac{(k-1+1)^n-(k-1)^n}{k^n}\] or to generalize whenever Y=x, \[\frac{(k-x+1)^n-(k-x)^n}{k^n}\]

#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

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

p_fail <- 0.1 #once in 10 years
num_years <- 8

#probability
p_geom <- 1-pgeom(num_years-1,p_fail)
p_geom
## [1] 0.4304672
#expected value
geom_expected <- 1/p_fail
geom_expected
## [1] 10
#SD
geom_sd = sqrt((1-p_fail)/(p_fail)**2)
geom_sd
## [1] 9.486833
#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.   

#prob
p_exp <- pexp(num_years,p_fail,lower.tail=FALSE)
p_exp
## [1] 0.449329
#EV
exp_expected <- 1/p_fail
exp_expected
## [1] 10
#SD
exp_SD <- sqrt(1/p_fail**2)
exp_SD
## [1] 10
#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) 

q <- 1-p_fail
k <-0

#prob
p_bin <- dbinom(k,num_years,p_fail)
p_bin
## [1] 0.4304672
#EV
bin_expected <- num_years*p_fail
bin_expected
## [1] 0.8
#SD
bin_SD <- sqrt(num_years*p_fail*q)
bin_SD
## [1] 0.8485281
# 8.  What is the probability that the machine will fail after 8 years?.  Provide also the expected value and standard deviation.  Model as a Poisson.   

#prob
p_pois <- ppois(k,8/10) #avg number of failures in 8 years will be 8/10 of 1 or 0.8
p_pois
## [1] 0.449329
#EV
pois_expected <- 8/10
pois_expected
## [1] 0.8
#SD
pois_SD <- sqrt(8/10)
pois_SD
## [1] 0.8944272