emmeans - change reference level of a contrast

Hi there!

I need some help, I used the following code:

EMM <- emmeans(model1, ~ A | B)

PRS <- contrast(EMM, "pairwise")

summary(PRS, type = "response", infer = c(TRUE, TRUE))

VarCorr(model1) # to calculate sigma

Con <- confint(PRS, type = "response", bias.adj = TRUE, sigma = 0.65767, offset = 0)

"A" has two levels: 0 and 1

Unfortunately, the final result of the contrast gives me the ratio for level 0 relative to level 1 but I would like the inverse. How can I do that?

Thank you in advance!

Relevel it perhaps?

PRS$response <- relevel(PRS$response, ref = "1") # or perhaps 1 , it depends on your dataset.

Thank you very much! I solved it by using revpairwise instead of pairwise.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.