Question1: 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
# Define the number of random variables
n <- 5
# Define the range of uniform distribution
k <- 10
# Create a function to calculate the PMF for Y
pmf_Y <- function(y) {
return((k - y + 1)^n / k^n)
}
# Calculate the PMF for Y for all possible values of y
y_values <- 1:k
pmf_values <- sapply(y_values, pmf_Y)
# Create a data frame to store the results
result_df <- data.frame(Y = y_values, PMF = pmf_values)
result_df
## Y PMF
## 1 1 1.00000
## 2 2 0.59049
## 3 3 0.32768
## 4 4 0.16807
## 5 5 0.07776
## 6 6 0.03125
## 7 7 0.01024
## 8 8 0.00243
## 9 9 0.00032
## 10 10 0.00001
Question 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..)
# Probability that the machine fails after 8 years
p_failure_after_8_years <- dgeom(8, prob = 1/10)
cat("Probability that the machine fails after 8 years:", p_failure_after_8_years, "\n")
## Probability that the machine fails after 8 years: 0.04304672
# Expected value (mean) of the geometric distribution
expected_value <- 1 / (1/10)
cat("Expected Value (Mean):", expected_value, "\n")
## Expected Value (Mean): 10
# Standard deviation of the geometric distribution
standard_deviation <- sqrt((1 - (1/10)) / (1/10^2))
cat("Standard Deviation:", standard_deviation, "\n")
## Standard Deviation: 9.486833
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
# Parameters for the exponential distribution
rate_parameter <- 1/10 # Since we expect one failure every ten years
# 1. Probability that the machine fails after 8 years
p_failure_after_8_years <- 1 - pexp(8, rate = rate_parameter)
cat("1. Probability that the machine fails after 8 years:", p_failure_after_8_years, "\n")
## 1. Probability that the machine fails after 8 years: 0.449329
# 2. Expected value (mean) of the exponential distribution
expected_value <- 1 / rate_parameter
cat("2. Expected Value (Mean):", expected_value, "\n")
## 2. Expected Value (Mean): 10
# 3. Standard deviation of the exponential distribution
standard_deviation <- 1 / rate_parameter
cat("3. Standard Deviation:", standard_deviation, "\n")
## 3. Standard Deviation: 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
# Parameters for the binomial distribution
n_trials <- 8
probability_of_success <- 1/10 # Probability of failure in one year
# 1. Probability that the machine fails after 8 years (0 successes in 8 years)
p_failure_after_8_years <- dbinom(0, size = n_trials, prob = probability_of_success)
cat("1. Probability that the machine fails after 8 years:", p_failure_after_8_years, "\n")
## 1. Probability that the machine fails after 8 years: 0.4304672
# 2. Expected value (mean) of the binomial distribution
expected_value <- n_trials * probability_of_success
cat("2. Expected Value (Mean):", expected_value, "\n")
## 2. Expected Value (Mean): 0.8
# 3. Standard deviation of the binomial distribution
standard_deviation <- sqrt(n_trials * probability_of_success * (1 - probability_of_success))
cat("3. Standard Deviation:", standard_deviation, "\n")
## 3. Standard Deviation: 0.8485281
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.
# Parameters for the Poisson distribution
lambda <- 8 * (1/10) # Expected number of failures in 8 years
# 1. Probability that the machine fails after 8 years (Poisson distribution)
p_failure_after_8_years <- 1 - ppois(0, lambda)
cat("1. Probability that the machine fails after 8 years (Poisson distribution):", p_failure_after_8_years, "\n")
## 1. Probability that the machine fails after 8 years (Poisson distribution): 0.550671
# 2. Expected value (mean) of the Poisson distribution
expected_value <- lambda
cat("2. Expected Value (Mean):", expected_value, "\n")
## 2. Expected Value (Mean): 0.8
# 3. Standard deviation of the Poisson distribution
standard_deviation <- sqrt(lambda)
cat("3. Standard Deviation:", standard_deviation, "\n")
## 3. Standard Deviation: 0.8944272