# [BioC] Help on contrast matrix Limma

Gordon K Smyth smyth at wehi.EDU.AU
Fri Sep 25 02:12:59 CEST 2009

```Dear Jeremy,

> Date: Wed, 23 Sep 2009 13:26:57 -0700
> From: jeremy wilson <jeremy.wilson88 at gmail.com>
> Subject: [BioC] Help on contrast matrix Limma
> To: bioconductor at stat.math.ethz.ch
>
> Hello bioconductor group,
>
> I am stuck with understanding how to create contrast matrix for
> extracting the comparisons I need. Some seem to be easy and some I
> could never understand. I am analyzing a 2factorial experiment and
> found the below post useful. I have the exact same questions and would
> greatly appreciate if any one can give detailed answers.
>
> My question from the post below pertains to
> AvsN=(MUTA+ConA-MUTN-ConN)/2, levels=design)
>
> is AvsN also equal to (MutA-ConA)-(MutN-ConN)?

Well, the usual rules of high-school algebra apply.  The formula you've
written obviously does not have the same value as AvsN.  (You've changed
the names of the variables, changed the signs, and removed the division by
2.)  Why would you think they'd be the same?.

> Also why did we divide the (MUTA+ConA-MUTN-ConN) by 2?

So that AvsN = ((MUTA-MUTN)+(ConA-ConN))/2.  MUTA-MUTN is the effect of
AvsN on the mutant background.  ConA-ConN is the effect of A on the
control background.  So AvsN as defined is the effect for A averaged over
the mutant and control backgrounds.  If you didn't divide by 2 then it
would be the sum of the effects, which seems somewhat less interpretable.
You can choose whether you want to divide or not.  It makes no difference
to the t-statistics or p-values.

Best wishes
Gordon

> I got this question when I looked at the following code in Limma user
> guide page 46 with the following code for exact same design
>
>> cont.matrix <- makeContrasts(
> + WT.SvsU=WT.S-WT.U,
> + Mu.SvsU=Mu.S-Mu.U,*+ Diff=(Mu.S-Mu.U)-(WT.S-WT.U)*,
> + levels=design)
>
> Hoping to get a response from the bioconductors,
>
> Thanks
>
> Jeremy

```