Tutorials › Statistical Theory I - Probability and Distribution Theory › Expected Counts from Sums of Indicators

Expectation and LOTUS · Tutorial 310 of 994

Expected Counts from Sums of Indicators

Representing a count with indicators turns its expected value into a sum of event probabilities, even when the events are dependent.

Intermediate 10 min read

What You'll Learn

  • Define a count as a sum of indicators for its component events
  • Derive the expectation of a finite count using finite linearity of expectation
  • Calculate an expected number of successes from unequal success probabilities
  • Find the expected number of strict threshold exceedances from marginal distributions
  • Compute expected occupancy in a balls-into-boxes model
  • Explain why dependence among events does not change the expected-count formula

Why Count with Indicators?

Many random quantities are counts: the number of patients who respond to treatment, the number of measurements above a threshold, or the number of boxes that receive at least one item. A count may be difficult to describe by listing all possible outcomes, especially when the events being counted are dependent. But each component event has a simple numerical representation: an indicator that is one when the event occurs and zero otherwise.

Adding those indicators recovers the count outcome by outcome. Taking expectations then gives a useful calculation: the expected count is the sum of the probabilities of the events being counted. This method uses marginal event probabilities; it does not require the events to be independent.

Definition: For an event \(A\), its indicator is the random variable \(\mathbf{1}_A\) defined by \(\mathbf{1}_A=1\) when \(A\) occurs and \(\mathbf{1}_A=0\) otherwise. For a finite collection of events \(A_1,\ldots,A_n\), the number of those events that occur is $$ N=\sum_{i=1}^{n}\mathbf{1}_{A_i}. $$

The count \(N\) takes integer values from zero to \(n\). The events need not be disjoint: if several occur together, each corresponding indicator contributes one. Nor must the events be independent. The sum records how many occur in the particular outcome, including when their occurrences are related.

The Expected-Count Formula

An indicator is a particularly simple random variable: it is one with probability \(P(A)\) and zero with probability \(1-P(A)\). Therefore, its expectation is $$ E[\mathbf{1}_A]=1\cdot P(A)+0\cdot P(A^c)=P(A). $$ This is the indicator expectation identity. Since a finite sum of indicators is bounded, its expectation exists. Finite linearity of expectation gives the expected-count formula below.

Theorem: Let \(A_1,\ldots,A_n\) be events, and let \(N=\sum_{i=1}^{n}\mathbf{1}_{A_i}\) count how many occur. Then $$ E[N]=\sum_{i=1}^{n}P(A_i). $$ No independence assumption is required.

Proof. Each \(\mathbf{1}_{A_i}\) is bounded between zero and one, so it has a finite expectation. There are only finitely many indicators. Applying finite linearity of expectation and then the indicator expectation identity, $$ E[N] =E\!\left[\sum_{i=1}^{n}\mathbf{1}_{A_i}\right] =\sum_{i=1}^{n}E[\mathbf{1}_{A_i}] =\sum_{i=1}^{n}P(A_i). $$ This argument uses no joint probabilities such as \(P(A_i\cap A_j)\). The formula depends only on the probability of each event separately. \(\square\)

If every event has the same probability \(p\), the formula reduces to \(E[N]=np\). That special case does not require identical distributions for all the underlying measurements; it requires only that the events being counted have the same probability. If the probabilities differ, they are added individually rather than replaced by a common value.

Worked Example: Counting Treatment Successes

Suppose six patients have response indicators \(R_i\), where \(R_i=1\) if patient \(i\) responds and \(R_i=0\) otherwise. Their response probabilities are \(0.20, 0.35, 0.50, 0.65, 0.80,\) and \(0.90\), respectively. Let \(S=\sum_{i=1}^{6}R_i\) be the number of responders. Find \(E[S]\).

For each patient, the expectation of the response indicator equals that patient's response probability. Thus, $$ E[S] =0.20+0.35+0.50+0.65+0.80+0.90 =3.40. $$

The expected number of responders is \(3.4\). This is an average over repeated groups of six patients, not a possible realized count in one group: the observed count must be an integer from zero to six. The calculation does not require independent responses. For example, patient outcomes could be associated through a shared clinical environment and the expected-count result would still hold, provided the six marginal response probabilities remain as stated.

Counts of Threshold Exceedances

A count often arises by applying the same rule to several random measurements. Given random variables \(X_1,\ldots,X_n\) and a fixed threshold \(c\), define \(A_i=\{X_i>c\}\). The number strictly exceeding the threshold is $$ N_c=\sum_{i=1}^{n}\mathbf{1}_{\{X_i>c\}}. $$ The expected-count formula says to evaluate each exceedance probability and add them. The distributions need not be the same, and the measurements need not be independent.

Result: For any finite collection of random variables \(X_1,\ldots,X_n\) and any real threshold \(c\), $$ E\!\left[\sum_{i=1}^{n}\mathbf{1}_{\{X_i>c\}}\right] =\sum_{i=1}^{n}P(X_i>c). $$

