0
$\begingroup$

I am calculating the difference between concentration of different metabolites according to the factor sex (male/female) and age group (<55 / >=55) from this linear model:

model <- lm(metabolite ~ agegroup + sex, data =df)
emmeans(model, "agegroup")


sex = 0:
 agegroup emmean     SE   df lower.CL upper.CL
        0  0.329 0.0291 2499    0.272    0.386
        1  0.373 0.0327 2499    0.308    0.437

sex = 1:
 agegroup emmean     SE   df lower.CL upper.CL
        0 -0.490 0.0303 2499   -0.549   -0.430
        1 -0.446 0.0377 2499   -0.520   -0.372

Confidence level used: 0.95

Now I want to calculate the percentage of difference of male vs. female by age group and plot it. I am trying this

mean_diff_sex <- as.data.frame(emmeans::contrast(emmeans(model, "sex")))

 contrast   estimate         SE   df   t.ratio       p.value
1 0 effect -0.5206612 0.01737366 2499 -29.96842 7.576451e-169
2 1 effect  0.5206612 0.01737366 2499  29.96842 7.576451e-169

However, I am not sure if I can transform this estimate into the percentage of difference doing: ((2^estimate)-1)x100 or it would be better to using: Absolute difference / Average x 100

Thank you in advance for any help

$\endgroup$

1 Answer 1

0
$\begingroup$

Refer to a recent answer to a similar question, in particular the last half of it. This also inspired an vignette example along the same lines.

However, you need to have your estimates on the log scale first. For example, fit the model with log(metabolite) as the response.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.