I am confused. If I want to get differential expressed genes between
treatment and control with age interaction.  Which one should I use
:topTable (fit2, coef=2)  or  topTable (fit2, coef=4) .

Thanks,

Jack

2012/6/12 James W. MacDonald <jmacdon@uw.edu>

> Hi Jack,
>
>
> On 6/12/2012 1:54 PM, Yao Chen wrote:
>
>> Thanks James. That's exactly what I want to know.
>>
>> But I am not sure I fully understand the differential expressed genes in
>> topTable. For (fit2, coef=2), did I get the genes without considering
>> treat:age interaction, as my previous design matrix . And (fit2, coef=4)
>> gives me the genes considering treat:age interation.
>>
>
> No. When you fit a model with a bunch of coefficients, a given coefficient
> measures the marginal effect of the coefficient after accounting for all
> other coefficients in the model.
>
> In conventional linear modeling (where you aren't fitting thousands of
> models at once), you would probably fit a model with and without the
> interaction term and then test to see if the interaction term is
> significant. This is difficult to do in the context of a microarray
> analysis, so people generally just throw a bunch of coefficients in a model
> and look for significant genes.
>
> If you then wanted to do some other tests with a subset of your genes I
> suppose you could, but people generally pick 'interesting' genes and go to
> functional studies.
>
> Best,
>
> Jim
>
>
>
>> Jack
>>
>> 2012/6/12 James W. MacDonald <jmacdon@uw.edu <mailto:jmacdon@uw.edu>>
>>
>>    Hi Jack,
>>
>>    The conventional method is to use the model.matrix() function. I
>>    have no idea what your data look like, so here is a random example:
>>
>>    > treat <- factor(rep(0:1, each = 5))
>>    > treat
>>     [1] 0 0 0 0 0 1 1 1 1 1
>>    Levels: 0 1
>>    > age <- sample(25:35, 10, TRUE)
>>    > age
>>     [1] 32 30 32 35 29 26 27 25 33 34
>>    > model.matrix(~treat*age)
>>      (Intercept) treat1 age treat1:age
>>    1            1      0  32          0
>>    2            1      0  30          0
>>    3            1      0  32          0
>>    4            1      0  35          0
>>    5            1      0  29          0
>>    6            1      1  26         26
>>    7            1      1  27         27
>>    8            1      1  25         25
>>    9            1      1  33         33
>>    10           1      1  34         34
>>    attr(,"assign")
>>    [1] 0 1 2 3
>>    attr(,"contrasts")
>>    attr(,"contrasts")$treat
>>    [1] "contr.treatment"
>>
>>    Note that this uses a different parameterization. In this case the
>>    treat1 coefficient is the difference between the treated and
>>    untreated samples (so you wouldn't specify a contrasts.matrix, you
>>    just do lmFit() and then eBayes()). The treat1:age coefficient
>>    captures the difference between the slopes for the treated and
>>    untreated samples.
>>
>>    So topTable(fit2, coef=2) gives you genes that are differentially
>>    expressed between treated and untreated and topTable(fit2, coef=4)
>>    gives you genes where the change in expression at different ages
>>    varies between treated and untreated subjects.
>>
>>    Best,
>>
>>    Jim
>>
>>
>>
>>
>>
>>    On 6/12/2012 12:57 PM, Yao Chen wrote:
>>
>>        Thanks, James
>>
>>        How to include "age:treatment" interaction in the design matrix?
>>
>>        Jack
>>
>>        2012/6/12 James W. MacDonald <jmacdon@uw.edu
>>        <mailto:jmacdon@uw.edu> <mailto:jmacdon@uw.edu
>>
>>        <mailto:jmacdon@uw.edu>>>
>>
>>
>>           Hi Jack,
>>
>>
>>           On 6/12/2012 10:10 AM, Yao Chen wrote:
>>
>>               Dear All,
>>
>>               I try to find differential expressed genes between
>>        treat and
>>               untreated
>>               samples, and also I want to include the age effects.
>>
>>               The design matrix is like this:
>>
>>               treat  untreated  age
>>                 1        0            30
>>                 0         1           40
>>                 1        0            35
>>
>>
>>               The "treat" is factor, but "age" is continuous.  How
>>        can I set the
>>                "cont.matrix"?
>>
>>
>>           Pretty much just like you (or at least I) would expect:
>>
>>           contrast <- makeContrasts(treat - untreat, levels =  design)
>>
>>           But note that the design you are specifying allows different
>>           intercepts, but the slope is assumed to be the same for treated
>>           and untreated. If you want to allow different slopes as
>>        well, you
>>           need to introduce an age:treatment interaction term. Here I am
>>           assuming you have more than three samples.
>>
>>           Best,
>>
>>           Jim
>>
>>
>>
>>               Thanks,
>>
>>               Jack
>>
>>                      [[alternative HTML version deleted]]
>>
>>               ______________________________**_________________
>>               Bioconductor mailing list
>>        Bioconductor@r-project.org <mailto:Bioconductor@r-**project.org<Bioconductor@r-project.org>
>> >
>>        <mailto:Bioconductor@r-**project.org <Bioconductor@r-project.org>
>>
>>        <mailto:Bioconductor@r-**project.org <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>
>>
>>
>>           --     James W. MacDonald, M.S.
>>           Biostatistician
>>           University of Washington
>>           Environmental and Occupational Health Sciences
>>           4225 Roosevelt Way NE, # 100
>>           Seattle WA 98105-6099
>>
>>
>>
>>    --     James W. MacDonald, M.S.
>>    Biostatistician
>>    University of Washington
>>    Environmental and Occupational Health Sciences
>>    4225 Roosevelt Way NE, # 100
>>    Seattle WA 98105-6099
>>
>>
>>
> --
> James W. MacDonald, M.S.
> Biostatistician
> University of Washington
> Environmental and Occupational Health Sciences
> 4225 Roosevelt Way NE, # 100
> Seattle WA 98105-6099
>
>

	[[alternative HTML version deleted]]

