# What is the best point forecast for lognormally distributed data?

I believe that the values I am forecasting are lognormally distributed with log-mean $$\mu$$ and log-variance $$\sigma^2$$. 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 gamma distribution can be found here.

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 lognormal distribution with log-mean $$\mu$$ and log-variance $$\sigma^2$$ is $$\exp\big(\mu+\frac{\sigma^2}{2}\big)$$.

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 lognormal distribution with log-mean $$\mu$$ and log-variance $$\sigma^2$$ is $$\exp(\mu)$$.

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. 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 lognormal distribution with log-mean $$\mu$$ and log-variance $$\sigma^2$$ is $$\exp(\mu)$$ has density

$$f(y) = \frac{1}{y\sigma\sqrt{2\pi}}\exp\bigg(-\frac{(\ln y-\mu)^2}{2\sigma^2}\bigg).$$

Therefore the density we are interested in is

$$\frac{1}{y}f(y) = \frac{1}{y^2\sigma\sqrt{2\pi}}\exp\bigg(-\frac{(\ln y-\mu)^2}{2\sigma^2}\bigg)\propto\frac{1}{y^2}\exp\bigg(-\frac{(\ln y-\mu)^2}{2\sigma^2}\bigg).$$

(Since we are only interested in the distribution up to a proportionality factor, we can disregard the constant multiplier.)

Now, set

$$m := \exp(\mu-\sigma^2).$$

We claim that $$m$$ is the median of $$\frac{1}{y}f(y)$$, i.e., the point forecast minimizing the expected MAPE, which we were looking for. (Coincidentally, $$m$$ is also the mode of the original lognormal distribution. This relationship does not hold for other strictly positive distributions, e.g., the gamma.)

To prove that $$m$$ is the median we are looking for, we note that

$$\int_a^b \frac{1}{y^2}\exp\bigg(-\frac{(\ln y-\mu)^2}{2\sigma^2}\bigg)\,dy = \sqrt{\frac{\pi}{2}}\sigma\exp\Big(\frac{\sigma^2}{2-\mu}\Big)\text{erf}\bigg(\frac{-\mu+\sigma^2+\ln y}{\sqrt{2}\sigma}\bigg)\bigg|_{y=a}^b,$$

where $$\text{erf}$$ denotes the error function, which has the following properties:

$$\lim_{x\to-\infty}\text{erf}(x)=-1, \quad\text{erf}(0)=0, \quad \lim_{x\to\infty}\text{erf}(x)=1.$$

Substituting the limits into the integral, we obtain that

$$\int_0^m\frac{1}{y^2}\exp\bigg(-\frac{(\ln y-\mu)^2}{2\sigma^2}\bigg)\,dy=\int_m^\infty\frac{1}{y^2}\exp\bigg(-\frac{(\ln y-\mu)^2}{2\sigma^2}\bigg)\,dy.$$

Since the proportionality factors do not involve $$m$$, this yields that

$$\int_0^m \frac{1}{y}f(y)\,dy = \int_m^\infty \frac{1}{y}f(y)\,dy$$

as required.

My answers are for a distribution with known parameters. It's not specific to lognormal, but obviously applies to it too. The integrals use the lower limit of integration 0, but you can change them to $$-\infty$$ then they'll work for any distribution with finite mean, not only the ones with positive domain such as lognormal.

The optimal point forecast is $$\hat x$$, the PDF and CDF are $$f(x),F(x)$$, loss function is $$C(x,\hat x)$$.

1. MSE, the optimal forecast is mean $$\hat x = E[x]$$. $$C(x,\hat x)=(x-\hat x)^2$$ First order condition (FOC) for minimum expected cost: $$\frac \partial {\partial \hat x}E[C(x,\hat x)]=E[-2(x-\hat x)]=0$$ $$\hat x=E[x]=\mu$$

2,3. MAE & MASE, the optimal forecast is median $$F(\hat x)=1/2$$. $$C(x,\hat x)=|x-\hat x|$$ First order condition (FOC) for minimum expected cost: $$\frac \partial {\partial \hat x}E[C(x,\hat x)]= \frac \partial {\partial \hat x}\left(\int_0^{\hat x}(\hat x-x)dF(x) +\int_{\hat x}^{\infty}( x-\hat x)dF(x)\right)\\ =F(\hat x)-(1-F(\hat x))=0$$ $$F(\hat x)=\frac 1 2$$

So, $$\hat x$$ is the median.

1. MAPE, the optimal forecast is median $$F(\hat x)=1/2$$.

$$C(x,\hat x)=|1-\frac{\hat x} x |$$ First order condition (FOC) for minimum expected cost: $$\frac \partial {\partial \hat x}E[C(x,\hat x)]= \frac \partial {\partial \hat x}\left(\int_0^{\hat x}(\frac{\hat x-x} x)dF(x) +\int_{\hat x}^{\infty}( \frac{x-\hat x} x)dF(x)\right)\\ =\frac 1 {\hat x}(F(\hat x)-(1-F(\hat x)))=0$$ $$F(\hat x)=\frac 1 2$$

So, $$\hat x$$ is the median.

# Finite mean

It is important to note that distributions with undefined mean such as Cauchy will not have a good answer for MSE. This is a very serious problem in business forecasting for it is not obvious that every real life distribution has a mean. It can be argued that some distributions can have a very fat tail, so fat that in fact the mean is undefined. In these cases there is no optimal point forecast with MSE.

• 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. I am sorry to say that your answer for the MAPE is wrong. ... – Stephan Kolassa Jun 6 at 6:27
• ... 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 (and perhaps update and/or remove the parts about the other losses - right now, I don't see how they add anything beyond my existing answer)? – Stephan Kolassa Jun 6 at 6:27
• 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! – Stephan Kolassa Jun 6 at 7:35