Why the Direction of an Error Can Matter
A prediction can miss an outcome by the same amount in two opposite directions. If the outcome is 10, predicting 8 is an underprediction by 2, while predicting 12 is an overprediction by 2. A loss function turns each miss into a nonnegative penalty. Some losses treat these two errors equally; others deliberately penalize one direction more heavily.
The distinction matters when the consequences of being too low differ from the consequences of being too high. Underestimating demand may cause shortages, while overestimating it may cause excess inventory. The loss function expresses which kinds of errors are costly and by how much. This tutorial compares three choices: squared loss, absolute loss, and pinball loss. It focuses on their penalties for given predictions, not on finding predictions that minimize risk.
Three Losses in a Common Notation
Let \(y\) be an observed outcome and \(a\) a prediction. Define the signed error as \(e=y-a\). Thus \(e>0\) means \(a<y\), so the prediction is too low; \(e<0\) means \(a>y\), so the prediction is too high. The magnitude \(|e|\) records how far the prediction is from the outcome, without recording its direction.
All three losses are nonnegative and equal zero when \(a=y\). Squared and absolute loss depend only on the error magnitude: changing the sign of the error does not change the penalty. Pinball loss gives the two directions different weights. When \(e>0\), its penalty per unit of error is \(\tau\); when \(e<0\), it is \(1-\tau\). A value of \(\tau\) above one half therefore assigns a larger penalty per unit to underprediction, while a value below one half assigns a larger penalty per unit to overprediction.
Worked Example: Equal-Magnitude Errors in Opposite Directions
Suppose the observed outcome is \(y=10\), and compare predictions \(a=8\) and \(a=12\). First calculate the signed errors: for \(a=8\), \(e=10-8=2\); for \(a=12\), \(e=10-12=-2\). The first prediction is too low and the second is too high.
Under squared loss, both penalties are \(2^2=4\). Under absolute loss, both are \(|2|=|-2|=2\). These losses do not distinguish the direction of these equal-sized errors.
Now take pinball loss with \(\tau=0.75\). For \(a=8\), the error is positive, so the penalty is \(0.75(2)=1.5\). For \(a=12\), the error is negative, so the penalty is \((1-0.75)(2)=0.25(2)=0.5\). The underprediction is penalized three times as heavily as the overprediction: \(1.5/0.5=3\).
Worked Example: How Error Size Changes Each Penalty
Consider an outcome \(y=20\) and predictions that miss by either 1 or 3. For underpredictions, use \(a=19\) and \(a=17\), giving errors \(e=1\) and \(e=3\). For overpredictions, use \(a=21\) and \(a=23\), giving errors \(e=-1\) and \(e=-3\).
The squared-loss penalties are \(1^2=1\) and \(3^2=9\) in either direction. The absolute-loss penalties are 1 and 3 in either direction. With pinball loss at \(\tau=0.8\), an underprediction of 1 costs \(0.8(1)=0.8\), and an underprediction of 3 costs \(0.8(3)=2.4\). An overprediction of 1 costs \(0.2(1)=0.2\), and an overprediction of 3 costs \(0.2(3)=0.6\).
This calculation separates two effects. Increasing the error from 1 to 3 multiplies squared loss by 9 and either linear loss by 3. In pinball loss, the direction-specific weight is applied in addition to the error magnitude: for every matched pair of under- and overpredictions, the penalty ratio is \(0.8/0.2=4\).
Worked Example: Reversing Which Direction Is More Costly
Let \(y=50\), with predictions \(a=46\) and \(a=54\). The signed errors are \(50-46=4\) and \(50-54=-4\): the first is an underprediction and the second an overprediction. Squared loss is \(4^2=16\) for both, and absolute loss is 4 for both.
At \(\tau=0.25\), the underprediction costs \(0.25(4)=1\), while the overprediction costs \((1-0.25)(4)=3\). At \(\tau=0.75\), the underprediction costs \(0.75(4)=3\), while the overprediction costs \((1-0.75)(4)=1\).
Changing \(\tau\) from 0.25 to 0.75 reverses which direction receives the larger penalty. In both cases the penalty for an error of 4 is calculated directly from the loss definition; no claim about which prediction should be chosen follows from this comparison alone.
Properties That Clarify the Comparison
Here, symmetry means that an error \(e\) and its sign reversal \(-e\) receive the same loss. To verify the claim, squared loss satisfies \((-e)^2=e^2\), and absolute loss satisfies \(|-e|=|e|\). For pinball loss, take any \(d>0\). The error \(e=d\) is an underprediction and has penalty \(\tau d\); the error \(e=-d\) is an overprediction and has penalty \((1-\tau)d\). These are equal exactly when $$ \tau d=(1-\tau)d \quad\Longleftrightarrow\quad \tau=1-\tau \quad\Longleftrightarrow\quad \tau=\frac{1}{2}. $$ This condition does not depend on the choice of \(d>0\), so it characterizes symmetry for all error magnitudes. \(\square\)
At \(\tau=1/2\), pinball loss is \(\frac12|e|\), not exactly \(|e|\) under the convention used here. It has the same symmetry and differs from absolute loss only by a constant factor of one half. Keeping track of this factor matters when comparing numerical loss values.
For squared loss, \((ce)^2=c^2e^2\). For absolute loss, \(|ce|=c|e|\) because \(c>0\). To check pinball loss, first suppose \(e\geq0\). Then \(ce\geq0\), so \(\rho_\tau(ce)=\tau ce=c\rho_\tau(e)\). If \(e<0\), then \(ce<0\), so \(\rho_\tau(ce)=(1-\tau)(-ce)=c(1-\tau)(-e)=c\rho_\tau(e)\). Thus the stated scaling holds on both branches of pinball loss. \(\square\)
The difference in scaling explains why large errors can have a stronger relative effect under squared loss than under either linear loss. This is separate from directional asymmetry: squared loss can heavily increase the penalty for large misses while still treating upward and downward misses equally. Pinball loss changes the relative cost by direction, but remains linear in error magnitude.
Interpreting the Loss Choice
The three definitions encode distinct judgments about error. Squared loss makes a miss of size 3 cost nine times as much as a miss of size 1, regardless of direction. Absolute loss makes it cost three times as much, also regardless of direction. Pinball loss makes the cost proportional to the miss size, then weights that amount according to whether the prediction was too low or too high.
The parameter \(\tau\) controls the direction of that weighting, not the scale of the observed outcome. A larger \(\tau\) puts more weight per unit on underprediction; a smaller \(\tau\) puts more weight per unit on overprediction. At \(\tau=1/2\), the two directions have equal weights. The loss value itself is a penalty for one outcome-prediction pair. Risk, by contrast, is an expectation of loss over a distribution; comparing these individual penalties does not by itself calculate risk or identify a prediction that minimizes it.
This directional weighting is not the same operation as assigning different weights to observations. An observation weight changes how much a particular case contributes; pinball loss changes the penalty based on the sign of that case's prediction error. Both choices can affect an overall evaluation, but they encode different information.
Common Mistake
Wrong reasoning: “If \(\tau=0.8\), an overprediction should receive weight 0.8 because the prediction is above the outcome.” This assigns the parameter to the wrong branch.
Correction: In the definition, the sign is that of \(e=y-a\), not \(a-y\). If \(e>0\), then \(a<y\): the prediction is too low, and the penalty is \(\tau e\). If \(e<0\), then \(a>y\): the prediction is too high, and the penalty is \((1-\tau)(-e)\). For \(\tau=0.8\), underprediction receives the larger per-unit penalty. A reliable check is to substitute a concrete outcome and prediction and determine the sign of \(y-a\) before choosing a branch.
Check Your Understanding
Use \(e=y-a\) to decide which pinball-loss branch applies in each calculation.
- For \(y=12\), calculate squared and absolute loss for predictions 10 and 14. What do the results show about direction?
- With \(\tau=0.7\), what are the pinball penalties for an underprediction of 5 and an overprediction of 5?
- For which value of \(\tau\) is pinball loss symmetric in the signed error? Explain using errors \(d\) and \(-d\), where \(d>0\).
- If the magnitude of an error is multiplied by 4, by what factor does squared loss change? By what factor do absolute and pinball losses change?
- Explain why increasing \(\tau\) increases the per-unit penalty for underprediction relative to overprediction.