1. Let \(X1\), \(X2\),…, \(X_n\) 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 \(X_i\)’s. Find the distribution of \(Y\).

To find the distribution, I am going to build an example using actual numbers and see if a pattern emerges that I can generalize into formulas.

Accordingly, I will assume \(n = 5\) and \(k = 7\). This means we have \(X_1\), \(X_2\), \(X_3\), \(X_4\) and \(X_5\), which I will denote as \(X_1thruX_5\). \(Y\) is the minimum of \(X_1thruX_5\).

We can start by noting that there are \(7^5 = 16,807\) ways that \(X_1thruX_5\) could be arranged given that \(k = 7\). This will ultimately be the denominator of the probability distribution.

Let’s assume \(Y = 1\). The number of combinations where \(X_1thruX_5\) are NOT \(1\) is \(6^5\). We know from the prior paragraph that the number of combinations total is \(7^5\), so the ways of getting \(Y = 1\) is the difference between \(7^5\) and \(6^5\), or \(7^5 - 6^5\). Using variables, this is \(k^n - (k - 1)^n\).

Next, let’s look at \(Y = 2\). Employing the same logic used in the prior paragraph, the number combinations where \(X_1thruX_5\) are NOT \(2\) is \(5^5\). So, the ways of getting \(Y = 2\) is the total combinations minus the difference from the prior paragraph minus the number combinations where \(X_1thruX_5\) are NOT \(2\), or \(7^5 - (7^5 - 6^5) - 5^5\). Using variables, this is \(k^n - (k^n - (k - 1)^n) - (k - 2)^n\), which can be simplified to \((k - 1)^n - (k - 2)^n\) for \(Y = 2\). Let’s call \(2\) the variable \(m\).

Generalizing using \(m\), we get \((k - m + 1)^n\) for the first term (because \(k - 2 + 1\) equals \(k - 1\)) and \((k - m)^n\) for the second term (equivalent to \((k - 2)^n)\), or; putting the terms together, \((k - m + 1)^n - (k - m)^n\) to calculate the number of comninations where \(Y = m\).

We then divide this formula by the total possible combinations \(k^n\) to get the probability distribution function:

\(\frac{(k - m + 1)^n - (k - m)^n}{k^n}\) for \(1 \leq m \leq k\)


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

# A 'success' in this case is the machine failing
# One failure per ten years; p calculated below
p <- 1/10
# P(x=n) = (1-p)^n * p; manually calculate below for x = 0 thru x = 8
p0 <- ((1 - p)^0) * p
p1 <- ((1 - p)^1) * p
p2 <- ((1 - p)^2) * p
p3 <- ((1 - p)^3) * p
p4 <- ((1 - p)^4) * p
p5 <- ((1 - p)^5) * p
p6 <- ((1 - p)^6) * p
p7 <- ((1 - p)^7) * p
p8 <- ((1 - p)^8) * p
p8orless <- p0 + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8
p_over8 <- 1 - p8orless
p_over8
## [1] 0.3874205
# compute using R Base pgeom function
pgeom(8, prob = 0.10, lower.tail = FALSE)
## [1] 0.3874205
# Expected value (expected number of failures before success)
ev <- 1 / p
ev
## [1] 10
# Variance is  1 - p / p^2, so standard dev is square root of that
sd <- sqrt((1 - p)/p^2)
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.

# Lambda in this case is our rate, which is 1 per 10 years, or 1/10
rate <- 1/10
# Set e
e <- exp(1)
# Cumulative distribution function for exponential functions when 
# x >= 0 is 1 - e^(-1* lambda * x), computed manually below for 8
p8orless <- 1 - e^(-1 * rate * 8)
# We want after 8 years, so subtract from 1
p_over8 <- 1 - p8orless
p_over8
## [1] 0.449329
# Compute using base R pexp function
1 - pexp(8, rate=0.1)
## [1] 0.449329
# Expected value is 1 divided by rate
ev <- 1 / rate
ev
## [1] 10
# Standard deviation is the square root of the variance, which is 
# 1 / rate^2. This means the standard deviation is the same as the EV
sd <- sqrt(1/rate^2)
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)

# Since binomial requires specific number of trials, we will model
# as 0 successes in 8 trials (because there are 8 years) using the
# probability 1/10 (chance of failure in a given year)
# Manually calculate
n <- 8        # number of trials
k <- 0        # number of successes
p <- 1 / 10   # probability of success
# Binomial probability mass function:
p0 <- choose(n, k) * p^k * (1 - p)^(8 - 0)
p0
## [1] 0.4304672
# Compute using base R pbinom function
pbinom(0, size=8, prob=0.1)
## [1] 0.4304672
# Expected value
ev = n * p
ev
## [1] 0.8
# Standard deviation is square root of variance, which is np(1-p)
sd <- sqrt(n * p * (1 - p))
sd
## [1] 0.8485281


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.

# Since Poisson is used for number of occurrences over an interval, 
# we will model 0 occurrences over 8 years using 0.8 as lambda
# because our probability is 1/10 per interval and we have 8 intervals
# Manually calculate
n <- 8        # number of trials
k <- 0        # number of successes
p <- 1 / 10   # probability of success
lda <- n * p  # lambda is n * p
# Compute using p = (e^(-1 * lambda) * lambda^k) / k!
e <- exp(1)   # set e
p0 <- (e^(-1 * lda) * lda^0) / factorial(0)
p0
## [1] 0.449329
# Compute using base R ppois function
ppois(0, lambda = 0.8)
## [1] 0.449329
# Expected value
ev = n * p    # same as lambda
ev
## [1] 0.8
# Standard deviation is square root of variance, which 
# is the same as lambda for a Poisson distribution
sd <- sqrt(lda)
sd
## [1] 0.8944272