3 Discrete Distributions
3.1 Uniform distributions
Consider the uniform distribution on \(\{1, \dots, n\}\).
Its mass function (when defined on the integers) is given by
Here is a graph of this function
Its distribution function (when defined on the reals) is given by
Here is a graph of this function
curve(punid(x, n), 0, n, 1e3, lwd = 2, xlab = "", ylab = "")
abline(h = 0, lty = 2)
abline(h = 1, lty = 2)
3.2 Binomial distributions
Consider the binomial distribution with the following parameters.
Here is a plot of its mass function
Here is a plot of its (cumulative) distribution function
curve(pbinom(x, n, p), -1, n, 1e3, lwd = 2, xlab = "", ylab = "")
abline(h = 0, lty = 2)
abline(h = 1, lty = 2)
3.3 Geometric distributions
Here is a plot of its mass function
Here is a plot of its (cumulative) distribution function
curve(pgeom(x, p), -1, 30, 1e3, lwd = 2, xlab = "", ylab = "")
abline(h = 0, lty = 2)
abline(h = 1, lty = 2)
3.4 Poisson distributions
Here is a plot of its mass function
Here is a plot of its (cumulative) distribution function
curve(ppois(x, lambda), -1, 30, 1e3, lwd = 2, xlab = "", ylab = "")
abline(h = 0, lty = 2)
abline(h = 1, lty = 2)
Let’s check the validity of the Law of Large Numbers.
n = 100
p = 2/n
lambda = n*p
k = 0:10
tab = rbind(dbinom(k, n, p), dpois(k, lambda))
rownames(tab) = c("binomial", "poisson")
colnames(tab) = k
barplot(tab, beside = TRUE, legend = TRUE, args.legend=list(x = "topright"), names.arg = k)