Tutorials › Statistical Theory I - Probability and Distribution Theory › Moments of Indicators and Integer-Valued Variables

Moments and Generating Functions · Tutorial 498 of 994

Moments of Indicators and Integer-Valued Variables

Use indicator sums and finite expansions to calculate moments of event counts, and see why raw and factorial moments are different summaries.

Intermediate 9 min read

What You'll Learn

  • Represent an event count as a sum of indicator random variables.
  • Expand the first, second, and general integer-order raw moments into joint-event probabilities.
  • Relate the variance of an event count to individual probabilities and pairwise dependence.
  • Compute raw moments of nonnegative integer-valued variables from their tail probabilities.
  • Define factorial moments and distinguish them from raw moments.
  • Calculate moments for dependent event counts and independent Bernoulli trials.

Counting Events With Indicators

A count of events is a random variable, but its value can often be easier to study after it is written as a sum. The key device is the indicator of an event: it equals one when the event occurs and zero otherwise. This representation turns questions about a count into finite sums of probabilities, including probabilities of joint occurrence. It also makes clear why the count’s variance depends on whether the events tend to occur together.

Definition: For an event \(A\), its indicator random variable is \[ \mathbf{1}_A = \begin{cases} 1, & \text{if } A \text{ occurs},\\ 0, & \text{if } A \text{ does not occur}. \end{cases} \] It satisfies \(E[\mathbf{1}_A]=P(A)\) and \(\mathbf{1}_A^r=\mathbf{1}_A\) for every positive integer \(r\). If \(A_1,\ldots,A_n\) are events, their count is \(S=\sum_{i=1}^n \mathbf{1}_{A_i}\).

The expectation identity follows directly from the two possible values of the indicator: \(E[\mathbf{1}_A]=1\cdot P(A)+0\cdot P(A^c)=P(A)\). The power identity holds because both zero and one are unchanged by any positive integer power. In particular, the first moment of an event count is the sum of the event probabilities, whether or not the events are independent.

$$ E[S]=\sum_{i=1}^n P(A_i). $$

For higher moments, expand the sum before taking expectations. The resulting terms correspond to joint occurrences of events. This simple expansion is useful because it makes no independence assumption.

Theorem: For a finite collection of events \(A_1,\ldots,A_n\) and a positive integer \(r\), \[ E[S^r]=\sum_{i_1=1}^n\cdots\sum_{i_r=1}^n P(A_{i_1}\cap\cdots\cap A_{i_r}), \quad \text{where } S=\sum_{i=1}^n\mathbf{1}_{A_i}. \] Repeated indices are included in these sums.

Proof. Since \(S=\sum_{i=1}^n\mathbf{1}_{A_i}\), multiplying out its \(r\)th power gives a sum indexed by all ordered \(r\)-tuples:

$$ S^r=\sum_{i_1=1}^n\cdots\sum_{i_r=1}^n \mathbf{1}_{A_{i_1}}\cdots\mathbf{1}_{A_{i_r}}. $$

A product of indicators is one precisely when all the indicated events occur, and is zero otherwise. Thus that product is the indicator of their intersection, even when some indices repeat. Taking expectations of the finite sum and using \(E[\mathbf{1}_B]=P(B)\) for each intersection \(B\) proves the identity. \(\square\)

First and Second Moments of an Event Count

For \(r=2\), the expansion separates into terms with the same index and terms with different indices. Because \(\mathbf{1}_{A_i}^2=\mathbf{1}_{A_i}\), the diagonal terms contribute the individual event probabilities. The other terms contribute pairwise joint probabilities:

$$ E[S^2]=\sum_{i=1}^n P(A_i) +2\sum_{1\le i<j\le n}P(A_i\cap A_j). $$

Subtracting \(E[S]^2\) gives the variance formula below. Equivalently, the variance is the sum of the individual indicator variances and twice the sum of their pairwise covariances. Here \(p_i=P(A_i)\); no assumption of independence is made.

Theorem: For \(S=\sum_{i=1}^n\mathbf{1}_{A_i}\), \[ \operatorname{Var}(S) =\sum_{i=1}^n p_i(1-p_i) +2\sum_{1\le i<j\le n} \bigl[P(A_i\cap A_j)-p_i p_j\bigr]. \]

