<p>I got hold of this <a href="https://ww2.amstat.org/publications/jse/v13n1/olsson.html" rel="nofollow noreferrer">link from Journal of Statistics Education</a></p>

<p>Using the notation in it, let $X\sim \log N(\mu,\sigma^2)$, i.e. $Y=\log(X) \sim N(\mu,\sigma^2)$.</p>

<p>Hence, $E(X)=E(e^Y)=e^{\mu+\sigma^2/2}$. An estimator for $\log(E(X))$ is $$\bar Y+\frac{S_Y^2}{2}$$. Also, $Var(\hat\log(E(X)))=\frac{\sigma^2}{n}+\frac{\sigma^4}{2(n-1)}$, which gives $$\hat Var(\hat\log(E(X)))=\frac{S_Y^2}{n}+\frac{S_Y^4}{2(n-1)}$$.</p>

<p>For large samples, using the CLT, we have $$\frac{\hat \log E(X)-\log E(X)}{\sqrt{\hat Var(\hat\log(E(X)))}}\sim^a N(0,1)$$</p>

<p>Thus, one possible CI from this perspective is $$CI(E(X))=\left]e^{\bar Y+\frac{S_Y^2}{2}\pm z_{1-\alpha}\sqrt{\frac{S_Y^2}{n}+\frac{S_Y^4}{2(n-1)}}}\right[$$.
According to the link, this is the Cox method, while the modified Cox method substitutes the standard normal quantile for a $t(n)$ quantile. They simulate more than just the these two intervals. They also simulate the naive approach.</p>

<p>If we look at table 5  of the link, we can see that the best method is the modified Cox, since for small samples, and large ones, the covering probability is the most close to the nominal level.</p>

<p>Alecos answer, if I understood correctly, suggests adding a correction term to the naive approach, resulting in $CI(E(X))=\left]e^{\bar Y+\frac{1}{2}\frac{S_X^2}{(\bar X)^2}\pm t_{1-\alpha}\sqrt{\frac{S_Y^2}{n}}}\right[$.</p>

<p>I've simulated his answer with the following code in Mathematica:</p>

<pre><code>sim[n_] := Module[{},
  ct = 1;
  res = 0;
  While[ct &lt;= 10000,
   data = RandomVariate[LogNormalDistribution[5, 1], n];
   y = Log[data];
   my = Mean[y];
   s2y = Variance[y];
   mx = Mean[data];
   s2x = Variance[data];
   qt = Quantile[StudentTDistribution[n], 0.975];
   If[E^(my + 0.5*s2x/mx^2 - qt*Sqrt[s2y/n]) &lt; E^(5 + 0.5) &lt; 
     E^(my + 0.5*s2x/mx^2 + qt*Sqrt[s2y/n]),
    res++];
   ct++;
   ];
  res = res/10000.
  ]
</code></pre>

<p>The only difference is that I've done 10000 replications whereas the link only does 1000. </p>

<p>Running the code for the same sample sizes of the link, we obtain the following covering probabilities: $${0.8954, 0.8464, 0.7682, 0.7153, 0.6454, 0.4832, 0.3045, 0.073, 0.0068}$$.</p>

<p>AS we can see the correction increases the covering probabilities when compared to the naive method, but it still suffers from the same problem, i.e., the prob. tend to zero as the sample size increases.</p>

<p>All in all, the best course of action is to use the modified Cox approach.</p>

CC BY-SA 3.0
2017-05-28T10:55:37.190Z
I understand that this approach improves things specifically for the log-normal distribution. My answer provides an across-the-board correction term, and so it is not surprising that it gives inferior results.
Alecos Papadopoulos
CC BY-SA 3.0
2017-05-28T09:27:14.977Z
2017-05-28T09:27:14.977Z
An old man in the sea.
<p>Due to Jensen's inequality, we have</p>

<p>$$E(\ln y) \leq \ln E(y) \implies \exp\{E(\ln y)\} \leq E(y)$$</p>

<p>So if one uses $\exp\{E(\ln y)\}$ to construct a confidence interval for $E(y)$, it will be shifted to the left, and it will be of smaller length than it should.  </p>

<p>Applying a 2nd-order Taylor expansion of $E(\ln y)$ around $E(y)$ we have</p>

<p>$$E(\ln y) \approx E\left[ \ln E(y) + \frac{y-E(y)}{E(y)}-\frac 12 \frac {[y-E(y)]^2}{[E(y)]^2}\right]$$</p>

<p>$$\implies E(\ln y) \approx \ln E(y) -\frac 12 \frac {\sigma_y^2}{\mu_y^2} $$</p>

<p>$$\implies \ln E(y) \approx E(\ln y) +\frac 12 \frac {\sigma_y^2}{\mu_y^2} $$</p>

<p>the correction being one half the squared <a href="https://en.wikipedia.org/wiki/Coefficient_of_variation" rel="nofollow noreferrer">coefficient of variation</a>.</p>

<p>One can then estimate the correction term by obtaining say Method of Moments  estimators (sample moments) for the variance and the mean of $y$.</p>

CC BY-SA 3.0
2017-05-24T18:00:32.183Z
Alecos, thanks for you answer. I still have some doubts though. Why is the CI only shifted and not compressed nor distended?
An old man in the sea.
CC BY-SA 3.0
2017-05-24T18:06:58.323Z
@Anoldmaninthesea. I added the clarification on the matter.
Alecos Papadopoulos
CC BY-SA 3.0
2017-05-25T10:05:41.977Z
I'll read your answer during this weekend. Thanks. I'll probably also look at the lognormal distribution to try to find an exact CI. ;)
An old man in the sea.
CC BY-SA 3.0
2017-05-28T09:28:33.910Z
Alecos, I've read your answer, and wrote another one with an evaluation of yours. Could you please give me some feedback? I would appreciate it a lot. ;)
An old man in the sea.
CC BY-SA 3.0
2017-05-24T17:52:14.683Z
2017-05-24T18:06:21.893Z
2017-05-24T18:06:21.893Z
Alecos Papadopoulos
<p>Let's suppose we have linear regression with dependent variable $ln(y)$. How would one find a prediction interval for  $E(y|X_0)$ ?</p>

