Why Coordinate Sensitivity Matters
Many statistics are functions of an entire data set, rather than simple averages of individual observations. Examples include a maximum, the number of distinct categories observed, or a complicated score computed from all the inputs. To control the fluctuation of such a statistic, it can be enough to know how much its value could change when one input is replaced while all the others stay fixed.
This idea is useful when the statistic is not itself a sum of independent terms. The inputs can still be independent even when the function of those inputs is complicated. McDiarmid’s inequality turns bounds on one-coordinate changes into a probability bound around the function’s expectation.
Bounded Differences
\(|f(x_1,\ldots,x_i,\ldots,x_n)-f(x_1,\ldots,x_i',\ldots,x_n)|\leq c_i.\)
Equivalently, this condition may be imposed on sets of full probability for each input. The constant \(c_i\) bounds the effect of replacing input \(i\), not the size of that input.
Write \(Z=f(X_1,\ldots,X_n)\) and \(C=\sum_{i=1}^n c_i^2\). The relevant scale is \(C\), the sum of the squared coordinate-wise bounds. A coordinate with a larger possible effect contributes more because its bound is squared. If \(C=0\), changing any one coordinate has no effect; by changing coordinates one at a time, \(f\) is constant on the product of the input domains.
The theorem does not require the \(X_i\) to have the same distribution. It does require independence, and the bounded-differences condition must apply regardless of the values of the other coordinates. The quantity \(t\) is the absolute deviation from the expectation, while \(C\) determines how quickly the bound decreases as that deviation grows.
Two Useful Consequences
The coordinate-wise condition also controls the change between any two complete input vectors. This fact helps explain why the individual bounds add along a sequence of replacements.
Proof. List the coordinates where \(x\) and \(y\) differ as \(i_1,\ldots,i_k\). Form a sequence of vectors starting at \(x\), replacing coordinate \(i_1\) by its value in \(y\), then coordinate \(i_2\), and continuing until the vector is \(y\). Each consecutive pair differs in just one coordinate, so the change in \(f\) at step \(j\) is at most \(c_{i_j}\). The triangle inequality therefore gives
This is a deterministic consequence of the definition; independence is not needed for it. Independence enters McDiarmid’s probability bound.
The two-sided version of the theorem follows directly from its one-sided version and the union bound. Apply the one-sided inequality to \(f\) for the upper tail. For the lower tail, apply it to \(-f\), which has the same coordinate bounds. Then
Thus the factor of \(2\) in the two-sided statement comes from combining two one-sided events; it is not part of the exponent.
Worked Applications
Worked Example: A Bounded Average
Let \(X_1,\ldots,X_{25}\) be independent observations in \([0,1]\), not necessarily identically distributed, and let \(f(X_1,\ldots,X_{25})=\frac{1}{25}\sum_{i=1}^{25}X_i\). Find the one-sided McDiarmid bound for an upward deviation of \(t=0.2\).
Replacing \(X_i\) by another value in \([0,1]\) changes the average by at most \(1/25\), since
Thus \(c_i=1/25\) for every \(i\), so \(C=25(1/25)^2=1/25=0.04\). Substituting \(t=0.2\) gives
The two-sided bound is \(2\exp(-2)\approx 0.2707\). The calculation depends on the range of each observation and on the average’s factor \(1/25\); it does not require identical distributions.
Worked Example: The Maximum of Uniform Observations
Let \(X_1,\ldots,X_4\) be independent Uniform\((0,1)\) random variables, and define \(M=\max_i X_i\). Replacing any one coordinate can change the maximum by at most \(1\), so \(c_i=1\) and \(C=4\). First calculate the expectation. For \(0\leq x\leq 1\),
Therefore \(M\) has density \(4x^3\) on \([0,1]\), and
For an upward deviation of \(t=0.15\), McDiarmid’s inequality gives
For comparison, the exact probability is \(P(M\geq 0.95)=1-0.95^4=0.18549375\). The general bound is valid but not tight here. A distribution-specific calculation can be much more informative when it is available.
Worked Example: Counting Observed Categories
Suppose six independent observations each fall into one of three categories, with probability \(1/3\) for each category. Let \(K\) be the number of distinct categories observed. Replacing one observation can remove at most one category from the observed set and add at most one. These changes cannot combine to alter the total count by more than one: if the old category disappears, the new category either was already present or replaces it. Hence \(c_i=1\) for all six inputs and \(C=6\).
For each category, the probability it is not observed is \((2/3)^6=64/729\). Its probability of being observed is \(1-64/729=665/729\). Writing \(K\) as the sum of the three indicators that a category appears, linearity of expectation gives
For an upward deviation \(t=0.25\), the inequality yields
This example illustrates how to handle a statistic that is not an average: identify the effect of a single replacement, then use the resulting constants. As with the maximum, the bound may be conservative.
Common Mistakes and Practical Interpretation
A frequent error is to use the sum of the bounds, \(\sum_i c_i\), in McDiarmid’s exponent. The theorem uses \(\sum_i c_i^2\). The sum \(\sum_i c_i\) instead appears in the deterministic proposition bounding how much \(f\) can change between two vectors. These are different statements with different roles.
Another error is to overlook scaling. If a statistic is an average of \(n\) observations in an interval of length \(b-a\), replacing one observation changes it by at most \((b-a)/n\), not \(b-a\). The corresponding sum of squared bounds is \((b-a)^2/n\). Missing the factor \(1/n\) can make the resulting concentration bound far weaker than the correct one.
Finally, coordinate-wise bounded changes alone do not justify McDiarmid’s inequality when the inputs are dependent. The theorem’s independence assumption is essential. Nor should the bound be mistaken for an exact tail probability: it is a general upper bound around \(E[f]\), and it can be loose, as the maximum example shows. The main practical work is often choosing valid, informative \(c_i\) before substituting into the theorem.
Check Your Understanding
Use the definitions and results above to answer these questions.
- For an average of \(n\) independent observations in \([a,b]\), what is a valid bound \(c_i\) for replacing one observation, and what is \(\sum_i c_i^2\)?
- Why does the deterministic bound between two input vectors not require independence, while McDiarmid’s inequality does?
- If \(C=9\) and \(t=1\), write the one-sided McDiarmid bound and the two-sided bound.
- A function changes by at most \(0.1\) when any one of 20 inputs is replaced. What is \(C\)?
- Explain why a valid McDiarmid bound can still be uninformative for a particular function and threshold.