Proof. By the second-moment expansion and the identity \(E[S]=\sum_i p_i\),

$$ \begin{aligned} \operatorname{Var}(S) &= E[S^2]-(E[S])^2\\ &= \sum_i p_i+2\sum_{i<j}P(A_i\cap A_j) -\left(\sum_i p_i^2+2\sum_{i<j}p_i p_j\right)\\ &= \sum_i p_i(1-p_i) +2\sum_{i<j}\bigl[P(A_i\cap A_j)-p_i p_j\bigr]. \end{aligned} $$

The final bracket is \(\operatorname{Cov}(\mathbf{1}_{A_i},\mathbf{1}_{A_j})\), as follows by taking the expectation of the product of the indicators and subtracting the product of their expectations. This proves the stated formula. \(\square\)

Worked Example: A Count With Dependent Events

Let the sample space be \(\{1,2,3,4\}\), with each outcome having probability \(1/4\). Define \(A_1=\{1,2\}\), \(A_2=\{2,3\}\), and \(A_3=\{2,4\}\). Find the first two raw moments and the variance of the event count \(S\).

Each event has probability \(1/2\), so \(E[S]=1/2+1/2+1/2=3/2\). Each pair of events intersects only at outcome 2, so every pairwise intersection has probability \(1/4\). Therefore,

$$ E[S^2]=\frac{3}{2} +2\left(\frac14+\frac14+\frac14\right)=3. $$

It follows that \(\operatorname{Var}(S)=E[S^2]-(E[S])^2=3-9/4=3/4\). Directly checking the count gives \(S=1,3,1,1\) at outcomes \(1,2,3,4\), respectively. Thus the same results are \(E[S]=(1+3+1+1)/4=3/2\) and \(E[S^2]=(1+9+1+1)/4=3\). The event indicators are dependent: their joint probabilities, not just their marginal probabilities, enter the second moment.

Independent Bernoulli Indicators

A Bernoulli random variable takes the value one with some probability \(p\) and zero with probability \(1-p\). If \(I_1,\ldots,I_n\) are independent Bernoulli variables with the same success probability \(p\), their sum \(S=\sum_i I_i\) counts successes in \(n\) trials. Independence makes each pairwise covariance zero, so \(E[S]=np\) and \(\operatorname{Var}(S)=np(1-p)\). The second raw moment follows by adding the squared mean to the variance.

Worked Example: Raw and Factorial Moments of a Binomial Count

Suppose four independent trials each succeed with probability \(1/3\), and let \(S\) be the number of successes. Then \(S\) is binomial with parameters \(4\) and \(1/3\). Its mean and variance are

$$ E[S]=4\left(\frac13\right)=\frac43, \qquad \operatorname{Var}(S)=4\left(\frac13\right)\left(\frac23\right)=\frac89. $$

The second raw moment is \(E[S^2]=\operatorname{Var}(S)+(E[S])^2=8/9+16/9=8/3\). It can also be checked directly from the event-count expansion: the four diagonal terms sum to \(4/3\), and the six distinct pairs contribute \(2\cdot6\cdot(1/3)^2=4/3\), for a total of \(8/3\).

The second factorial moment uses the falling-factorial power \(S(S-1)\), rather than \(S^2\). It counts ordered pairs of distinct successful trials. There are \(4\cdot3\) such ordered pairs, each with probability \(1/9\), so \(E[S(S-1)]=12/9=4/3\). This differs from the second raw moment \(8/3\).

Raw Moments From Tail Probabilities

Indicator sums also give a useful representation for a nonnegative integer-valued random variable \(X\). For each positive integer \(k\), the indicator \(\mathbf{1}_{\{X\ge k\}}\) records whether \(X\) reaches at least \(k\). If \(X=m\), exactly \(m\) of these indicators equal one. Consequently, \(X=\sum_{k=1}^{\infty}\mathbf{1}_{\{X\ge k\}}\), with only finitely many nonzero terms for each finite value of \(X\).

