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.
If we consider that \(Y = y\) then the event that this occurs happens if all n random variables are \(\geq y\) and so the probability that \(Y = y\) is the probablilty that each \(X_i \geq y\)
Since all n are mutally independent events we can multiply the probabilities. The probability that \(X_i = y\) is:
\[ p(X = y) = 1 - \left(\frac {k-y} {k}\right)^n \]
For all values of k we can use the formula
\[ p(X = y) = \left({\frac {k-y+1} {k}}\right)^n - \left({\frac {k-y} {k}}\right)^n \]
y <- 1:20
k <- 20
n <- 30
for(i in y){
value1 <- ((k-i+1) / k) ** n
value2 <- ((k-i) / k) ** n
value3 <- value1 - value2
print(paste("The probability that the Y =", i, "is", value3))
}
## [1] "The probability that the Y = 1 is 0.785361236057063"
## [1] "The probability that the Y = 2 is 0.172247605667721"
## [1] "The probability that the Y = 3 is 0.0347603986804268"
## [1] "The probability that the Y = 4 is 0.0063928195555041"
## [1] "The probability that the Y = 5 is 0.00105935794911537"
## [1] "The probability that the Y = 6 is 0.000156042749879323"
## [1] "The probability that the Y = 7 is 2.00992792023668e-05"
## [1] "The probability that the Y = 8 is 2.21898716860467e-06"
## [1] "The probability that the Y = 9 is 2.04822897474173e-07"
## [1] "The probability that the Y = 10 is 1.5319699671945e-08"
## [1] "The probability that the Y = 11 is 8.91842731949672e-10"
## [1] "The probability that the Y = 12 is 3.83269211611998e-11"
## [1] "The probability that the Y = 13 is 1.13193010817719e-12"
## [1] "The probability that the Y = 14 is 2.07855052975672e-14"
## [1] "The probability that the Y = 15 is 2.0502377035666e-16"
## [1] "The probability that the Y = 16 is 8.66287996164404e-19"
## [1] "The probability that the Y = 17 is 1.07355007294077e-21"
## [1] "The probability that the Y = 18 is 1.91750059232884e-25"
## [1] "The probability that the Y = 19 is 9.99999999068679e-31"
## [1] "The probability that the Y = 20 is 9.3132257461548e-40"
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 of failing after 8 years
If this is equivalent to not failing during the first 8 years then we can take the compliment of our failure rate. Converting to months we have a non failure rate of 119/120. The probability of not failing during the first 8 years or 96 months can be calculated as:
\[p(X = 8) = (1 - p)^{n}\\ = \left(\frac {119} {120}\right)^{96} = \]
(119/120) ** 96
## [1] 0.4478253
The probability that it will fail after 8 years is 0.4478 or a 44.78% chance.
Expected value
\[p = 1/10\\ E(x) = 1/p \\ = \frac{\frac {1}{10}} {10} \\ = 10 \]
E(x) = 10 years or 120 months
Standard Deviation
\[ sd = \sqrt{\frac{1-p} {p^2}} = \sqrt{\frac{1-10} {10^2}} = \sqrt{\frac{9} {100}} \\ = \frac{3} {10} \]
sd(x) = 0.333 years or 3.99 months
What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as an exponential.
a. What is the probability that your MRI will fail after 8 years? F(x) = 1 - \(e^-\lambda x\) p(X > 8 years) = 1 - F(8)
1 - (1 - (exp(1) ** (-0.1 * 8)))
## [1] 0.449329
p(X > 8 years) = 0.4493 - 44.93%
b. Expected failure time?
expected_failuretime = 0.1
The expected failure time is 0.1
c.Sstandard deviation? The standard deviation (sd) of an exponential distribution is also the inverse of the failure rate.
sd = 0.1
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)
Modeling this a binomial distribution we can say a success is when the machine fails
a. What is the probability that your MRI will fail after 8 years?
\(p(success) = 1/120\) months \(p(failure) = 119/120\) months
\[ p(x = 96 months)= \begin{pmatrix}n\\ k\end{pmatrix} p^k * q^{n-k} \\ = \begin{pmatrix}96\\ 0\end{pmatrix} \frac {1}{120}^0 * \frac{119}{120}^{96} \\ = \frac{119}{120}^{96} \\ = 0.4473\]
choose(90,0) * ((1/120) ** 0) * ((119/120) ** 96)
## [1] 0.4478253
b. Expected value
\[ \mu = np \\ = 96 * 1/120 \\ = 0.8\]
We would expect to have 0.8 failures in 8 years or 96 months.
((1/120) * 96)
## [1] 0.8
c. Standard deviation
\[ \sigma = \sqrt{npq} \\ = \sqrt{96*\frac {1}{120}*\frac{119}{120}} \\ = 0.8\]
sqrt(96 * (1/120) * (119/120))
## [1] 0.8906926
What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as a Poisson.
a. What is the probability that your MRI will fail after 8 years? \(\lambda = 1/120\)
\(\lambda\) = 0.8
\[p(X = k) = \frac {\lambda^{k}}{k!} \cdot e^{-\lambda} \\ = \frac {0.8^{0}}{0!} \cdot e^{-0.8} \\ = e^{-0.8} \\ = 0.4493\]
((0.8 ** 0) * (exp(1)** -0.8)) / factorial(1)
## [1] 0.449329
In a Poisson distribution the expected value and the standard deviation are equal.
b. Expected value and standard deviation
\(\lambda = 0.8\)