Load the stats package for gamma distribution functions
library(stats)
Parameters of the gamma distribution
k <- 10 # shape parameter theta <- 2 # scale parameter
Calculate the probability P(X > 22) using the gamma distribution
CDF
prob_x_gt_22 <- 1 - pgamma(22, shape = k, scale = theta)
Print the probability
cat(“Probability that X > 22 minutes:”, round(prob_x_gt_22, 4),
“”)
Probability that X > 22 minutes: 0.3405