I have done this in the past, although I did not have much faith in it,
maybe because of the way I create the design matrix.

For example I do it this way:

Treat <- factor(paste(targets$Condition,targets$Time,sep="."))
design <- model.matrix(~0+Treat)
colnames(design) <- levels(Treat)
colnames(design)
[1] "Case.Time2"    "Case.Time1"     "Control.Time2" "Control.Time1"


#introduce continuous variable, add to design
CES <- factor(targets$CES)
design2 <- cbind(design, CES)
colnames(design2)
[1] "Case.Time2"    "Case.Time1"     "Control.Time2" "Control.Time1"
"CES"

I go on to duplicate correlation and lmfit then make these contrasts to
substract away the effect of the continuous variable from our observations.

cm <- makeContrasts(
CaseEffect = Case.Time2-Case.Time1,
ControlEffect = Control.Time2-Control.Time1,
ContrastEffect = (Case.Time2-Case.Time1)-(Control.Time2-Control.Time1),
CaseEffectNoCov = (Case.Time2-Case.Time1)-(CES),
ControlEffectNoCov = (Case.Time2-Case.Time1)-(CES),
ContrastEffectNoCov = (Case.Time2-Case.Time1)-(CES) -
(Case.Time2-Time1)-(CES),
levels=designnew)

etc...

Our results are 'different' so it would be useful to have another opinion
regarding this set-up.

Michael








On Tue, Oct 22, 2013 at 11:03 PM, Ryan <rct@thompsonclan.org> wrote:

> Including continuous covariates in design matrices is R is just as easy as
> including categorical ones. Instead of creating a column for each degree of
> freedom in the categorical variable, you just end up with a single column
> that simply contains the values of the continuous variable. Try using the
> model.matrix function with a combination of your categorical variables and
> continuous ones to see what it does.
>
> -Ryan
>
>
> On Tue Oct 22 14:36:38 2013, Richard Friedman wrote:
>
>>
>> On Oct 22, 2013, at 5:30 PM, Michael Breen wrote:
>>
>>  Hi all,
>>>
>>> Our lab analyzes gene-expression from microarray and RNAseq platforms.
>>> Currently, I am looking for a package to test differential expression
>>> (DE)
>>> while considering continuous variables that may alter gene-expression
>>> profiles. In other words, an ANCOVA type tool. I am quite familiar with
>>> Limma (ANOVA) but including continuous variables is not very well
>>> described.
>>>
>>> Specifically, we have a project were two groups can be modeled over the
>>> same 2 time points. One group starts healthy and ends in a disease state.
>>> The other group starts healthy and remains healthy.
>>>
>>> We are interested in identifying genes uniquely responding within one
>>> group
>>> and not in the other. Thus, we have implemented a longitudinal contrast
>>> with linear modeling through Limma. However, we are also interested in
>>> adding one or two continuous variables (tumor size, time spent
>>> meditating,
>>> the amount of drinks one consumes etc..)  to check if gene expression
>>> differences or similarities may be due to these factors instead of due to
>>> belonging to a certain class. Limma seems to test categorical variables,
>>> but I don't think it is capable of either correlating gene-expression to
>>> continuous variables.
>>>
>>> If not, can someone recommend  a tool which may be appropriate for such a
>>> situation?
>>>
>>> Yours,
>>>
>>> Michael
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> ______________________________**_________________
>>> Bioconductor mailing list
>>> Bioconductor@r-project.org
>>> https://stat.ethz.ch/mailman/**listinfo/bioconductor<https://stat.ethz.ch/mailman/listinfo/bioconductor>
>>> Search the archives: http://news.gmane.org/gmane.**
>>> science.biology.informatics.**conductor<http://news.gmane.org/gmane.science.biology.informatics.conductor>
>>>
>> Dear Michael and list,
>>
>>         I think that you write the design and contrast matrices
>> exactly as you would for an ANCOVA in R only you do the
>> fit and Bayesian correction in Limma.
>>
>> Perhaps someone who has had experience doing this
>> kind of analysis can comment.
>>
>> Best wishes,
>> Rich
>>
>> Richard A. Friedman, PhD
>> Associate Research Scientist,
>> Biomedical Informatics Shared Resource
>> Herbert Irving Comprehensive Cancer Center (HICCC)
>> Lecturer,
>> Department of Biomedical Informatics (DBMI)
>> Educational Coordinator,
>> Center for Computational Biology and Bioinformatics (C2B2)/
>> National Center for Multiscale Analysis of Genomic Networks (MAGNet)/
>> Columbia Department of Systems Biology
>> Room 824
>> Irving Cancer Research Center
>> Columbia University
>> 1130 St. Nicholas Ave
>> New York, NY 10032
>> (212)851-4765 (voice)
>> friedman@cancercenter.**columbia.edu <friedman@cancercenter.columbia.edu>
>> http://cancercenter.columbia.**edu/~friedman/<http://cancercenter.columbia.edu/~friedman/>
>>
>> In memoriam, Frederik Pohl
>>
>> ______________________________**_________________
>> Bioconductor mailing list
>> Bioconductor@r-project.org
>> https://stat.ethz.ch/mailman/**listinfo/bioconductor<https://stat.ethz.ch/mailman/listinfo/bioconductor>
>> Search the archives: http://news.gmane.org/gmane.**
>> science.biology.informatics.**conductor<http://news.gmane.org/gmane.science.biology.informatics.conductor>
>>
>

	[[alternative HTML version deleted]]

