The probability that Y assumes a value y is the probability that Y all \(X_i\) > y-1. Mathematically;

P(Y=y) = P(\(X_i\)>y-1)

P(\(X_i\)>y-1) = (k - (y-1))/k

P(\(X_i\)=y) = 1/k

Since the random variables are independent, the probability that all \(X_i\) are greater than y-1 and at least one \(X_i\) is equal to y is denoted as on below:

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

Problem 2:

  1. 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..)
p_failure = 1/10  # Probability of failure in a given year

# Probability of failure after 8 years (k = 8)
prob_failure_after_8_years = (1 - p_failure)^(8 - 1) * p_failure

cat("Probability of failure after 8 years:", prob_failure_after_8_years, "\n")
## Probability of failure after 8 years: 0.04782969
#Expected value and standard deviation
expected_value = 1 / p_failure
standard_deviation = sqrt((1 - p_failure) / p_failure^2)

cat("Expected value:", expected_value, "\n")
## Expected value: 10
cat("Standard deviation:", standard_deviation, "\n")
## Standard deviation: 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
expected_lifetime = 10  
lambda = 1 / expected_lifetime  # Failure rate 

#Probability of failure after 8 years
prob_failure_after_8_years = 1 - pexp(8, rate = lambda)

cat("Probability of failure after 8 years:", prob_failure_after_8_years, "\n")
## Probability of failure after 8 years: 0.449329
#Expected value and standard deviation
expected_value = 1 / lambda
standard_deviation = 1 / lambda

cat("Expected value:", expected_value, "\n")
## Expected value: 10
cat("Standard deviation:", standard_deviation, "\n")
## Standard deviation: 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)
n_years = 8  # Number of years
k_failures = 0  # Number of failures
p_failure = 1/10  # Probability of failure in a given year

#Probability of 0 failures in 8 years using the binomial distribution
prob_0_failures = dbinom(k_failures, size = n_years, prob = p_failure)

cat("Probability of 0 failures in 8 years:", prob_0_failures, "\n")
## Probability of 0 failures in 8 years: 0.4304672
# Calculate the expected value and standard deviation
expected_value = n_years * p_failure
standard_deviation = sqrt(n_years * p_failure * (1 - p_failure))

cat("Expected value:", expected_value, "\n")
## Expected value: 0.8
cat("Standard deviation:", standard_deviation, "\n")
## Standard deviation: 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.
lambda_failure = 8/10  # Average rate of failures in 8 years

#Probability of 0 failures in 8 years using the Poisson distribution
prob_0_failures = dpois(0, lambda = lambda_failure)

cat("Probability of 0 failures in 8 years:", prob_0_failures, "\n")
## Probability of 0 failures in 8 years: 0.449329
#Expected value and standard deviation
expected_value = lambda_failure
standard_deviation = sqrt(lambda_failure)

cat("Expected value:", expected_value, "\n")
## Expected value: 0.8
cat("Standard deviation:", standard_deviation, "\n")
## Standard deviation: 0.8944272