In R, how do I define model contrasts for comparing two conditions relative to a common control?

681 views Asked by At

I've been using the makeContrasts function in the Limma package to create contrasts, and I understand how to make simple contrasts, for example comparing each Treatment to a control independently or comparing two treatments:

makeContrasts(A_vs_Ctrl = "A - Control", B_vs_Ctrl = "B - Control",
              C_vs_Ctrl = "C - Control", A_vs_B = "A - B",
              levels = c("Control", "A", "B", "C"))

          Contrasts
Levels      A_vs_Ctrl  B_vs_Ctrl  C_vs_Ctrl  A_vs_B
  Control        -1        -1        -1        0
  A               1         0         0        1
  B               0         1         0       -1
  C               0         0         1        0

My question is how would one code for a contrast between two treatments while each treatment is considered relative to the control? For instance, I would like to determine when there are differences between A_vs_Ctrl and B_vs_Ctrl; the idea is that this would indicate when treatment A and treatment B differ from the Control condition in distinct ways rather than in the same way. My attempt at this is below but I don't think it's correct and I am having trouble understanding how to correctly encode this hypothesis in contrasts.

makeContrasts(AvsCtrl_VS_BvsCtrl = "(A - Control)/2 - (B - Control)/2",levels=c( "Control","A","B","C"))

 Contrasts
Levels    AvsCtrl_VS_BvsCtrl
  Control                0.0
  A                      0.5
  B                     -0.5
  C                      0.0
1

There are 1 answers

0
Joseph Clark McIntyre On

You're asking if the effect of A is different from the effect of B, that is if A-C = B-C. But that's identical to asking if A = B. I think your A_vs_B contrast is answering your question already.