# Bias correction of logarithmic transformations

I read that there is a bias when we transform a series with a logarithm and then applying the inverse function, but only in forecasts of the mean values.

I don't understand what it means exactly.

The bias in the means arises as a result of applying the inverse transform to a residual series. For example, if the time series are Gaussian white noise $w_{t}$, with mean zero and standard deviation σ, then the distribution of the inverse-transform (the anti-log) of the series is log-normal with mean $e^{σ ^{2}/2}$. This can be verified theoretically, or empirically by simulation as in the code below:

set.seed(1)
sigma <- 1
w <- rnorm(1e+06, sd = sigma)
mean(w)
[1] 4.69e-05

> mean(exp(w))
[1] 1.65
> exp(sigma^2/2)
[1] 1.65


The code above indicates that the mean of the anti-log of the Gaussian white noise and the expected mean from a log-normal distribution are equal. Hence, for a Gaussian white noise residual series, a correction factor of $e^{σ^{2}/2}$ should be applied to the forecasts of means.

In the same section, it says that an adjusted forecast {$x'_{t}$} with an empirical correction factor is:

$$\hat{x}'_{t} = e^{\hat{\log x_{t}}}\sum_{t=1}^{n}\frac{e^z_{t}}{n}$$

where $\hat{\log x_{t}}$ is the predicted series given by the log-regression model.

Does anyone know what this means? As far as I understand, when we apply a logarithm to a series and fit a (linear) model to the resulting values, we are doing the following:

$$\log x_{t} = \alpha t + \beta + z_{t}$$

where $z_{t}$ are the residues. So, I would think that the reverse transformation is given by:

$$x_{t} = e^{\alpha t + \beta} e^{z_{t}}$$

However, what is the forecasting of means and how is it involved in this procedure? I'm guessing it's $\displaystyle \frac{e^z_{t}}{n}$ but I can't see a justification.

UPDATE:

Suppose we use the model described above to predict some values $p_{t}$. Since we used a logarithmic transformation, to revert it, we have to do this for all new $t$:

$$\exp{p_{ŧ}}$$

However, the book says that in order to apply the correction to each new predicted value, we need to do this:

$$p_{\text{t}}^{\text{corrected}} = p_{t} \frac {1}{n}\sum_{t=1}^{n} e^{\hat z_t}$$

Why? I thought that the mean of the forecast is biased but not its individual values.

• Closely related: stats.stackexchange.com/questions/49595/…. Please check your quotation: I don't believe the "correction factor" has been accurately transcribed (and it doesn't agree with your R code either).
– whuber
Commented Sep 10, 2013 at 1:27
• I think the code snippet I added only reflects the change from a residual series with mean 0 to one with mean $exp(sigma^2/2)$ which is the distribution obtained from such transformation. There is an example that uses the correction factor as mean(exp(resid(AP.lm2))) where AP.lm2 is the model. Commented Sep 10, 2013 at 1:48
• The correct mean is $\exp(\sigma^2/2)$, not $\exp(2\sigma^2)$, which appears twice in your quotations.
– whuber
Commented Sep 10, 2013 at 1:49
• Oh, you're absolutely right. It was a typo when I copied the quoted text. I will correct it in a moment. Commented Sep 10, 2013 at 1:55
• I deleted my answer because it seems to be fully covered at @whuber's linked question and answer. Commented Sep 10, 2013 at 2:40

Your variable is defined as $$X_{t} = e^{\alpha t + \beta} e^{z_{t}}$$

Say you have a sample $S_n$ of $n$ observations of past values of the variable and you want to forecast period $n+1$.

Then $$E\Big (X_{n+1}\mid S_n \Big ) = E\Big (e^{\alpha (n+1) + \beta} e^{z_{n+1}}\mid S_n\Big) = E\Big (e^{\alpha (n+1) + \beta}\mid S_n\Big) E\left(e^{z_{n+1}}\right)$$ $$= E\Big (e^{\alpha (n+1) + \beta}\mid S_n\Big)e^{\sigma^2/2}$$

...since $z_t$ is Gaussian white noise.

The "adjusted forecast with an empirical correction factor", uses rather confusing if not incorrect notation, ignores various biases, and approximates the above by $$E\Big (e^{\alpha (n+1) + \beta}\mid S_n\Big) \approx e^{\hat \alpha (n+1) + \hat \beta} = e^{\hat{\log x_{n+1}}}$$ and $$e^{\sigma^2/2} = E\left(e^{z_{n+1}}\right) \approx \frac {1}{n}\sum_{t=1}^{n} e^{\hat z_t}$$

and so $$\widehat E\Big (X_{n+1}\mid S_n \Big )= e^{\hat{\log x_{n+1}}}\frac {1}{n}\sum_{t=1}^{n} e^{\hat z_t}$$

• Brilliant answer. So we are actually getting a mean of the forecast. I think that's not indicated in the "adjusted forecast". Commented Sep 10, 2013 at 3:39
• I have one more question. In the book there is a prediction based on the model described above and it looks like this: AP.pred.ts <- exp(ts(predict(AP.lm2, new.dat), st = 1961, fr = 12)). Well, the correction you described in your answer is used like this: empirical.correction.factor <- mean(exp(resid(AP.lm2))) AP.pred.ts <- AP.pred.ts * empirical.correction.factor The correction factor is an average, right? Why should we multiply this by each prediction value? Commented Sep 11, 2013 at 0:13