Search

Search papers and lessons

Expectile Regression

Level 4 · 12 min read

Expectile regression fits a model by penalising squared errors asymmetrically, so that a chosen fraction tau of the mass sits on one side; tau = 0.5 gives ordinary least squares.

On this page

  • Colour = topic mix
  • Probability
  • Discrete math
  • Calculus
  • Linear algebra
  • Classical models
  • Learning basics
  • ReadReady to readNot yet

TL;DR

Expectile regression fits a prediction by penalising each error with a squared size, but it charges errors on one side of the prediction a different weight than errors on the other side. Choose a number τ\tau between 0 and 1, and the fitted value settles where the weighted errors balance, with a fraction of the weight pulling each way. At τ=0.5\tau = 0.5 both sides count equally and you get the ordinary average or least-squares line.

The method is a smooth, convex relative of quantile regression: it keeps the squared penalty of least squares and only adds the asymmetry.

Builds on: Conditional Expectation, Empirical Risk Minimization, Linear Regression · Leads to: asymmetric risk measures and the expectile loss used in some reinforcement-learning methods

Where it's used

Econometrics and wage and income modelling. Economists want to know how a spread changes with a predictor, not only the average. Expectile regression fits the upper or lower side of a conditional distribution with a smooth loss, so the coefficients can be found with the same kind of numerical solver used for least squares.

Risk measurement in finance. A bank that must hold capital against large losses cares about the bad tail of a return distribution. Expectiles of the loss distribution give a single number that moves with the tail and, unlike the usual quantile-based measure, respond smoothly to every observation.

Offline reinforcement learning. Implicit Q-learning needs a value close to the best action's value, but only data from actions that were actually taken is available. It uses an asymmetric squared loss, an expectile with τ\tau close to 1 (the paper's figure uses 0.9), so that the learned value leans toward the good outcomes in the data without ever querying the best action directly.

How it works

Take one tiny set of observations, {0,4}\{0, 4\}, and a τ\tau of 0.750.75. We want the number mm that the asymmetric loss prefers.

  1. Pick the weights. An error y−my - m is weighted by τ=0.75\tau = 0.75 when yy is above mm, and by 1−τ=0.251 - \tau = 0.25 when yy is below mm. Check: the two weights add to 1, and the bigger weight goes to the side you should be more afraid of missing.
  2. Try m=2m = 2, the ordinary mean. The point 00 is below 22, so its weight is 0.250.25; its squared error is (0−2)2=4(0 - 2)^2 = 4, giving 0.25×4=1.00.25 \times 4 = 1.0. The point 44 is above, so its weight is 0.750.75; its squared error is (4−2)2=4(4 - 2)^2 = 4, giving 0.75×4=3.00.75 \times 4 = 3.0. Total loss: 4.04.0.
  3. Try m=4m = 4. The point 00 has weight 0.250.25 and squared error 1616, giving 4.04.0. The point 44 has zero error. Total loss: 4.04.0. Both extremes are worse than the midpoint.
  4. Try m=3m = 3. The point 00 gives 0.25×9=2.250.25 \times 9 = 2.25. The point 44 gives 0.75×1=0.750.75 \times 1 = 0.75. Total loss: 3.03.0, the smallest of the three.
  5. Read off the answer. The loss is lowest at m=3m = 3. This is the 0.750.75-expectile of {0,4}\{0, 4\}. It is above the mean 22, because the loss tilts the answer toward the side with the larger weight.

The math

The asymmetric loss

Write u=y−mu = y - m for an error. The asymmetric squared loss is

