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)
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.).
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..)
# probability that the machine will fail after 8 years using geometric distribution
p = 0.1
q = 1-p
n <- 8
pgeom (n, p, lower.tail = FALSE)
## [1] 0.3874205
# Expected # of years to see first failure
1/p
## [1] 10
# Standard Deviation
round(sqrt((1-p)/p^2), 2)
## [1] 9.49
What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as an exponential.
\(\lambda = 0.1\)
# probability that the machine will fail after 8 years using exponential distribution.
pexp(8, 0.1, lower.tail = FALSE)
## [1] 0.449329
# Expected value
lambda <- 0.1
1/lambda
## [1] 10
# Standard Deviation
sqrt(lambda ^ -2)
## [1] 10
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)
# probability that the machine will fail after 8 years using binomial distribution
dbinom(0, 8, 0.1)
## [1] 0.4304672
# Expected value
n <- 8
p <- 0.1
n*p
## [1] 0.8
# Standard Deviation
q <- 1-p
sqrt(n*p*q)
## [1] 0.8485281
What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as a Poisson.
# probability that the machine will fail after 8 years using poisson distribution | P(x) = 0
lambda = 0.1
ppois(0, 0.1, lower.tail = TRUE)^8
## [1] 0.449329
# Expected value
lambda = 8/10
lambda
## [1] 0.8
# Standard Deviation
sqrt(lambda)
## [1] 0.8944272