The typical loss used when attempting to estimate quantiles. For a target quantile , the loss is

Here should be interpreted as your guess for the -th quantile, and is the observed value. In the case where we have

which is just the loss, the minimizer of which the median.

Suppose . Then if we are “surprised” in some sense, since this should not happen very often. So the loss takes on a higher value (proportional to ). But if we are less surprised, so the loss is small. The minimizer of the loss can be shown to be exactly the quantile.