[R] Confidence intervals of log transformed data
Rubén Roa-Ureta
rroa at udec.cl
Wed Apr 16 19:04:51 CEST 2008
tom soyer wrote:
> Hi
>
> I have a general statistics question on calculating confidence interval of
> log transformed data.
>
> I log transformed both x and y, regressed the transformed y on transformed
> x: lm(log(y)~log(x)), and I get the following relationship:
>
> log(y) = alpha + beta * log(x) with se as the standard error of residuals
>
> My question is how do I calculate the confidence interval in the original
> scale of x and y? Should I use
[...]
Confidence interval for the mean of Y? If that is the case, when you
transformed Y to logY and run a regression assuming normal deviates you
were in fact assuming that Y distributes lognormally. Your interval must
be assymetric, reflecting the shape of the lognormal. The lognormal
mean is lambda=exp(mu + 0.5*sigma^2), where mu and sigma^2 are the
parameters of the normal variate logY. A confidence interval for lambda is
Lower Bound=exp(mean(logY)+0.5*var(logY)+sd(logY)*H_alpha/sqrt(n-1))
Upper Bound=exp(mean(logY)+0.5*var(logY)+sd(logY)*H_(1-alpha)/sqrt(n-1))
where the quantiles H_alpha and H_(1-alpha) are quantiles of the
distribution of linear combinations of the normal mean and variance
(Land, 1971, Ann. Math. Stat. 42:1187-1205, and Land, 1975, Sel. Tables
Math. Stat. 3:385-419).
Alternatively, you can model directly
Y=p1*X^p2, p1=exp(your alpha), p1=beta
with a lognormal likelihood and predict the mean of Y with the fitted
model (I'm guessing here).
It could be useful to check Crow and Shimizu, Lognormal distributions.
Theory and practice, 1988, Dekker, NY.
HTH
Rubén
More information about the R-help
mailing list