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

Solution:

P(Y=1)+P(Y=2)+…+P(Y=k)=1

the combination assigning 1 to k to X1, X2, . . . , Xn is \(k^n\)

the combination of assigning j to k to X1, X2, . . . , Xn is \((k-j)^n\)

\(P(Y=1)=\frac{k^n-(k-1)^n}{k^n}\)

\(P(Y=2)=\frac{k^n-(k-2)^n-[k^n-(k-1)^n]}{k^n}=\frac{(k-1)^n-(k-2)^n}{kn}\)

\(P(Y=3)=\frac{k^n-(k-3)^n-[(k-1)^n-(k-2)^n]-[k^n-(k-1)^n]}{k^n}=\frac{(k-2)^n-(k-3)^n}{kn}\)

proceeding with the same process, we know that

\(P(Y=j)=\frac{(k-j+1)^n-(k-j)^n}{kn}\)

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

Solution:

If the machine forllows the geometric distribution, we have that $ = 10$ (years), or p = 1/10, which is the probability that the machine will fail.

For \(x > 8\)(machine will fail after 8 years) we obtain

\(P(x \geq 9)=1-(P(x=8)+P(x=7)+P(x=6)+P(x=5)+P(x=4)+P(x=3)+P(x=2)+P(x=1))\)

\(1-(0.9^7+0.9^6+0.9^5+0.9^4+0.9^3+0.9^2+0.9^1+0.9^0)\times0.1=0.4305\)

which is approximately 0.4305

\(E(X) = 1/p = 10\)

\(\sigma^2=(1-p)/p^2\).

So standard deviation is \(\sqrt{q/p^2}=\sqrt{(1-1/10)/(1/10)^2}=9.4868\)

#probability that the machine will fail before the 8th years
p <- pgeom(7,1/10)
cat("The probability that the machine will fail after 8 years if the mahine follows the geometric distribuion is",round(1-p,4),".\n")
## The probability that the machine will fail after 8 years if the mahine follows the geometric distribuion is 0.4305 .
#The expected value of a geometrically distributed random variable X and standard deviation
set.seed(5)
sample <-rgeom(100, 1/10)
summary(sample)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    3.00    7.00    9.87   14.00   52.00
sd(sample)
## [1] 9.998641

The mean of our sample is 9.87, which is not too far from the expected value of 10. Likewise, the standard deviation, 9.9986, is not far from the theoretical value of $ or 9.4868.

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.

Solution: If the machine follow the exponential distribution, as \(P(x=8)\simeq 0\), so for $x > 8 $(machine will fail after 8 years) we obtain

\(P(x\geq 8)=1-P(x\leq8)=1-(1-e^{-8\lambda})=e^{-8\lambda}\)

\(\lambda=1/\mu=1/E(X)=1/10\)

\(P(x\geq 8)=e^{-8\lambda}=e^{-8/10}=0.4493\)

\(E(X)= 1/\lambda\) = 1/(1/10)=10

\(\sigma=1/\lambda^2\).

So standard deviation is \(\sqrt{1/\lambda^2}=\sqrt{1/((1/10))^2}=1/\lambda=10\)

#probability that the machine will fail before the 8th years
p <- pexp(8, rate = 1/10, log = FALSE)
cat("The probability that the machine will fail after 8 years if the mahine follows the exponential distribuion is",1-p,"\n")
## The probability that the machine will fail after 8 years if the mahine follows the exponential distribuion is 0.449329
#The expected value of a exponentially distributed random variable X and standard deviation
set.seed(5)
sample <-rexp(100, 1/10)
summary(sample)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.2582  3.8163  7.9263 10.4052 14.2623 52.6632
sd(sample)
## [1] 9.454755

The mean of our sample is 10.4052, which is not too far from the expected value of 10. Likewise, the standard deviation, 9.4548, is not far from the theoretical value of $1/or 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)

Solution:

The probability that the machine will not fail in the first 8th years if the machine follows binomial distribution:

\[\begin{equation} P(X=0)=\left( \begin{array}{c} 8 \\ 0 \end{array} \right) \times 0.1^0 \times 0.9^8 =0.4305 \end{equation}\]

\(E(X) = np = 8\times 0.1 = 0.8\)

\(\sigma = \sqrt{np(1-p)} = \sqrt{8\times 0.1\times (1-0.1)}=0.8485\)

#probability that the machine will not fail in the first 8th years
p <- pbinom(0, size=8, prob=0.1)
cat("The probability that the machine will fail after 8 years if the mahine follows the binomial distribuion is",p,"\n")
## The probability that the machine will fail after 8 years if the mahine follows the binomial distribuion is 0.4304672
#The expected value of a binomially distributed random variable X and standard deviation
set.seed(5)
sample <-rbinom(0:1000, size = 8, prob = 1/10)
summary(sample)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.0000  0.0000  1.0000  0.8172  1.0000  4.0000
sd(sample)
## [1] 0.8564721

The mean of our sample is 0.8172, which is not too far from the expected value of 0.8. Likewise, the standard deviation, 0.8565, is not far from the theoretical value of $ or 0.8485.

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.

Solution:

If the machine follows poisson distribution, the mean, = 0.8 in 8 years.The probability that the machine will not fail in the first 8th years:

\(P(X=0)=\frac{\lambda^xe^{-\lambda}}{x!}=\frac{0.8^0e^{-0.8}}{0!}=e^{-0.8}= 0.449329\)

\(E(X)=\lambda=0.8\)

\(\sigma^2=\lambda=0.8\)

so \(\sigma=\sqrt{\lambda}=\sqrt{0.8}=0.8944\)

p <- ppois(0, 0.1*8)

cat("The probability that the machine will fail after 8 years if the mahine follows the poisson distribuion is",round(p,4),".\n")
## The probability that the machine will fail after 8 years if the mahine follows the poisson distribuion is 0.4493 .
#The expected value of a binomially distributed random variable X and standard deviation
set.seed(1)
sample <- rpois(1000, 0.8)
summary(sample)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   0.000   1.000   0.801   1.000   6.000
sd(sample)
## [1] 0.9231746

The mean of our sample is 0.801, which is not too far from the expected value of 0.8. Likewise, the standard deviation, 0.9232, is not far from the theoretical value of $ or 0.8944.