Contrast Matrix to Compare Treatments While Accounting for Baseline

28 views
Skip to first unread message

Frank Fabela

unread,
Jul 21, 2026, 10:32:06 PMJul 21
to MSstats
Hello, 

I am looking for some guidance setting up my comparison matrix to determine differences between treatments while accounting for pre-treatment baseline levels. My first treatment has a temperature component "HS" and my second treatment has two components temperature + protein inhibitor "Inh". They both have the same baseline measurement "BL". There is also a time component with experimental measurements taken over two days "XP1" and "XP2".  I am comparing changes seen in each treatment to the baseline.

My comparison matrix is set up in the attached image; however, I do not think my last two comparisons are set up for what I want to compare. 

I want to compare the differences seen in "HS-BL" to the differences seen in "Inh-BL". Can you help me set this up? 

Code to set up this matrix is as follows:

comp1 <- matrix(c(-1,1,0,0,0),nrow=1)
comp2 <- matrix(c(-1,0,1,0,0),nrow=1)
comp3<-  matrix(c(-1,0,0,1,0),nrow=1)
comp4 <-  matrix(c(-1,0,0,0,1),nrow=1)
comp5 <- matrix(c(-2,1,1,0,0), nrow=1)
comp6 <- matrix(c(-2,0,0,1,1), nrow=1)
trt_compare<- rbind(comp1,
                     comp2,
                     comp3,
                     comp4,
                     comp5,
                     comp6)
row.names(trt_compare) <- c("XP1_HS-BL", "XP1_Inh-BL", "XP2_HS-BL","XP2_Inh-BL", "(XP1_Inh-BL)-(XP1_HS-BL)", "(XP2_Inh-BL)-(XP2_HS-BL)")
trt_groups<- as.matrix(c("BL", "XP1_HS", "XP1_Inh", "XP2_HS", "XP2_Inh"))
trt_groups
colnames(trt_compare) <- trt_groups
trt_compare

Thank you so much!

-Frank Fabela

Frank Fabela

unread,
Jul 25, 2026, 1:44:39 AMJul 25
to MSstats
Screen Shot 2026-07-24 at 10.41.43 PM.png

Anthony Wu

unread,
Jul 31, 2026, 2:57:13 PMJul 31
to MSstats
Hi,

The first 4 rows of the contrast matrix are correct.  However, for the last 2 rows, since you're using the same baseline, the baselines cancel out and comparing differences seen in "HS-BL" to the differences seen in "Inh-BL" is equivalent to comparing "HS - Inh".

To compare "HS - Inh", you can set up your contrast matrix as:

0 * BL + 0.5 * XP1_HS - 0.5 * XP1_Inh + 0.5 * XP2_HS  - 0.5 * XP2_Inh

Thanks,
Tony
Reply all
Reply to author
Forward
0 new messages