<p>If we have $PI(E(ln(y)|X_0))$, is there a way to reach $PI(E(y|X_0))$?</p>

<p>Any help would be appreciated.</p>

CC BY-SA 3.0
2017-05-30T16:49:14.733Z
This should have been posted on Cross Validated because there is nothing economics-specific to it, it is a purely statistical question.
Richard Hardy
CC BY-SA 3.0
2017-05-30T17:06:39.453Z
@RichardHardy I disagree. Many Linear models are written with ln(y) because we're interested in elasticities, and we're also interested in finding CI or PI for the y, not the ln(y)...
An old man in the sea.
CC BY-SA 3.0
2017-05-30T17:24:55.093Z
Alright, in that sense it is related to economics. But still it is a perfectly statistical question, to the extent that I am surprised to see it on any other Stack Exchange site than Cross Validated. Not that I have particular interest in one site or another (I keep track of both of them), but I think some more consistency would be nice.
Richard Hardy
CC BY-SA 3.0
2017-05-30T17:28:23.313Z
@RichardHardy If you know how, you can suggest to move this question. I'll just fail to see the importance of a CI or PI for a y when the model is in ln(y), in a statistical setting.  But for me either way is fine. Also, this question is linked to previous one of mine. They are quite related.
An old man in the sea.
<econometrics><prediction>
Prediction Interval for $E(y|X_0)$ when model is in $ln(y)$
An old man in the sea.
# Prediction Interval for $E(y|X_0)$ when model is in $ln(y)$

(Asked by: username_0 on 2017-05-24)

Let's suppose we have linear regression with dependent variable $ln(y)$. How would one find a prediction interval for $E(y|X\_0)$ ?

If we have $PI(E(ln(y)|X\_0))$, is there a way to reach $PI(E(y|X\_0))$?

Any help would be appreciated.

**Tags:** econometrics, prediction
> **Comments:**
> **username_1**: This should have been posted on Cross Validated because there is nothing economics-specific to it, it is a purely statistical question.  
> **username_0**: @RichardHardy I disagree. Many Linear models are written with ln(y) because we're interested in elasticities, and we're also interested in finding CI or PI for the y, not the ln(y)...  
> **username_1**: Alright, in that sense it is related to economics. But still it is a perfectly statistical question, to the extent that I am surprised to see it on any other Stack Exchange site than Cross Validated. Not that I have particular interest in one site or another (I keep track of both of them), but I think some more consistency would be nice.  
> **username_0**: @RichardHardy If you know how, you can suggest to move this question. I'll just fail to see the importance of a CI or PI for a y when the model is in ln(y), in a statistical setting.  But for me either way is fine. Also, this question is linked to previous one of mine. They are quite related.  

---

## 2 answers

### Answer by username_0 on 2017-05-28. Score: 2 | Accepted answer

