I believe that the values I am forecasting are gamma distributed with shape $k>0$ and scale $\theta>0$. I need a point forecast (i.e., a one-number summary) that minimizes the expected error. What point forecast does so, if my error measure is

  1. the (mean) squared error (MSE)?
  2. the (mean) absolute error (MAE)?
  3. the (mean) absolute scaled error (MASE)?
  4. the loss $\Big|\ln\big(\frac{y}{\hat{y}}\big)\Big|$ proposed here?
  5. the (mean) absolute percentage error (MAPE)?

I am asking and self-answering to have a reference for the future, since I often use this as an example to illustrate the properties of different error measures, e.g., at What are the shortcomings of the Mean Absolute Percentage Error (MAPE)? The analogous question for the lognormal distribution can be found here.


2 Answers 2

  1. It is a standard result from introductory statistics that the expectation of a distribution is the one number summary that will minimize the expected squared error. The expectation of the gamma distribution with shape $k>0$ and scale $\theta>0$ is $k\theta$.

  2. It is almost as well known that the median of a distribution is the one number summary that will minimize the expected absolute error (Hanley et al., 2001, The American Statistician).

    The median of the gamma distribution has no closed form, but approximations exist. For instance, Berg & Pedersen (2006, Methods and Applications of Analysis) give an asymptotic expression for real-valued $k\to\infty$ and $\theta=1$, which works very well for any $k\geq 1$ and which one can multiply by $\theta$ to obtain the general case.

  3. Since the MASE is simply a scaled MAE, the point forecast that minimizes the expected MAE will also minimize the expected MASE.

  4. It turns out that the loss $\Big|\ln\big(\frac{y}{\hat{y}}\big)\Big|$ is also minimized in expectation by the median of the distribution (Kuketayev, 2015, "Optimal Point Forecasts for Certain Bank Deposit Series" in the 21st Federal Forecasters Conference: Are Forecasts Accurate? Does it Matter?), so the point forecast that minimizes the expected MAE will also minimize this loss function in expectation.

  5. The MAPE is a bit more tricky. Let us consider the case that $k>1$. Per Gneiting (2011, JASA, p. 748 with $\beta=-1$), the point forecast minimizing the expected MAPE for a density $f$ is the median of a distribution with density proportional to $\frac{1}{y}f(y)$. Now, the gamma distribution with shape $k>0$ and scale $\theta>0$ has density

    $$ f_{k,\theta}(y) = \frac{1}{\Gamma(k)\theta^k}y^{k-1}\exp\Big(-\frac{y}{\theta}\Big). $$

    Noting that

    $$ \frac{\Gamma(k-1)}{\Gamma(k)} = \frac{1}{k-1}, $$

    some calculation yields that

    $$ \frac{1}{y}f_{k,\theta}(y) = \frac{1}{\Gamma(k)\theta^k}y^{k-2}\exp\Big(-\frac{y}{\theta}\Big)\stackrel{!}{=} \frac{1}{(k-1)\theta}f_{k-1,\theta}(y)\propto f_{k-1,\theta}(y). $$

    Thus, the density whose median minimizes the expected MAPE is itself another gamma, with shape $k-1$ and scale $\theta$.

    • If $k\geq 2$, we can approximate its median using Berg & Pedersen (2006) as above.

    • If $1<k<2$, I have not yet found a useful approximation for this median, although it seems to be positive. I have asked about this here. Of course, one can always approximate it numerically, as R's qgamma() function does.

    • If $0<k\leq 1$, the gamma distribution is well-defined, but the fractional moment of order $-1$ does not seem to exist. It seems like the expected MAPE is then minimized by a straight zero point forecast. To be honest, I don't have the inclination to prove this right now, but it does not look too hard.


The answer are the same for any distribution. See my explanation here for lognormal distribution. My equations do not use the specific expression for lognormal so they are as applicable to Gamma or any other distribution.

  • $\begingroup$ Hm. Thank you. Yes, of course the functionals are the same for all distributions, I write as much in my answer here. What I was asking for was the specific closed form of these functionals for this distribution - and I gave them in my answer. Yes, these numbers are quite well known, but I was trying to collect them in one place in the context of optimal point forecasts, and in particular the MAPE is not quite as well known. ... $\endgroup$ Jun 6, 2020 at 6:28
  • $\begingroup$ ... Finally, in the light of this discussion, I was hoping for an answer for the loss function $|\log(y/\hat{y})|$. Is there a closed form for the optimal point forecast under this loss that you could edit into your answer? $\endgroup$ Jun 6, 2020 at 6:28
  • $\begingroup$ I read the Kuketayev paper, and it turns out that the additional loss function is actually the same as MAE and MASE. I included this in my answer here. Thanks once more! $\endgroup$ Jun 6, 2020 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.