Let’s demonstrate the distribution of Y through simulations.
min.uniform <- function(k, n) {
all_rand_vars <- c()
for (rand_x in c(1:n)) {
rand_var <- c()
for (rand_min in c(1:k)) {
rand_var <- append(rand_var, sample(1:k, 1))
}
all_rand_vars <- append(all_rand_vars, min(rand_var))
}
return(all_rand_vars)
}
hist(min.uniform(10, 500), xlab="Minimum of Xi", main = "k = 10, n = 500")
hist(min.uniform(20, 1000), xlab="Minimum of Xi", main = "k = 20, n = 1000")
hist(min.uniform(30, 10000), xlab="Minimum of Xi", main = "k = 30, n = 10,000")
prob_fail <- 1/10
# What is the probability that the machine will fail after 8 years?
pgeom(q=8, prob_fail, lower.tail = FALSE)
## [1] 0.3874205
# Expected value
1 / prob_fail
## [1] 10
# Standard deviation
sqrt(1-prob_fail) / prob_fail
## [1] 9.486833
# What is the probability that the machine will fail after 8 years?
pexp(8, rate=prob_fail, lower.tail = FALSE)
## [1] 0.449329
# Expected value
10
## [1] 10
# Standard deviation
10 # Equal to the mean
## [1] 10
# What is the probability that the machine will fail after 8 years?
pbinom(0, size=8, prob=(1/10))
## [1] 0.4304672
# Expected value
8 * prob_fail # n * P
## [1] 0.8
# Standard deviation
sqrt(prob_fail * (1-prob_fail) * 8) # sqrt(npq)
## [1] 0.8485281
# What is the probability that the machine will fail after 8 years?
ppois(0, lambda=(8 * prob_fail))
## [1] 0.449329
# Expected value
8 * prob_fail
## [1] 0.8
# Standard deviation
sqrt(8 * prob_fail) # Square-root of the mean
## [1] 0.8944272