# Prediction Interval for $E(y|X_0)$ when model is in $ln(y)$

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.

• This should have been posted on Cross Validated because there is nothing economics-specific to it, it is a purely statistical question. – Richard Hardy May 30 '17 at 16:49
• @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. May 30 '17 at 17:06
• 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 May 30 '17 at 17:24
• @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. May 30 '17 at 17:28
• I suppose the other one would have fit Cross Validated better than Economics Stack Exchange as well. But since you got and accepted answers to both of them, it is probably too late to move them. – Richard Hardy May 30 '17 at 17:44

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.

• 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 May 28 '17 at 10:55

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.

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

• 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. May 24 '17 at 18:00
• @Anoldmaninthesea. I added the clarification on the matter. – Alecos Papadopoulos May 24 '17 at 18:06
• 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. May 25 '17 at 10:05
• 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. May 28 '17 at 9:28