Re: [R] Confidence intervals of log transformed data

From: Tobias Verbeke <tobias.verbeke_at_telenet.be>
Date: Wed, 16 Apr 2008 20:00:10 +0200

Rubén Roa-Ureta wrote:
> 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.

For the record, I'm working on a package to deal with these problems at

http://r-forge.r-project.org/projects/lognorm/

I uploaded a very first function lnormCI to the svn repository a few minutes ago;
Be cautious, though: it is pre-alpha and I know there is a problem with at least one of the methods implemented (haven't worked on it since 5 months or so).

Regards,
Tobias



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 16 Apr 2008 - 18:02:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Apr 2008 - 18:30:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive