Dear R-experts, I have used the EnvStats package and the elnorm function (p. 248). I would like to calculate the exact 95% confidence intervals around the mean, not around the meanlog. Here below my R code, how can I get the exact 95% CIs around the mean ? Many thanks. library(EnvStats) x=rlnorm(100000,0,1) mean(x) elnorm(x,method="mvue",ci=TRUE,ci.type="two-sided",ci.method="exact",conf.level=0.95)
Exact 95% CI around the mean for LogNormal distribution
4 messages · Bert Gunter, Spencer Graves, varin sacha
This is largely a statistics question, so somewhat off topic here (see the posting guide linked below). Ergo the lack of a response yet. Therefore you *might* do better posting on the r-sig-ecology list. And now for a couple of statistics comments, which you are free to ignore of course, and which you may already be well aware of. Assuming the rv X is approximately lognormally distributed means that log(x) is ~ normally distributed which means that a (symmetric) CI for the mean of the log(X) (=: meanlog of X) is also approximately a CI for the median of log(X). Hence the back transform (exp()) of the meanlog CI is an approx CI for the **median** of the lognormal distribution. The median of a lognormal is **not** the same as the mean, but it generally makes more sense, as the mean of a skew distribution like the lognormal has no clear interpretation, while the median (or any quantile) still does. Your mileage may vary, of course. Cheers, Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Mar 16, 2022 at 1:10 PM varin sacha via R-help
<r-help at r-project.org> wrote:
Dear R-experts, I have used the EnvStats package and the elnorm function (p. 248). I would like to calculate the exact 95% confidence intervals around the mean, not around the meanlog. Here below my R code, how can I get the exact 95% CIs around the mean ? Many thanks. library(EnvStats) x=rlnorm(100000,0,1) mean(x) elnorm(x,method="mvue",ci=TRUE,ci.type="two-sided",ci.method="exact",conf.level=0.95)
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
The mean of a log-Cauchy (aka log-Student's t with 1 degree of freedom) is infinite ;-) The median and other quantiles are not affected by transformations, though the mean is. If you really want anything other than a confidence interval about the mean of the logs, assuming a log-normal distribution, I think you need to think very carefully about the problem you are trying to solve, and how that might be impacted by different assumptions about the distribution of the data. And for that, I recommend normal probability plotting, i.e., qqnorm of log(X): If that looks plausibly like a straight line, you are fine with a log-normal assumption. If not, my favorite reference is Titterington, Smith and Makov (1985) Statistical Analysis of Finite Mixture Distributions (Wiley). Hope this helps. Spencer Graves
On 3/16/22 5:44 PM, Bert Gunter wrote:
This is largely a statistics question, so somewhat off topic here (see the posting guide linked below). Ergo the lack of a response yet. Therefore you *might* do better posting on the r-sig-ecology list. And now for a couple of statistics comments, which you are free to ignore of course, and which you may already be well aware of. Assuming the rv X is approximately lognormally distributed means that log(x) is ~ normally distributed which means that a (symmetric) CI for the mean of the log(X) (=: meanlog of X) is also approximately a CI for the median of log(X). Hence the back transform (exp()) of the meanlog CI is an approx CI for the **median** of the lognormal distribution. The median of a lognormal is **not** the same as the mean, but it generally makes more sense, as the mean of a skew distribution like the lognormal has no clear interpretation, while the median (or any quantile) still does. Your mileage may vary, of course. Cheers, Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Mar 16, 2022 at 1:10 PM varin sacha via R-help <r-help at r-project.org> wrote:
Dear R-experts, I have used the EnvStats package and the elnorm function (p. 248). I would like to calculate the exact 95% confidence intervals around the mean, not around the meanlog. Here below my R code, how can I get the exact 95% CIs around the mean ? Many thanks. library(EnvStats) x=rlnorm(100000,0,1) mean(x) elnorm(x,method="mvue",ci=TRUE,ci.type="two-sided",ci.method="exact",conf.level=0.95)
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
7 days later
Many thanks for your response. Le mercredi 16 mars 2022, 21:11:06 UTC+1, varin sacha via R-help <r-help at r-project.org> a ?crit : Dear R-experts, I have used the EnvStats package and the elnorm function (p. 248). I would like to calculate the exact 95% confidence intervals around the mean, not around the meanlog. Here below my R code, how can I get the exact 95% CIs around the mean ? Many thanks. library(EnvStats) x=rlnorm(100000,0,1) mean(x) elnorm(x,method="mvue",ci=TRUE,ci.type="two-sided",ci.method="exact",conf.level=0.95) ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.