#Binomial
# Calculate the probability mass function (PMF) for a binomial distribution with n=10 and p=0.5, at x=5
dbinom(5, size=10, prob=0.5)
## [1] 0.2460938
# Calculate the cumulative distribution function (CDF) for a binomial distribution with n=10 and p=0.5, at x=5
pbinom(5, size=10, prob=0.5)
## [1] 0.6230469
# Calculate the inverse of the CDF for a binomial distribution with n=10 and p=0.5, at probability=0.5
qbinom(0.5, size=10, prob=0.5) # This will return the median (5)
## [1] 5
# Generate 10 random numbers from a binomial distribution with n=10 and p=0.5
rbinom(10, size=10, prob=0.5)
##  [1] 7 6 4 3 6 2 9 6 5 4