Skip to content
Glacius
ProbabilityConcept reference

Indicator variables

An event indicator equals one when its event occurs and zero otherwise.

On this page 7 sections
  1. Overview
  2. Turn a count into a sum
  3. Count expected errors
  4. Dependence does not block the mean
  5. Key takeaway
  6. Sources & further reading
  7. Concept connections

01Turn a count into a sum#

An event indicator equals one when its event occurs and zero otherwise. Its expectation is the probability of that event, because 1P(A)+0P(Ac)=P(A)1P(A)+0P(A^c)=P(A).

E[1A]=P(A).E[\mathbf1_A]=P(A).

A count of events can be written as a sum of indicators. Linearity of expectation then adds their individual probabilities. It does not require the events to be independent.

02Count expected errors#

Suppose three predictions have error probabilities 0.1,0.2,0.40.1,0.2,0.4. Let IjI_j indicate an error on prediction jj. The total error count is N=I1+I2+I3N=I_1+I_2+I_3.

0.1+0.2+0.4=0.7.0.1+0.2+0.4=0.7.

The observed count is an integer, but its expectation can be fractional. Correlated errors can change the distribution and variance of the count without changing this sum of marginal probabilities.

Check your reasoning

Three event indicators have expectations 0.2,0.3,0.4. Find the expected sum.

  1. A0.9
  2. B0.024
  3. C3
Show answer and explanation
0.9

Linearity adds the expectations.

03Dependence does not block the mean#

Imagine two checks that always fail together, with failure probability 0.30.3. Their failure count is either zero or two. Its expectation is 2(0.3)=0.62(0.3)=0.6, also obtained by adding the two indicator expectations.

You would need dependence information to compute the chance that at least one check fails from marginal probabilities alone. For the expected number of failures, the marginals suffice.

Check your reasoning

A draft multiplies error probabilities 0.2 and 0.5 to find the expected count of errors. Correct result?

  1. A0.1
  2. B0.7
  3. C0.6
Show answer and explanation
0.7

The expected count is the sum of the two probabilities.

Define the counted event carefully so each indicator adds exactly one when it occurs. Repeated events, overlapping events, and unequal probabilities can all be handled when the intended count is specified clearly.

Key takeaway

Use an event indicator's expectation to compute a count's expected value.

  • Use an event indicator's expectation to compute a count's expected value.

Sources & further reading

  1. [1]
  2. [2]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Indicator variables.” Math behind ML. /learn/p-indicator