2
$\begingroup$

I'm fitting an LME (with lmer in R) with one categorical variable that has many (80) different values. A fitting example for my problem would be how weight loss after fasting is distributed across different body parts and organs. I.e. my model would be: weight change ~ 1+ bodypart + (1|subject)

A likelihood ratio test tells me that it makes sense to include the categorical variable as predictor.

Now my key question is at what values of the predictor there is a significant/relevant deviation from 0, i.e. in which organs is there a significant change in weight? I first thought the estimates of the predictors for the individual levels of the categorical variables will tell me this. However, if I understand correctly this would only be true if the intercept would be 0.

My intuition is that perhaps estimated marginal means (ie. using emmeans in R) could help me here but I would not know how to ask the question correctly (in R and in general).

$\endgroup$

2 Answers 2

2
$\begingroup$

Ben is correct. But if interested, the emmeans way is

emm <- emmeans(model, “bodypart”)
contrast(emm, “eff”)

This compares each EMM with the grand mean. If you have more than one fixed factor in the model, this’d be the way to go.

$\endgroup$
2
  • $\begingroup$ are ~ bodypart and "bodypart" equivalent as second arguments? (BTW, you have smart-quotes in your answer, which would mess up cutting & pasting - was that intentional?) $\endgroup$
    – Ben Bolker
    Commented Aug 9, 2019 at 19:57
  • $\begingroup$ Sorry about the smart quotes. My phone is definitely not smarter than me, though I guess it’s catching up as I get older. Yes, the formula and character specs are equivalent. $\endgroup$
    – Russ Lenth
    Commented Aug 9, 2019 at 23:53
1
$\begingroup$

Yes emmeans can do this via emmeans(fitted_model, ~ bodypart). However, in this particular case you can get the same results by fitting the model

weight_change ~ 0 + bodypart + (1|subject)

(a -1 would work just as well in place of 0); this instructs R to suppress the model intercept, and in this case would correspond to the model $\Delta w_{ij} = \beta_i + \epsilon_{1,j} + \epsilon_{2,ij}$ where $j$ denotes subject and $i$ denotes body part.

As a little bit of a frame challenge, you might want to consider treating body part as a random effect; that would make it harder to do classical inference about individual body parts (e.g. get p-values), but it might lead to more accurate estimates and could get you around some of the multiple-testing challenges you'll get from looking at 80 separate hypothesis tests. (If your data set is huge it might not make that much difference.)

$\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.