# [BioC] Proper set up to test interaction of continuous covariate and factor levels (limma)

James W. MacDonald jmacdon at uw.edu
Wed Aug 21 15:13:48 CEST 2013

```Hi Moritz,

On 8/20/2013 2:30 PM, Moritz Hess wrote:
> Hi,
> I am investigating the global gene expression response to a continuous
> environmental covariate in two groups of individuals using limma.
> I am interested in genes whose  expression is:
> A) correlated with the covariate
> B) differentially correlated with the covariate in the two groups of
> individuals (Interaction of Group and Covariate)
>
> In order to be able to set up the proper contrasts I split the Covariate in
> two Vectors where one Vector contains only the samples with the lowest
> level of the covariate
> e.g.  CovBase = c(0,0,0,3,0,3,0,0)
> and where the other vector contains all the samples with higher levels of
> the covariate
> e.g. Cov = c(34,2,5,0,5,0,2,34)
> and set up a design matrix without intercept:
>
> ~ Group + CovBase + Cov
>
>
> The contrasts I am testing are specified as follows:
> Effect of Covariate: Cov-CovBase
> Interaction of Group and Covariate: (GroupA-GroupB) - (Cov-CovBase)
>
> Does this procedure makes sense ?

It doesn't make sense to me. In the first place the formula you use will
create an intercept. Secondly, if you want the covariate to be
continuous, then why are you splitting it like that? And why do you
think values of 3 are lower than values of 2?

If I were trying to do what you say you are doing, then I would just do

cov <- c(34,2,5,3,5,3,2,34)
group <- factor(whateveryourgroupsare)

design <- model.matrix(~cov*group)

Best,

Jim

>
> Thank you very much in advance
>
> Moritz
>
>
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

--
James W. MacDonald, M.S.
Biostatistician
University of Washington
Environmental and Occupational Health Sciences
4225 Roosevelt Way NE, # 100
Seattle WA 98105-6099

```