Using the proof explanation on Dartmouth we can find the distribution of Y in the following manner:
X has k possibilities so we have \(k^n\) possible values in total :
\[\frac{TBD}{k^n}\]
To find the numerator of the distribution assuming that \(Y = j\) we first find the minimum of the X which is 1 and the number of ways to get Y = 1. That would be: \[k^n - (k-1)^n\]
If \(Y = j\) then we substitute that to get \((k-j+1)^n - (k-j)^n\) ways for X to have a minimum value of j as well. Thus, we combine the two to get:
\[\frac{(k-j+1)^n - (k-j)^n}{k^n}\]
Geometric distribution = \[Pr(X = k) = (1-p)^{k-1}p\]
1 failure every ten years means probability of failure is 1/10
p_fails <- 1/10
p_fails_8_years_geom <- pgeom(8,p_fails, lower.tail = FALSE)
ev <- 1 / p_fails
sd_machine_fails_geom <- sqrt(1 - p_fails)/p_fails
Using a geometric distribution, the probability the machine will fail after 8 years is 0.3874205. Its expected value is 10 years and the standard deviation is 9.486833 years
p_fails <- 1/10
p_fails_8_years_exp <- pexp(8,p_fails, lower.tail = FALSE)
ev <- 1 / p_fails
sd_machine_fails_exp <- sqrt(1/(p_fails^2))
Using an exponential distribution, the probability the machine will fail after 8 years is 0.449329. Its expected value is 10 years and the standard deviation is 10 years
n=10
p_success <- 9/10
p_fails <- 1/10
p_fails_8_years_binom <- pbinom(0,8,p_fails)
ev <- 8 * p_fails
sd_machine_fails_binom <- sqrt(n*p_success*p_fails)
Using a binomial distribution, the probability the machine will fail after 8 years is 0.4304672. Its expected value is 0.8 failures in 8 years and the standard deviation is 0.9486833 years
p_fails <- 1/10
p_fails_8_years_pois <- ppois(0,p_fails)^8
ev <- 8 * p_fails
sd_machine_fails_pois <- sqrt(.8)
Using a Poisson distribution, the probability the machine will fail after 8 years is 0.449329. Its expected value is 0.8 years and the standard deviation is 0.8944272 years