0
$\begingroup$

I use R to run GLMM models in my study. Then in my situation, I have 10 independent variables and one of them has 3 categories. Then, when I run the GLMM, it usually uses one category as baseline, so it compares category A with B, and A with C, but does not compare B with C.

In this case, is it possible to have two models with different baselines, i.e. one with category A as baseline and the other has category B as baseline? And my conclusion can be based on both of them. What do you think?

$\endgroup$

1 Answer 1

1
$\begingroup$

You seem to just be talking about model contrasts, i.e. how you choose to compare different factor levels.

You might want to read a bit about contrasts to understand what they are doing, how they work etc, as they can be a bit confusing to get your head around. Some useful references are:

https://stackoverflow.com/questions/2352617/how-and-why-do-you-use-contrasts-in-r http://www.ats.ucla.edu/stat/r/library/contrast_coding.htm

However, a very simple way to compare B with C is just to recode your factor levels so that level B is taken as the baseline in R, and then you can use summary() to present the results, which will show you the comparison between the estimated mean values of level B and C.

To recode your factor (here called "your.factor") just use:

your.factor <- relevel(factor(your.factor), "b")

Alternatively, you can use the glht function in the multcomp package in R, although this will take a bit more investigation and learning about how to use it, and you might well be content with using the above solution, given you just need one extra comparison (glht is really useful when you need to specify many different comparisons not given by default, and to correct for multiple comparisons).

Hope that helps.

$\endgroup$
3
  • $\begingroup$ Hi JupiterM104, I am interested in doing the simple way, i.e. recoding factor to compare B with C. However, I am still not sure if I can have to two model: 1) model with A as baseline and 2) model with B as baseline, and report the results from both models without selecting them. Is it possible? $\endgroup$ Mar 19, 2014 at 16:52
  • 1
    $\begingroup$ Sorry, but I'm not entirely sure what you mean. However, if you're concerned about having multiple models, and just want one, be aware that changing which factor level is taken as the baseline does not change the underlying linear model. i.e. you need to make two models, one to test A vs B and A vs C, and another to test B vs C, but they are the same model. You'd only need to report 'using' one model, and present one set of results. e.g. take all results from the summary() of the first model, and just add relevant details of the B vs C test from summary() of the second model. Helpful? $\endgroup$ Mar 19, 2014 at 17:18
  • $\begingroup$ of course. Your reply is definitely helpful. I think it is easier to run two models with different baseline and report only comparison where relevant. Thank you very much. $\endgroup$ Mar 19, 2014 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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