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

1

7

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
Lucia answered 1/10, 2018 at 22:14 Comment(2)
Does your current solution equal your contrast of A vs. B (of one half of it)? It seems that your current solution will just be controlling for the control group and the effect will be averaged out.Ably
also you might find better luck on cross validated for a statistical questions (for the hypotheses interpretation)Ably
G
0

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.

Grenade answered 5/1, 2019 at 1:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.