Q1)

Q2)

Q3) a,b,c + proof

Q3e)

set.seed(102)

lambda <- 5
n <- 1000

# Generate waiting times in minutes
x <- rexp(n, rate = lambda)

# EDF
Fn <- ecdf(x)

# Confidence band 
alpha <- 0.05
eps <- sqrt(log(2 / alpha) / (2 * n))

plot(Fn,
     main = "EDF of Exponential Waiting Times",
     xlab = "Waiting time until next call (minutes)",
     ylab = "F(t)",
     verticals = TRUE,
     do.points = FALSE)

# Grid for smooth CI bands
tgrid <- seq(0, max(x), length.out = 500)
edf_vals <- Fn(tgrid)

lower <- pmax(edf_vals - eps, 0)
upper <- pmin(edf_vals + eps, 1)

lines(tgrid, lower, col = "red", lty = 2, lwd = 2)
lines(tgrid, upper, col = "red", lty = 2, lwd = 2)

# Optional: add true CDF
lines(tgrid, pexp(tgrid, rate = lambda),
      col = "blue", lwd = 2)

legend("bottomright",
       legend = c("EDF", "95% CI band", "True CDF"),
       col = c("black", "red", "blue"),
       lty = c(1, 2, 1),
       lwd = c(1, 2, 2))