Theorem: If \(X\) is finite almost surely and takes values in \(\{0,1,2,\ldots\}\), then for each positive integer \(r\), \[ E[X^r]=\sum_{k=1}^{\infty}\bigl(k^r-(k-1)^r\bigr)P(X\ge k), \] where either side may be infinite.

Proof. For every nonnegative integer \(m\), telescoping gives \[ m^r=\sum_{k=1}^{m}\bigl(k^r-(k-1)^r\bigr). \] Substitute \(m=X\). Each summand is nonnegative, since \(k^r-(k-1)^r\ge0\), so the monotone convergence theorem allows expectation to pass through the increasing sequence of finite partial sums, including when the expectation is infinite. Finally, \(E[\mathbf{1}_{\{X\ge k\}}]=P(X\ge k)\). Therefore

$$ E[X^r]=\sum_{k=1}^{\infty} \bigl(k^r-(k-1)^r\bigr)E[\mathbf{1}_{\{X\ge k\}}] =\sum_{k=1}^{\infty} \bigl(k^r-(k-1)^r\bigr)P(X\ge k). $$

This proves the identity. \(\square\)

Worked Example: Tail Sums and Two Second-Order Moments

Let \(X\) assign probability \(1/4\) to each of \(0,1,2,4\). Its second raw moment from the distribution is

$$ E[X^2]=\frac{0^2+1^2+2^2+4^2}{4}=\frac{21}{4}. $$

The tail probabilities are \(P(X\ge1)=3/4\), \(P(X\ge2)=1/2\), \(P(X\ge3)=1/4\), and \(P(X\ge4)=1/4\); later tails are zero. For \(r=2\), the increments \(k^2-(k-1)^2\) are \(1,3,5,7\) at \(k=1,2,3,4\). Hence the tail formula gives

$$ E[X^2]=1\left(\frac34\right)+3\left(\frac12\right) +5\left(\frac14\right)+7\left(\frac14\right) =\frac{21}{4}. $$

For comparison, the second factorial moment is \(E[X(X-1)]\). Direct calculation gives \([0+0+2+12]/4=7/2\), not \(21/4\). The distinction is also visible from the pointwise identity \(X^2=X(X-1)+X\): here \(E[X]=7/4\), and \(7/2+7/4=21/4\).

Factorial Moments and a Common Pitfall

For a nonnegative integer-valued \(X\), its \(r\)th factorial moment is the expectation of the falling-factorial power \(X^{\underline r}=X(X-1)\cdots(X-r+1)\), for a positive integer \(r\), whenever that expectation is finite. By convention, \(X^{\underline 0}=1\). Unlike \(X^r\), the falling-factorial power is zero when \(X\) is a nonnegative integer less than \(r\). For example, \(X^{\underline 2}=X(X-1)\) counts ordered pairs of distinct items when \(X\) is a count.

A common mistake is to treat the \(r\)th raw moment and the \(r\)th factorial moment as interchangeable. They are not: for instance, \(X^2=X(X-1)+X\), so their expectations differ by \(E[X]\) when the moments are finite. Another error is to calculate the variance of a sum of indicators using only the individual event probabilities. That suffices for the mean, but the variance also depends on the pairwise joint probabilities unless independence is established.

Key takeaway: Write an event count as a sum of indicators before expanding its moments. Raw powers expand over all index tuples, including repetitions; factorial powers emphasize distinct selections. For an integer-valued variable, tail indicators also express raw moments as weighted sums of tail probabilities.

Check Your Understanding

Use indicator expansions and the definitions of raw and factorial moments to answer these questions.

  1. For \(S=\mathbf{1}_{A_1}+\mathbf{1}_{A_2}\), write \(E[S^2]\) in terms of \(P(A_1)\), \(P(A_2)\), and \(P(A_1\cap A_2)\).
  2. Why does \(E[S]=\sum_iP(A_i)\) hold without independence, while the variance can depend on joint event probabilities?
  3. If \(X\) takes values in \(\{0,1,2,\ldots\}\), what indicator sum equals \(X\)?
  4. For an integer-valued count \(S\), explain what \(S(S-1)\) counts and how it differs from \(S^2\).
  5. Two independent Bernoulli trials each have success probability \(1/2\). Find the mean and variance of their total number of successes.