7 Expectation and Concentration
7.1 Concentration inequalities
Let us compare the accuracy of some of the main concentration inequalities in the example of a binomial distribution. We consider \(Y\) to be binomial with parameters \((n, p)\) specified below, and compute the bounds given by Markov, Chebyshev, Bernstein, and Chernoff, which we then compare visually in several ways.
= 30 # size parameter
n = 0.2 # probability parameter
p = n*p # mean
mu = sqrt(n*p*(1-p)) # standard deviation
sigma = ceiling(mu):n # possible values above the mean y
Markov’s upper bound:
= mu/y markov
Chebyshev’s upper bound:
= 1/(1 + (y-mu)^2/sigma^2) chebyshev
Bernstein’s upper bound:
= exp(- ((y-mu)^2/2)/(sigma^2 + (y-mu)/3)) bernstein
Chernoff’s upper bound:
= y/n
b = exp(- n*(b*log(b/p) + (1-b)*log((1-b)/(1-p))))
chernoff length(chernoff)] = exp(- n*log(1/p)) # the second term in the exponential is 0 by convention when b = 1 chernoff[
Exact upper tail:
= pbinom(y-1, n, p, lower.tail = FALSE) exact
First, we plot the bounds
matplot(y, cbind(markov, chebyshev, bernstein, chernoff, exact), type = "b", lty = 1, lwd = 2, pch = 15, xlab = "", ylab = "upper tail", col = grey((4:0)/5))
legend("topright", legend = c("markov", "chebyshev", "bernstein", "chernoff", "exact"), lty = 1, lwd = 2, pch = 15, col = grey((4:0)/5))
Next, we plot the ratios of the bounds to the exact value. We do it in a logarithmic scale as some of the bounds are orders of maginture more accurate than others.
matplot(y, log(cbind(markov, chebyshev, bernstein, chernoff, exact)/exact), type = "b", lty = 1, lwd = 2, pch = 15, xlab = "", ylab = "upper tail ratio", col = grey((4:0)/5))
legend("topleft", legend = c("markov", "chebyshev", "bernstein", "chernoff", "exact"), lty = 1, lwd = 2, pch = 15, col = grey((4:0)/5))
Even though Chernoff’s bound is orders of magnitude more accurate than the other bounds (this is true here and can be proven to be true in general), the other bounds remain useful, trading accuracy for simplicity.