bt.log: Back-transformation of log-transformed mean and variance

View source: R/bt.log.R

bt.logR Documentation

Back-transformation of log-transformed mean and variance

Description

Converts a log-mean and log-variance to the original scale and calculates confidence intervals

Usage

bt.log(meanlog = NULL, sdlog = NULL, n = NULL, alpha = 0.05)

Arguments

meanlog

sample mean of natural log-transformed values

sdlog

sample standard deviation of natural log-transformed values

n

sample size

alpha

alpha-level used to estimate confidence intervals

Details

There are two methods of calcuating the bias-corrected mean on the original scale. The bt.mean is calculated following equation 14 (the infinite series estimation) in Finney (1941). approx.bt.mean is calculated using the commonly known approximation from Finney (1941):

mean=exp(meanlog+sdlog^2/2). The variance is var=exp(2*meanlog)*(Gn(2*sdlog^2)-Gn((n-2)/(n-1)*sdlog^2) and standard deviation is sqrt(var) where Gn is the infinite series function (equation 10). The variance and standard deviation of the back-transformed mean are var.mean=var/n; sd.mean=sqrt(var.mean). The median is calculated as exp(meanlog). Confidence intervals for the back-transformed mean are from the Cox method (Zhou and Gao, 1997) modified by substituting the z distribution with the t distribution as recommended by Olsson (2005):

LCI=exp(meanlog+sdlog^2/2-t(df,1-alpha/2)*sqrt((sdlog^2/n)+(sdlog^4/(2*(n-1)))) and

UCI=exp(meanlog+sdlog^2/2+t(df,1-alpha/2)*sqrt((sdlog^2/n)+(sdlog^4/(2*(n-1))))

where df=n-1.

Value

A vector containing bt.mean, approx.bt.mean,var, sd, var.mean,sd.mean, median, LCI (lower confidence interval), and UCI (upper confidence interval).

Author(s)

Gary A. Nelson, Massachusetts Division of Marine Fisheries gary.nelson@mass.gov

References

Finney, D. J. 1941. On the distribution of a variate whose logarithm is normally distributed. Journal of the Royal Statistical Society Supplement 7: 155-161.

Zhou, X-H., and Gao, S. 1997. Confidence intervals for the log-normal mean. Statistics in Medicine 16:783-790.

Olsson, F. 2005. Confidence intervals for the mean of a log-normal distribution. Journal of Statistics Education 13(1). www.amstat.org/publications/jse/v13n1/olsson.html

Examples

## The example below shows accuracy of the back-transformation
y<-rlnorm(100,meanlog=0.7,sdlog=0.2)
known<-unlist(list(known.mean=mean(y),var=var(y),sd=sd(y),
  var.mean=var(y)/length(y),sd.mean=sqrt(var(y)/length(y))))
est<-bt.log(meanlog=mean(log(y)),sdlog=sd(log(y)),n=length(y))[c(1,3,4,5,6)]
known;est

fishmethods documentation built on April 27, 2023, 9:10 a.m.