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.
sim.uni <- function(a,b) {
Y = c()
for (i in 1:b){
X <- runif(a)
Y[i] = min(X)
}
return(Y)
}
Y <- sim.uni(10, 100)
hist(Y, breaks = 20)
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=0.1
pgeom(8, p, lower.tail = FALSE)
## [1] 0.3874205
mean = 1/p
sd = sqrt(((1-p)/p^2))
print(mean)
## [1] 10
print(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.
pexp(8, p, lower.tail = FALSE)
## [1] 0.449329
mean = p^-1
sd = sqrt(p^-2)
print(mean)
## [1] 10
print(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)
pbinom(0, 8, 0.1)
## [1] 0.4304672
mean = 10* 0.1
sd = sqrt(10*p*(1-p))
print(mean)
## [1] 1
print(sd)
## [1] 0.9486833
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.
ppois(0, 8/10)
## [1] 0.449329
mean = .1
sd = sqrt(mean)
print(mean)
## [1] 0.1
print(sd)
## [1] 0.3162278