# Means of Transformed versus Untransformed Data Don't Match

I am doing an ANOVA analysis, and to correct for normality, I used a log transformation on the response variable, RATING. I am trying to display some summary statistics. When I find the means of RATING and LOG_RATING, LOG_RATING is close to what I calculate the value to be, but not exactly the same. As in log(RATING) does not equal LOG_RATING. There is no missing data, so I am very confused.

Cohort is a categorical value 1 through 6. Rating is quantitative.

Here is the relevant code, output, and what log(RATING) should equal. Thoughts?

DATA SHEET1;
SET SHEET1;
LOG_RATING=LOG(RATING);
RUN;

PROC SORT  DATA=SHEET1;
BY COHORT;
RUN;

PROC MEANS DATA=SHEET1 N MEAN VAR MAXDEC=2 ;
CLASS COHORT;
BY RATING;
RUN;


• Are you familiar with Jensen’s inequality? Aug 4 at 16:33
• I am not. I googled it, and I don't see the connection, though. Aug 4 at 16:36
• The log of the mean is greater than (or equal to) the mean of the log. The operations don’t commute. Your “should” column is the former, and your program output is the latter. Aug 4 at 16:38
• Interesting. Thanks! Aug 4 at 16:41
• Many posts on site - many dozens by now I would think - address this issue (i.e. that $E[\log(X)]\neq \log(E[X])$ or issues resulting from it, and many more posts discuss the corresponding issue with nonlinear transformations $E[g(X)]\neq g(E[X])$ more generally. Aug 5 at 4:23