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.

Let’s assume that there is some number x in between 1 and k (1 … x … k). x is the minimum of the Xi’s. We need to find out the probavility that Y equals x.

Since we don’t know what exactly variable has minimum in Y we have to figure out the number of all posible ways that X1…Xn can be assign to 1…k. The possible number of assignments is \(k^n\) (k numbers to choose from and we chose n of them).

Next we have to count the number of ways that X1…Xn can be assign to x…k. The possible number of assignments is \((k-x)^n\) (k-x numbers to choose from and we chose n of them).

Now we have to count the number of ways that X1…Xn can be assign to x-1…k (the range includes x). The possible number of assignments is \((k-(x-1))^n\) (k-x numbers to choose from and we chose n of them).

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

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

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

It’s a case of geometric distribution.

Probability density function: \(P(X = x) = p(1 - p)^{x-1} = p(q)^{x-1}\),

where p is probability of success and q is probability of failure

Expected value: \(E(X) = 1/p\)

Variance: \(Var(X) = q/p^2\)

Standard deviation: \(\sigma = \sqrt{Var(X)}\)

#probability that the machine fails each year
p <- 1/10


# probability that machine continues to work each year
q <- 1-p


#expected value

exp_value <- 1/p
exp_value
## [1] 10
#mashine will fail after 8 years on 9th year
x <- 9

# probability that the machine will fail after 8 years 
prob <- p * q^(x-1)
prob
## [1] 0.04304672
# What is the Expected Value?
expected_value <- 1/p
expected_value
## [1] 10
#Variance
variance <- q/p^2

#Standard Deviation
sd <- sqrt(variance)
sd
## [1] 9.486833
  1. What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as an exponential.

Exponential Cumulative Distribution is defined by the following formula:

\(X \leq k\) : \(P (X \leq k) = 1 - e^{-k/\mu}\)

\(X \geq k\) : \(P (X \geq k) = e^{-k/\mu}\), where \(\mu = 1/\lambda\)

Expected Value: \(E(X) = 1/\lambda\)

Standard Deviation: \(\sigma = \sqrt{1/\lambda^2}\)

#parameter 
par <- 1/10

#expectation
mu <- 1/par

year <- 8

# probability that the machine will fail after 8 years 
prob <- exp(-year/mu)
prob
## [1] 0.449329
#expected value
exp_value <- 1/par
exp_value
## [1] 10
#standard deviation
sd <- sqrt(1/(par^2))
sd
## [1] 10
  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)

Binomial Distribution Model: \(P(X="success") = {n \choose k} p^x(1-p)^{n-x}\) Expected Value: \(E(X) = np\) Standard Deviation: \(\sigma = \sqrt{np(1-p)}\)

# probability of machine failure per year
p <- 0.1

# number of years
n <- 8

# probability of 0 success in 8 years
prob <- choose(n, 0) * p^0 * (1-p)^(8)
prob
## [1] 0.4304672
#expected value
exp_value <- n * p
exp_value
## [1] 0.8
# standard deviation
sd <- sqrt(n*p*(1 - p))
sd
## [1] 0.8485281
  1. What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as a Poisson.

Poisson Distribution Model: \(P(X = x) = \frac{e^{-\mu}\mu^x}{x!}\) where μ is the mean number of “successes” and x is the number of “successes” in question.

Expected Value: \(E(X) = \mu\)

Standard Deviation: \(\sigma = \sqrt{\mu}\)

#number of years = the number of “successes” in question
x <- 8

mu <- 10

# number of years
n <- 8

# probability that the machine will fail after 8 years
prob <- (exp(-1 * mu) * mu^x) / factorial(x)
prob
## [1] 0.112599
#expected value
exp_value <- mu
exp_value
## [1] 10
# standard deviation
sd <- sqrt(mu)
sd
## [1] 3.162278