I got hold of this link from Journal of Statistics Education
Using the notation in it, let $X\sim \log N(\mu,\sigma^2)$, i.e. $Y=\log(X) \sim N(\mu,\sigma^2)$.
Hence, $E(X)=E(e^Y)=e^{\mu+\sigma^2/2}$. An estimator for $\log(E(X))$ is $$\bar Y+\frac{S_Y^2}{2}$$. Also, $Var(\hat\log(E(X)))=\frac{\sigma^2}{n}+\frac{\sigma^4}{2(n-1)}$, which gives $$\hat Var(\hat\log(E(X)))=\frac{S_Y^2}{n}+\frac{S_Y^4}{2(n-1)}$$.
For large samples, using the CLT, we have $$\frac{\hat \log E(X)-\log E(X)}{\sqrt{\hat Var(\hat\log(E(X)))}}\sim^a N(0,1)$$
Thus, one possible CI from this perspective is $$CI(E(X))=\left]e^{\bar Y+\frac{S_Y^2}{2}\pm z_{1-\alpha}\sqrt{\frac{S_Y^2}{n}+\frac{S_Y^4}{2(n-1)}}}\right[$$.
According to the link, this is the Cox method, while the modified Cox method substitutes the standard normal quantile for a $t(n)$ quantile. They simulate more than just the these two intervals. They also simulate the naive approach.
If we look at table 5  of the link, we can see that the best method is the modified Cox, since for small samples, and large ones, the covering probability is the most close to the nominal level.
Alecos answer, if I understood correctly, suggests adding a correction term to the naive approach, resulting in $CI(E(X))=\left]e^{\bar Y+\frac{1}{2}\frac{S_X^2}{(\bar X)^2}\pm t_{1-\alpha}\sqrt{\frac{S_Y^2}{n}}}\right[$.
I've simulated his answer with the following code in Mathematica:
sim[n_] := Module[{},
  ct = 1;
  res = 0;
  While[ct <= 10000,
   data = RandomVariate[LogNormalDistribution[5, 1], n];
   y = Log[data];
   my = Mean[y];
   s2y = Variance[y];
   mx = Mean[data];
   s2x = Variance[data];
   qt = Quantile[StudentTDistribution[n], 0.975];
   If[E^(my + 0.5*s2x/mx^2 - qt*Sqrt[s2y/n]) < E^(5 + 0.5) < 
     E^(my + 0.5*s2x/mx^2 + qt*Sqrt[s2y/n]),
    res++];
   ct++;
   ];
  res = res/10000.
  ]

The only difference is that I've done 10000 replications whereas the link only does 1000. 
Running the code for the same sample sizes of the link, we obtain the following covering probabilities: $${0.8954, 0.8464, 0.7682, 0.7153, 0.6454, 0.4832, 0.3045, 0.073, 0.0068}$$.
AS we can see the correction increases the covering probabilities when compared to the naive method, but it still suffers from the same problem, i.e., the prob. tend to zero as the sample size increases.
All in all, the best course of action is to use the modified Cox approach.

> **Comments:**
> **username_2**: I understand that this approach improves things specifically for the log-normal distribution. My answer provides an across-the-board correction term, and so it is not surprising that it gives inferior results.  

---

### Answer by username_2 on 2017-05-24. Score: 1

Due to Jensen's inequality, we have

$$E(\ln y) \leq \ln E(y) \implies \exp\{E(\ln y)\} \leq E(y)$$

So if one uses $\exp\{E(\ln y)\}$ to construct a confidence interval for $E(y)$, it will be shifted to the left, and it will be of smaller length than it should.

Applying a 2nd-order Taylor expansion of $E(\ln y)$ around $E(y)$ we have

$$E(\ln y) \approx E\left[ \ln E(y) + \frac{y-E(y)}{E(y)}-\frac 12 \frac {[y-E(y)]^2}{[E(y)]^2}\right]$$

$$\implies E(\ln y) \approx \ln E(y) -\frac 12 \frac {\sigma\_y^2}{\mu\_y^2} $$

$$\implies \ln E(y) \approx E(\ln y) +\frac 12 \frac {\sigma\_y^2}{\mu\_y^2} $$

the correction being one half the squared [coefficient of variation](https://en.wikipedia.org/wiki/Coefficient_of_variation).

One can then estimate the correction term by obtaining say Method of Moments estimators (sample moments) for the variance and the mean of $y$.

> **Comments:**
> **username_0**: Alecos, thanks for you answer. I still have some doubts though. Why is the CI only shifted and not compressed nor distended?  
> **username_2**: @Anoldmaninthesea. I added the clarification on the matter.  
> **username_0**: I'll read your answer during this weekend. Thanks. I'll probably also look at the lognormal distribution to try to find an exact CI. ;)  
> **username_0**: Alecos, I've read your answer, and wrote another one with an evaluation of yours. Could you please give me some feedback? I would appreciate it a lot. ;)  

---

