BookmarkSubscribeRSS Feed
amoreau1
Calcite | Level 5

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

4 REPLIES 4
SteveDenham
Jade | Level 19

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

amoreau1
Calcite | Level 5

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.

SteveDenham
Jade | Level 19

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

Ksharp
Super User

SAS has a function GEOMEAN() to do this way . Do you need it ?

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 4837 views
  • 3 likes
  • 3 in conversation