Derivation. For each \(i\), the event \(A_i=\{X_i>c\}\) has indicator \(\mathbf{1}_{A_i}\), and \(E[\mathbf{1}_{A_i}]=P(A_i)=P(X_i>c)\). The number of exceedances is the sum of these indicators. Applying finite linearity gives $$ E\!\left[\sum_{i=1}^{n}\mathbf{1}_{\{X_i>c\}}\right] =\sum_{i=1}^{n}E[\mathbf{1}_{\{X_i>c\}}] =\sum_{i=1}^{n}P(X_i>c). $$ Each indicator is bounded, so all expectations in this finite sum exist. \(\square\)

Worked Example: Counting Strict Exceedances

Four laboratory measurements have the following distributions: \(X_1\) is 8 with probability \(0.70\) and 12 with probability \(0.30\); \(X_2\) is 9, 11, or 14 with probabilities \(0.20, 0.50,\) and \(0.30\); \(X_3\) is 10 with probability \(0.40\) and 13 with probability \(0.60\); and \(X_4\) is 6, 10, or 15 with probabilities \(0.25, 0.25,\) and \(0.50\). Find the expected number of measurements strictly greater than 10.

Let \(N=\sum_{i=1}^{4}\mathbf{1}_{\{X_i>10\}}\). The strict inequality matters: a value equal to 10 is not an exceedance. The four probabilities are $$ \begin{aligned} P(X_1>10)&=0.30,\\ P(X_2>10)&=0.50+0.30=0.80,\\ P(X_3>10)&=0.60,\\ P(X_4>10)&=0.50. \end{aligned} $$ Therefore, $$ E[N]=0.30+0.80+0.60+0.50=2.20. $$

On average, 2.2 of the four measurements exceed 10. In particular, the mass of \(X_3\) at exactly 10 contributes nothing to \(P(X_3>10)\). If the question instead asked for the number at least 10, that mass would have to be included.

Occupancy: Counting Boxes That Are Used

Occupancy problems count how many categories or locations are reached by a collection of items. For each box, define an indicator that equals one if the box receives at least one ball. The total number of occupied boxes is the sum of those indicators. Although the occupancy indicators are usually dependent, their probabilities can still be added to find the expected number of occupied boxes.

Worked Example: Expected Number of Occupied Boxes

Five balls are placed independently, with each ball equally likely to land in any of three boxes. Let \(O\) be the number of boxes containing at least one ball. Find \(E[O]\).

For box \(j\), let \(A_j\) be the event that box \(j\) is occupied. A fixed box is empty only if every ball lands in one of the other two boxes. For each ball that probability is \(2/3\), and the placements of the five balls are independent. Hence $$ P(A_j)=1-P(\text{box }j\text{ is empty}) =1-\left(\frac{2}{3}\right)^5 =1-\frac{32}{243} =\frac{211}{243}. $$

All three boxes have the same occupancy probability. Writing \(O=\sum_{j=1}^{3}\mathbf{1}_{A_j}\), we obtain $$ E[O]=3\cdot\frac{211}{243} =\frac{633}{243} =\frac{211}{81} \approx 2.605. $$

The expected number is about 2.605 occupied boxes. This is not a claim that a particular placement has a fractional number of occupied boxes. Each placement has an integer occupancy count; the expectation averages that count across repetitions. Occupancy events for different boxes are dependent—for instance, if all five balls land in one box, the other two are necessarily empty—but that dependence does not affect this expectation calculation.

What the Formula Does—and Does Not—Tell You

The expected-count formula is useful because it converts a potentially complicated count into a list of simpler probabilities. It remains valid with unequal probabilities and with dependence among events. For each event being counted, identify its indicator, find its marginal probability, and add.

The formula gives the mean count, not the full distribution of the count. In particular, it does not by itself give \(P(N\geq 1)\), the probability that at least one event occurs. That probability concerns the union \(A_1\cup\cdots\cup A_n\), and generally cannot be obtained just by summing the marginal probabilities. For example, the sum of event probabilities can exceed one, whereas a probability cannot.

Dependence can matter for other features of a count, including its distribution and its variance. The point here is narrower: dependence does not alter the expectation identity. This distinction is especially useful in occupancy, clustered response, and repeated-measurement settings, where independence may be implausible but the individual event probabilities are available.

Common pitfall: It is wrong to argue that \(E[N]=np\) merely because there are \(n\) events; that simplification requires each event to have the same probability \(p\). The general formula is \(E[N]=\sum_{i=1}^{n}P(A_i)\). It is also wrong to require independence before adding those probabilities: independence is not needed for the expectation of a finite sum.

A reliable calculation has three steps: define exactly what is being counted, write the count as a sum of event indicators, and compute the probability of each event. Check boundary wording such as “greater than” versus “at least,” and distinguish the expected count from the probability that the count is nonzero.

Check Your Understanding

Use indicator representations and event probabilities to answer these questions.

  1. Three events have probabilities \(0.10\), \(0.40\), and \(0.70\). What is the expected number that occur? Is independence needed?
  2. There are eight trials, each with success probability \(0.25\). What is the expected number of successes, whether or not the trials are independent?
  3. For a fixed threshold \(c\), explain how to represent the number of \(X_i\)'s that are at least \(c\). Which event probability belongs in the expected-count formula?
  4. In the five-ball, three-box example, why can the expected number of occupied boxes be calculated without finding the full distribution of that count?
  5. Why does an expected count of \(2.2\) not imply that the count equals \(2.2\) in any one repetition?