ρτ(u)=wτ(u) u2,wτ(u)={τu≥01−τu<0\rho_\tau(u) = w_\tau(u)\, u^2, \qquad w_\tau(u) = \begin{cases} \tau & u \ge 0 \\ 1 - \tau & u \lt 0 \end{cases}

Here wτ(u)w_\tau(u) is the weight, which depends only on the sign of the error. Positive errors (the observation is above the prediction) cost τ\tau per unit of squared size; negative errors cost 1−τ1 - \tau.

Definition: Expectile

For a random variable YY and a number τ\tau strictly between 0 and 1, the τ\tau-expectile of YY is the value mm that minimises E[ρτ(Y−m)]\mathbb{E}[\rho_\tau(Y - m)].

Step 2 in symbols: the balance condition

Set the derivative of the expected loss in mm to zero. Each term contributes −2 wτ(Y−m)(Y−m)-2\,w_\tau(Y - m)(Y - m), so the first-order condition is

τ E[(Y−m)+]=(1−τ) E[(m−Y)+],\tau\, \mathbb{E}\big[(Y - m)_+\big] = (1 - \tau)\, \mathbb{E}\big[(m - Y)_+\big],

where (z)+=max⁡(z,0)(z)_+ = \max(z, 0) keeps only the positive part. In words: the weighted size of the observations above mm must equal the weighted size of the observations below mm.

For a sample y1,…,yny_1, \dots, y_n the same condition reads

∑yi≥mτ (yi−m)=∑yi<m(1−τ) (m−yi).\sum_{y_i \ge m} \tau\,(y_i - m) = \sum_{y_i \lt m} (1 - \tau)\,(m - y_i).

Check with τ=0.5\tau = 0.5 and the sample {1,2,3,10}\{1, 2, 3, 10\}. Try m=4m = 4. The left side is 0.5×(10−4)=30.5 \times (10 - 4) = 3. The right side is 0.5×[(4−1)+(4−2)+(4−3)]=0.5×6=30.5 \times [(4 - 1) + (4 - 2) + (4 - 3)] = 0.5 \times 6 = 3. The two sides match, so m=4m = 4 is the mean. Setting τ=0.5\tau = 0.5 makes the condition symmetric, and the balance point is the average.

Step 3 in symbols: the regression version

For a linear model f(x)=x⊤βf(x) = x^\top \beta fitted to pairs (xi,yi)(x_i, y_i), minimise

β^=arg⁡min⁡β∑iρτ(yi−xi⊤β).\hat\beta = \arg\min_\beta \sum_{i} \rho_\tau\big(y_i - x_i^\top \beta\big).

Write the residual ri=yi−xi⊤βr_i = y_i - x_i^\top \beta and the weight wi=wτ(ri)w_i = w_\tau(r_i). The gradient is −2∑iwi ri xi-2 \sum_i w_i\, r_i\, x_i. Set it to zero and freeze the weights for a moment: the equation becomes the normal equations of weighted least squares, X⊤WXβ=X⊤WyX^\top W X \beta = X^\top W y, with WW the diagonal matrix of the wiw_i. Because the weights depend on the residuals, the solver alternates: recompute the weights from the current residuals, solve the weighted problem, and repeat. Every step is an ordinary least-squares solve, so the method is as easy to implement as Linear Regression, with the extra step of updating the weights.

−3−2−1012302468error u = y - mloss
  • tau = 0.5
  • tau = 0.75
Errors above the prediction (u > 0) cost three times as much as the same errors below it, so the minimiser moves up.

Worked examples

Example
1. Two points, hand-computable

The data are {0,4}\{0, 4\} and τ=0.75\tau = 0.75.

  1. The balance condition is 0.75∑yi≥m(yi−m)=0.25∑yi<m(m−yi)0.75 \sum_{y_i \ge m}(y_i - m) = 0.25 \sum_{y_i \lt m}(m - y_i).
  2. Assume mm lies between 0 and 4. Only 44 is above mm, and only 00 is below it.
  3. The left side is 0.75×(4−m)=3−0.75m0.75 \times (4 - m) = 3 - 0.75m.
  4. The right side is 0.25×(m−0)=0.25m0.25 \times (m - 0) = 0.25m.
  5. Set them equal: 3−0.75m=0.25m3 - 0.75m = 0.25m, so 3=m3 = m.
  6. Check that m=3m = 3 lies between 0 and 4. It does. Check the balance: 0.75×1=0.750.75 \times 1 = 0.75 and 0.25×3=0.750.25 \times 3 = 0.75.

Interpretation: the 0.750.75-expectile is 33, which is above the mean 22. Only one of the two points is below 33, so the expectile sits closer to the larger value than the mean does.

Example
2. Standard case: the same set at two values of tau

The data are {1,2,3,10}\{1, 2, 3, 10\}. Compare τ=0.5\tau = 0.5 with τ=0.75\tau = 0.75.

  1. For τ=0.5\tau = 0.5 we already found m=4m = 4 above, the mean of the data.
  2. For τ=0.75\tau = 0.75, try mm between 3 and 10. Only 1010 is above mm, and 1,2,31, 2, 3 are below it.
  3. The left side is 0.75×(10−m)=7.5−0.75m0.75 \times (10 - m) = 7.5 - 0.75m.
  4. The right side is 0.25×[(m−1)+(m−2)+(m−3)]=0.25×(3m−6)=0.75m−1.50.25 \times [(m - 1) + (m - 2) + (m - 3)] = 0.25 \times (3m - 6) = 0.75m - 1.5.
  5. Set them equal: 7.5−0.75m=0.75m−1.57.5 - 0.75m = 0.75m - 1.5, so 9=1.5m9 = 1.5m and m=6m = 6.
  6. Check that 66 lies between 3 and 10. It does. Check the balance: 0.75×4=30.75 \times 4 = 3 and 0.25×12=30.25 \times 12 = 3.

Interpretation: raising τ\tau from 0.50.5 to 0.750.75 moves the balance point from the mean 44 to 66. The one large value at 1010 now pulls harder than the three small values push back.

Example
3. Realistic: waiting times at two counters

A bank records how long customers wait, in minutes, at two counters. Counter A has waits {2,3,5}\{2, 3, 5\}; counter B has waits {4,8}\{4, 8\}. A manager wants the 0.80.8-expectile for each counter, which leans toward long waits without needing the full distribution.

Counter A:

  1. Assume mm lies between 3 and 5. Only 55 is above mm; 22 and 33 are below.
  2. The left side is 0.8×(5−m)=4−0.8m0.8 \times (5 - m) = 4 - 0.8m.
  3. The right side is 0.2×[(m−2)+(m−3)]=0.2×(2m−5)=0.4m−10.2 \times [(m - 2) + (m - 3)] = 0.2 \times (2m - 5) = 0.4m - 1.
  4. Set them equal: 4−0.8m=0.4m−14 - 0.8m = 0.4m - 1, so 5=1.2m5 = 1.2m and m=25/6≈4.17m = 25/6 \approx 4.17.
  5. Check that 4.174.17 lies between 3 and 5, and that the balance holds: 0.8×0.833=0.6670.8 \times 0.833 = 0.667 and 0.2×3.333=0.6670.2 \times 3.333 = 0.667.

Counter B:

  1. Assume mm lies between 4 and 8. Only 88 is above mm; 44 is below.
  2. The left side is 0.8×(8−m)=6.4−0.8m0.8 \times (8 - m) = 6.4 - 0.8m.
  3. The right side is 0.2×(m−4)=0.2m−0.80.2 \times (m - 4) = 0.2m - 0.8.
  4. Set them equal: 6.4−0.8m=0.2m−0.86.4 - 0.8m = 0.2m - 0.8, so 7.2=m7.2 = m.
  5. Check the balance: 0.8×0.8=0.640.8 \times 0.8 = 0.64 and 0.2×3.2=0.640.2 \times 3.2 = 0.64.

Interpretation: counter A has a mean of 10/3≈3.3310/3 \approx 3.33 minutes and an 0.80.8-expectile of about 4.174.17. Counter B has a mean of 66 and an 0.80.8-expectile of 7.27.2. The expectile places the typical high wait well above the average, and counter B's long wait makes its expectile move further up than counter A's does.

Try it: counter C has waits {1,5,9}\{1, 5, 9\}. Find its 0.80.8-expectile, assuming mm lies between 5 and 9, and check the balance. Answer: m=7m = 7. Only 99 is above 77; the left side is 0.8×2=1.60.8 \times 2 = 1.6, and the right side is 0.2×[(7−1)+(7−5)]=0.2×8=1.60.2 \times [(7 - 1) + (7 - 5)] = 0.2 \times 8 = 1.6. The mean of counter C is 5, so the expectile is 2 minutes higher.

Common mistakes and tradeoffs

"An expectile is a quantile." It is tempting to think that τ=0.75\tau = 0.75 means three quarters of the data fall below the fitted value. In fact that is only true for quantiles. For {0,4}\{0, 4\} at τ=0.75\tau = 0.75 the expectile is 33, but half the data (the point 00) lies below it. Quantiles minimise a loss that grows linearly with the error; expectiles minimise a loss that grows with the square of the error. At τ=0.5\tau = 0.5 the two families also disagree: for {1,2,3,10}\{1, 2, 3, 10\} the median is 2.52.5 but the expectile is the mean, 44.

"A larger tau means a more accurate model." The parameter τ\tau does not measure accuracy. It sets how much you dislike underprediction compared with overprediction. A large τ\tau is the right choice when missing on the low side is expensive, and the wrong choice when both sides cost the same.

"Expectiles are robust to outliers because they are asymmetric." The squared loss still lets one extreme value pull the fitted value a long way, just as it does for the mean. If you need protection against outliers, quantile regression with the absolute-error loss is the safer choice.

When to use it. Use expectile regression when you want a smooth, convex loss that is easy to optimise with the same tools as least squares, and when a balance-of-squared-errors interpretation fits the problem. It is also the natural choice when you need several expectiles that vary continuously with τ\tau.

When not to use it. Do not use it when the decision depends on an exact fraction of outcomes falling below a threshold, such as a service level or a regulatory quantile. Use quantile regression there. Do not use it for heavy-tailed data without thinking about the squared penalty, which can make the fit depend on a few points.

History

Least squares was the default for fitting trends long before anyone asked about asymmetry. Economists in the late 1980s began to use asymmetric squared losses to study how conditional spreads move with covariates, and the method was formalised in econometrics as asymmetric least squares by Newey and Powell. The name "expectile" comes from the analogy with quantiles: the expectile is the value determined by a balance of weighted squared errors, as the quantile is determined by a balance of weighted absolute errors.

The method caught on because it turned a non-smooth problem into a smooth one. Quantile regression is solved by linear programming; expectile regression can be solved by repeated least-squares steps, which made it easy to adopt. Later it reappeared in finance as a risk measure and in machine learning as a loss for learning high-value estimates from offline data.

Recap

  • An expectile is the balance point of squared errors, where errors above the value cost τ\tau and errors below cost 1−τ1 - \tau.
  • The balance condition τE[(Y−m)+]=(1−τ)E[(m−Y)+]\tau \mathbb{E}[(Y - m)_+] = (1 - \tau)\mathbb{E}[(m - Y)_+] holds at the expectile; τ=0.5\tau = 0.5 gives the mean.
  • In regression the weights depend on the residuals, so the solver alternates between weighting and weighted least squares.
  • Expectiles differ from quantiles: the loss is squared rather than absolute, so the expectile is not a fraction of the data.
  • Read next: quantile regression for the absolute-loss counterpart, and implicit Q-learning for the expectile loss in practice.

Check yourself

QuestionRecall: what expectile does tau = 0.5 give, and why?Show answer

The mean. With τ=0.5\tau = 0.5 the weights on positive and negative errors are equal, so the balance condition 0.5 E[(Y−m)+]=0.5 E[(m−Y)+]0.5\,\mathbb{E}[(Y - m)_+] = 0.5\,\mathbb{E}[(m - Y)_+] reduces to the zero-mean condition E[Y−m]=0\mathbb{E}[Y - m] = 0, whose solution is m=E[Y]m = \mathbb{E}[Y].

QuestionCompute: the data are {0,6}\{0, 6\} and tau = 0.75. Find the 0.75-expectile.Show answer

Assume mm lies between 0 and 6. The balance is 0.75(6−m)=0.25m0.75(6 - m) = 0.25 m, so 4.5−0.75m=0.25m4.5 - 0.75m = 0.25m and m=4.5m = 4.5. The check passes: 0.75×1.5=1.1250.75 \times 1.5 = 1.125 and 0.25×4.5=1.1250.25 \times 4.5 = 1.125. The answer is 4.54.5, which is above the mean 33.

QuestionWhy: why does the weight in the loss depend on the sign of the error, and not on its size?Show answer

The loss is designed to penalise one side of the prediction more than the other, not to penalise large errors more than small ones. The sign tells you which side the observation is on, so the weight τ\tau or 1−τ1 - \tau is chosen by the side. The size still enters through the squared term, which keeps the loss smooth and convex.

QuestionApplied: a model that forecasts electricity demand tends to underpredict on peak days, and underpredicting causes blackouts. Should you choose tau above or below 0.5, and why?Show answer

Above 0.5. A larger τ\tau puts more weight on errors where the observation is above the prediction, which is exactly underprediction. The fitted value is pulled up, so the model errs on the side of over-supplying. The choice of τ\tau should follow the relative cost of the two kinds of mistake.

Sources