Create an R function which behaves like the cumulative distribution
function (CDF) of a given ddf distribution.
Details
The cumulative distribution function \(F_X\) of a discrete random variable \(X\) is given by $$F_X(x) = \mathbb{P}[X \le x],$$ where \(\mathbb{P}\) is the probability operator.
Examples
# Get value at 8 of the CDF of a geometric distribution
cdf(geometric(0.4))(8)
#> [1] 0.9899223
