Instructions: Solve these problems using RStudio, writing code in one script file, and compiling it into an HTML file. Upload one HTML file to Canvas. Please do not email your file to the professor.

  1. Plot the normal density curve over the range (-5, 7).
x <- seq(-5, 7, length = 200)
y <- dnorm(x)
plot(x, y, type = "l", main = "Normal Density Curve", xlab = "x", ylab = "Density")

  1. What is the quantile for P = 0.975?
q_975 <- qnorm(0.975)
q_975
## [1] 1.959964
  1. How likely will one random draw be observed in the interval (-3, 5)?
p_interval <- pnorm(5) - pnorm(-3)
p_interval
## [1] 0.9986498
  1. What is the probability that one random draw will be greater than 7?
p_greater_than_7 <- 1 - pnorm(7)
p_greater_than_7
## [1] 1.279865e-12

Examine the binomial distribution using n = 12, p = 0.3

  1. Plot the binomial density curve over the range (0, 12). [Hint. Use x <- 0:12]
x_binom <- 0:12
prob_binom <- dbinom(x_binom, size = 12, prob = 0.3)
plot(x_binom, prob_binom, type = "h", lwd = 2, col = "blue", main = "Binomial Density (n=12, p=0.5)", xlab = "x", ylab = "Probability")

  1. What is the quantile for P = 0.99?
q_99_binom <- qbinom(0.99, size = 12, prob = 0.3)
q_99_binom
## [1] 7
  1. How likely will one random draw be observed in the interval (0,4)?
p_0_4 <- pbinom(4, size = 12, prob = 0.3)
p_0_4
## [1] 0.7236555
  1. What is the probability that one random draw will be greater than 3?
p_greater_3 <- 1 - pbinom(3, size = 12, prob = 0.3)
p_greater_3
## [1] 0.5074842
  1. ACE Moving Inc. The purchasing manager gets the memo about replacing some aging trucks in the moving company’s fleet for the next fiscal year. After discussing the task with the fleet manager and sales manager, she finds that replacing the three oldest trucks with newer three-year-old trucks will be sufficient for next year’s operations. She finally gets a budget of 450000 dollars to purchase three trucks. Upon consulting used-truck sales data, she finds that for three-year-old trucks, the average sales price is $156818 with a standard deviation of $8000.

Strategy A: She gets bids from 12 dealers for purchasing one three-year-old truck, assuming she will take the three lowest bids. Assuming the delivery costs are zero, and the sold-truck price is normally distributed with a mean of 156818 and a standard deviation of 8000, what is the probability she will be able to purchase the three trucks within the budget?

set.seed(123) 
n_sim <- 10000        
mean_price <- 156818
sd_price <- 8000
budget <- 450000
num_dealers <- 12
num_trucks <- 3

within_budget_A <- replicate(n_sim, {
  bids <- rnorm(num_dealers, mean = mean_price, sd = sd_price)
  total_cost <- sum(sort(bids)[1:num_trucks])
  total_cost <= budget
})
prob_A <- mean(within_budget_A)
prob_A
## [1] 0.7853

Strategy B: The purchasing manager found out that all the dealers give a discount for purchasing multiple trucks, In fact, the discount is 1% for purchasing three trucks. Same as Strategy A, except she will get bids for three trucks from each of the 12 dealers, applies the discount, and takes the lowest bid for three trucks.

set.seed(123) 
n_sim <- 10000        
mean_price <- 156818
sd_price <- 8000
budget <- 450000
num_dealers <- 12
num_trucks <- 3

within_budget_B <- replicate(n_sim, {
  bids <- rnorm(num_dealers, mean = mean_price, sd = sd_price)
  total_costs <- 3 * bids * 0.99
  min_total <- min(total_costs)
  min_total <= budget
})
prob_B <- mean(within_budget_B)
prob_B
## [1] 0.9684

Which one of these strategies produces the highest probability of purchasing the three trucks within the budget?

#Strategy B results in the highest probability of purchasing the 3 trucks under budget with a 96.84% chance vs. a 78.53% chance in Strategy A