varin sacha
2022-Mar-16 20:10 UTC
[R] Exact 95% CI around the mean for LogNormal distribution
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)
Bert Gunter
2022-Mar-16 22:44 UTC
[R] Exact 95% CI around the mean for LogNormal distribution
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.
varin sacha
2022-Mar-24 12:51 UTC
[R] Exact 95% CI around the mean for LogNormal distribution
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.