Re: [R] log transformation and mean question

From: Ted Harding <>
Date: Thu, 12 May 2011 17:37:48 +0100 (BST)

On 12-May-11 15:15:00, 1Rnwb wrote:
> I have question about log2 transformation and performing mean
> on log2 data. I am doing analysis for ELISA data. the OD values
> and the concentration values for the standards were log2
> transformed before performing the lm. the OD values for samples
> were log2 transformed and coefficients of lm were applied to get
> the log2 concentration values. I then backtransformed these
> log2 concentrations and the trouble started. when i take the
> mean of log2 concentrations the value is different than the
> backtransformed concentrations.

>> 100+1000/2

> [1] 600
>> 2^( ( log2(100)+log2(1000) )/2 )

> [1] 316.2278
> What I am doing wrong to get the different values

Apart from the fact that I think your first line should be

  # [1] 550

you are doing nothing whatever wrong! The difference is an inevitable result of the fact that, for any set of positive numbers X = c(x1,x2,...,xn), not all equal,

  mean(log(X)) < log(mean(X))

This is because the curve of y = log(x) lies below the tangent to the curve at any given point. If that point is mean(X), and the tangent is y = a + b*x, then

  mean(log(X)) < mean(a + b*X) = a + b*mean(X) = log(mean(X))

since y = a + b*x is tangent to y = log(x) at x = mean(X). This is a special case of a general result called Jensen's Inequality.

Your second line is

  2^mean(log2(X)) < 2^log2(mean(X)) = mean(X).

where X = c(100,1000).


E-Mail: (Ted Harding) <> Fax-to-email: +44 (0)870 094 0861
Date: 12-May-11                                       Time: 17:37:45
------------------------------ XFMail ------------------------------

______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 12 May 2011 - 16:40:15 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 Thu 12 May 2011 - 17:10:06 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive