Why the Bernoulli Variance Depends on the Mean
A Bernoulli response records one of two outcomes, conventionally coded \(0\) and \(1\). If the probability of observing \(1\) is small, the response is usually \(0\); if that probability is close to one, the response is usually \(1\). In either case, outcomes tend to be concentrated on one value, so the variance is small. At probability one-half, the two outcomes are equally likely, and the variance is largest. The variance function makes this relationship exact.
The goal here is to derive that function from the Bernoulli model's log-partition function, rather than relying only on a direct calculation from the two possible outcomes. This derivation also makes clear which quantity is the response mean and which is the canonical parameter.
The Bernoulli Log-Partition Function
For \(0<p<1\), the Bernoulli probability mass function can be written in canonical exponential-family form. The natural, or canonical, parameter is \(\theta=\log\{p/(1-p)\}\), which gives \(p=e^\theta/(1+e^\theta)\). The log-partition function normalizes the probabilities so that they sum to one.
To check the representation, the probability at \(y=0\) is \(\exp\{-b(\theta)\}=1/(1+e^\theta)\), and the probability at \(y=1\) is \(\exp\{\theta-b(\theta)\}=e^\theta/(1+e^\theta)\). These add to one. Thus the parameter \(\theta\) ranges over all real numbers, while the mean \(\mu\) ranges over the open interval \((0,1)\). They are related, but they are not the same parameter.
Why Derivatives of the Log-Partition Function Give Moments
The link between the log-partition function and moments follows directly by differentiating the normalizing sum. For a finite response space, the sum has finitely many terms, so differentiating it term by term requires no interchange of a limit and an integral. The Bernoulli response has precisely this finite-support structure.
Proof. Define \(Z(\theta)=\sum_y e^{\theta y}\), so \(b(\theta)=\log Z(\theta)\). Because the response space is finite, \(Z'(\theta)=\sum_y y e^{\theta y}\). Differentiating the logarithm gives
For the second derivative, differentiating this quotient gives
The final equality is the definition of variance. This proves both derivative identities. \(\square\)
Deriving the Bernoulli Variance Function
Apply the result to \(b(\theta)=\log(1+e^\theta)\). Differentiation gives
To express the second derivative in terms of the mean, use \(\mu=e^\theta/(1+e^\theta)\), so \(1-\mu=1/(1+e^\theta)\). Their product is
This establishes the Bernoulli variance function on its mean domain. The same formula can also be checked directly from the two possible response values: since \(Y^2=Y\), \(E[Y^2]=E[Y]=\mu\), and therefore \(\operatorname{Var}(Y)=E[Y^2]-E[Y]^2=\mu-\mu^2\).
Proof of the shape claims. For \(0<\mu<1\), both factors in \(\mu(1-\mu)\) are positive, so \(V(\mu)>0\). To locate its maximum, complete the square:
Equality holds exactly when \(\mu=1/2\). At the boundaries, direct limits give \(\lim_{\mu\to 0^+}\mu(1-\mu)=0\) and \(\lim_{\mu\to 1^-}\mu(1-\mu)=0\). Hence variance is largest at one-half and approaches zero at either end of the mean domain. \(\square\)
Worked Evaluations Across the Probability Scale
Worked Example: A Probability Near Zero
Suppose a Bernoulli outcome has success probability \(p=0.01\). Its mean is \(\mu=p=0.01\), so the variance is
For comparison, the standard deviation is \(\sqrt{0.0099}\approx 0.0995\). Most responses are zero: \(P(Y=0)=0.99\), and the small variance reflects this concentration. It is not zero, because a success remains possible.
Worked Example: Probability One-Half
If \(p=\mu=0.5\), the two outcomes have equal probability. Substitution gives
The standard deviation is \(\sqrt{0.25}=0.5\). This is the maximum possible Bernoulli variance: the completed-square identity shows that no other mean in \((0,1)\) can give a value greater than \(0.25\).
Worked Example: A Probability Near One
Suppose \(p=\mu=0.99\). Then
The variance matches the value at \(p=0.01\). This equality follows from \(V(\mu)=V(1-\mu)\): replacing \(\mu\) by \(1-\mu\) merely switches the two factors. At \(p=0.99\), most responses are one, just as most responses are zero at \(p=0.01\); either concentration makes the variance small.
Worked Example: Comparing Two Means
Consider Bernoulli responses with means \(0.2\) and \(0.4\). Their variances are, respectively,
Moving from \(0.2\) toward \(0.5\) increases the variance. In contrast, moving from \(0.6\) to \(0.8\) gives \(V(0.6)=0.6(0.4)=0.24\) and \(V(0.8)=0.8(0.2)=0.16\), a decrease as the mean moves away from one-half. The function is symmetric about one-half, not steadily increasing or decreasing across the whole interval.
What the Function Tells Us—and What It Does Not
For a Bernoulli response, the mean completely determines the variance because the distribution has only two possible values and the probability of one fixes the probability of the other. The formula \(V(\mu)=\mu(1-\mu)\) is therefore a precise statement about how response variability changes with its mean. It is not a claim that every distribution with mean \(\mu\) must have this variance.
The boundary values require a small qualification. The finite canonical parameter \(\theta\in\mathbb{R}\) produces only \(0<\mu<1\). At \(\mu=0\) or \(\mu=1\), the Bernoulli distribution is degenerate and has variance zero; these cases are included as boundary limits of the variance function, although no finite \(\theta\) gives either one. In calculations near a boundary, the variance is small but remains positive as long as the probability is strictly between zero and one.
Common Mistake
A frequent error is to treat the canonical parameter \(\theta\) as if it were the mean and write \(V(\theta)=\theta(1-\theta)\). This is wrong: \(\theta\) can be any real number, while a probability or mean must lie between zero and one. The correct sequence is to differentiate \(b(\theta)\) to obtain \(\mu=b'(\theta)\), calculate \(b''(\theta)\), and then rewrite that derivative using \(\mu\). The result is \(V(\mu)=\mu(1-\mu)\), with the function taking the mean—not the canonical parameter—as its argument.
A second misleading shortcut is to say that variance increases as the mean increases. The examples at \(0.2\), \(0.5\), and \(0.8\) disprove that claim: the variance rises up to one-half and then falls symmetrically. Always consider where the mean lies relative to one-half.
Check Your Understanding
Use the log-partition derivation and the variance function to answer these questions.
- For a Bernoulli response with mean \(0.3\), calculate the variance and state whether it is above or below the variance at mean one-half.
- Why does differentiating the finite normalizing sum for the Bernoulli model require no interchange of a limit and an integral?
- Explain why \(\theta\) is not the argument of the Bernoulli variance function, and state how \(\theta\) and \(\mu\) are related.
- What are the limiting values of the variance as the mean approaches zero and one? Are these means generated by finite canonical parameters?
- Show from the variance formula why means \(0.15\) and \(0.85\) give the same variance.