# Example of the CDF ---- ## Roll a pair of dice ## PMF x <- seq(2,12) x pmf <- c(1/36, 2/36, 3/36, 4/36, 5/36, 6/36, 5/36, 4/36, 3/36, 2/36, 1/36) pmf plot(x, pmf, type = "h", lwd = 10, col = "blue", xlab = "x", ylab = "P(X=x)", main = "PMF of the sum of two dice") ## CDF cdf <- cumsum(pmf) cdf plot(x, cdf, type = "s", lwd = 10, col = "blue", xlab = "x", ylab = "P(X<=x)", main = "CDF of the sum of two dice")