I need to calculate the geometric mean of data.
These data are first transformed in log10.
Then I do the arithmetic mean of these log10 values and then i do the exponential of the arithmetic mean.
Do you confirm I am right?
(I find very different values from arithmetic mean so I am not sure I do the calculation correclty).
Moreover, someome told me that I should do GM = exponential of the arithmetic mean * log(10) (log function is the natural logarithm in SAS) and not just GM = exponential of the arithmetic mean
Thanks.for your help
The backtransformation is not exp(), but rather 10**(), when the transformation is log10. The expression log(10)*exp() will give the same value.
Steve Denham
Dear Steve,
Thanks for your reply.
Just to clarify, if I do 10**(mean_of_log_values), it is not equal to log(10)*exp(mean_of_log_values).
I found the same result if I do exp(mean_of_log_values * log(10).
So, what is the good formula?
Thanks.
My mistake.
Let X = mean of log10 values.
Then geometric mean = 10**X
OR geometric mean = exp(log(10)*X), where log is the natural log of 10 = 2.303 (approximately).
If the variables in question are x1 to xN, then Ksharps recommendation of geomean(x1, x2,..., xN) is the way to go. Note that this is invalid for any x less than zero, and returns zero if any of the x's are equal to zero. This may require transposing the data if the x values are on separate records.
Steve Denham
SAS has a function GEOMEAN() to do this way . Do you need it ?
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.