An indicator variable is a random variable that takes the value 1 for some desired outcome and the value 0 for all other outcomes. They indicate (hence the name) whether a subject belongs to a specific category or not. More specifically, an indicator variable is defined by
Indicator variables satisfy an important property: if and are indicator variables, then
Indicator variables can be used in several other ways as well. For instance,
which is useful for constructing a multiplicative factor; for instance, doubles the result if the desired event occurs, and leaves it unchanged otherwise. Similarly,
which is useful for constructing an additive factor; for instance, adds to the result if the desired event occurs, and leaves it unchanged otherwise.
Indicator variables are very useful in constructing formulas involving cases since they vanish when the criteria for their case is not satisfied. Here is an example:
At a restaurant, a meal costs $10, dessert costs $5, and a drink costs $3. However, if one purchases all three, then the total price is discounted by $2. What is the price of a trip to this restaurant, in terms of the indicator variables
A patron of this restaurant would spend $10 on the meal if , and $0 on the meal otherwise. Hence this can be modeled by . Similarly, the dessert and drink can be modeled by and , respectively. This gives an intermediate result of
However, this formula fails to account for the $2 discount in the case of all three being purchased. This can be expressed by an indicator variable
so the final result is
Indicator variables can deal with multiplicative modifiers as well:
As part of a promotion, the same restaurant decides to give 50% off the total price if a customer purchases a meal, a drink, and a dessert, instead of the flat $2 discount. Construct a formula for the new cost of a visit, using the same indicator variables.
As before, the cost without the discount can be written as
This should be halved if the customer purchases all 3 items, which can (as before) be modeled by the indicator variable . Using the multiplicative strategy from the last section, the final result is thus