Dear List,
I have been working with LIMMA and I'm a bit confused by the
linear
models. I have a group with 4 factors. I want to remove covariates
from the main effects before I look at contrasts. Before I do this, I
was trying out the different combinations of ~ . When I say
lmFit(~group), this is supposed to calculate an intercept. This
works.
The problem is that my groupCTL disappears. If I say lmFit(~ -1 +
group), I gather that the intercept is constrained to (0,0) and that
lmFit(~ 0 + group) does not calculate an intercept.
My problem is that I want lmFit to give me an intercept and
not take
away my groupCTL! Below is the code showing what I mean. Everything
works, its just that I want my contrast matrix to include
groupPE-groupCTL, but I can't do this when the intercept is
calculated.
Any assistance in clarifying this matter would be appreciated. Thanks
Ramsi
> table(group)
group
CTL PE TIL TNL
17 22 12 10
> design.e <- model.matrix(~group)
> colnames(design.e)
[1] "(Intercept)" "groupPE" "groupTIL" "groupTNL"
> design.e <- model.matrix(~-1 + group)
> colnames(design.e)
[1] "groupCTL" "groupPE" "groupTIL" "groupTNL"
> design.e <- model.matrix(~0 + group)
> colnames(design.e)
[1] "groupCTL" "groupPE" "groupTIL" "groupTNL"
>Date: 14 Apr 2005 13:35:55 -0400
>From: Ramsi Haddad <rhaddad@genetics.wayne.edu>
>Subject: [BioC] linear models and intercepts with LIMMA
>To: bioconductor@stat.math.ethz.ch
>Content-Type: text/plain
>
>Dear List,
>
> I have been working with LIMMA and I'm a bit confused by the
linear
>models. I have a group with 4 factors. I want to remove covariates
>from the main effects before I look at contrasts. Before I do this,
I
>was trying out the different combinations of ~ . When I say
>lmFit(~group), this is supposed to calculate an intercept. This
works.
>The problem is that my groupCTL disappears. If I say lmFit(~ -1 +
>group), I gather that the intercept is constrained to (0,0) and that
>lmFit(~ 0 + group) does not calculate an intercept.
> My problem is that I want lmFit to give me an intercept and
not take
>away my groupCTL!
It sounds as if you want to four have group effects and still have an
intercept, which is simply meaningless. You can't create 5 meaningful
numbers when you only started with 4 groups. Why in the world do you
want
an intercept? What do you think it would mean?
You need to think in terms of what the estimated coefficients mean.
Gordon
> Below is the code showing what I mean. Everything
>works, its just that I want my contrast matrix to include
>groupPE-groupCTL, but I can't do this when the intercept is
calculated.
>
>Any assistance in clarifying this matter would be appreciated.
Thanks
>
>Ramsi
>
>
> > table(group)
>group
>CTL PE TIL TNL
> 17 22 12 10
>
> > design.e <- model.matrix(~group)
>
> > colnames(design.e)
>[1] "(Intercept)" "groupPE" "groupTIL" "groupTNL"
>
> > design.e <- model.matrix(~-1 + group)
>
> > colnames(design.e)
>[1] "groupCTL" "groupPE" "groupTIL" "groupTNL"
>
> > design.e <- model.matrix(~0 + group)
>
> > colnames(design.e)
>[1] "groupCTL" "groupPE" "groupTIL" "groupTNL"
Ramsi Haddad wrote:
> Dear List,
>
> I have been working with LIMMA and I'm a bit confused by the
linear
> models. I have a group with 4 factors. I want to remove covariates
> from the main effects before I look at contrasts. Before I do this,
I
> was trying out the different combinations of ~ . When I say
> lmFit(~group), this is supposed to calculate an intercept. This
works.
> The problem is that my groupCTL disappears. If I say lmFit(~ -1 +
> group), I gather that the intercept is constrained to (0,0) and that
> lmFit(~ 0 + group) does not calculate an intercept.
> My problem is that I want lmFit to give me an intercept and
not take
> away my groupCTL! Below is the code showing what I mean.
Everything
> works, its just that I want my contrast matrix to include
> groupPE-groupCTL, but I can't do this when the intercept is
calculated.
You are misunderstanding the models you are fitting. In the first
place,
with ANOVA there is no assumption of a linear relationship between the
factor levels, so removing the intercept term doesn't constrain the
intercept to (0, 0). In this case, the intercept term indicates what
sort of model you want to fit, either a cell means or factor effects
model.
Without an intercept you are fitting a cell means model in which you
are
estimating the mean expression for each factor level (e.g., the model
is
y_ij = u_i + e_ij). In this case, doing the contrasts is quite
straightforward.
If you add an intercept term, you are fitting a factor effects model
in
which all of the other factors are specified in relation to some mean
value. In this case, all the other factors are specified in relation
to
the mean of the groupCTL (e.g., the model is y_ij = u. + t_i + e_ij).
Here u. is the mean of the groupCTL samples, and the t_i are the
amounts
that each of the other group means differ from the groupCTL mean.
Therefore, the contrasts are specified by the t_i values themselves if
you are comparing to groupCTL, and are specified by e.g., groupPE -
groupTIL for the other contrasts.
HTH,
Jim
>
> Any assistance in clarifying this matter would be appreciated.
Thanks
>
> Ramsi
>
>
>
>>table(group)
>
> group
> CTL PE TIL TNL
> 17 22 12 10
>
>
>>design.e <- model.matrix(~group)
>
>
>>colnames(design.e)
>
> [1] "(Intercept)" "groupPE" "groupTIL" "groupTNL"
>
>
>>design.e <- model.matrix(~-1 + group)
>
>
>>colnames(design.e)
>
> [1] "groupCTL" "groupPE" "groupTIL" "groupTNL"
>
>
>>design.e <- model.matrix(~0 + group)
>
>
>>colnames(design.e)
>
> [1] "groupCTL" "groupPE" "groupTIL" "groupTNL"
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
--
James W. MacDonald
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623
Dear Jim,
Thanks for your explanation. My confusion is over the fact
that both
regression and ANOVA are called by the same function.
I guess I don't need the intercept as Gordon suggested for the factor
co-variates, but I thought I needed an intercept for a continuous
co-variate.
My original message indicated that the intercept can be
calculated by
loosing one of the samples when using group (factor) data. If I use
only a continuous covariate, like age, I can get an intercept and
still
keep the age co-variate. The trouble arises when I add a factor (like
group) and a continuous co-variate (like age). In this case, I can
get
an intercept, but I loose a factor.
I am not intending to do anything with the intercept. For
this reason,
I am taking Gordon's advice and not calculating an intercept.
Thanks all.
Ramsi
> Ramsi Haddad wrote:
> > Dear List,
> >
> > I have been working with LIMMA and I'm a bit confused by the
linear
> > models. I have a group with 4 factors. I want to remove
covariates
> > from the main effects before I look at contrasts. Before I do
this, I
> > was trying out the different combinations of ~ . When I say
> > lmFit(~group), this is supposed to calculate an intercept. This
works.
> > The problem is that my groupCTL disappears. If I say lmFit(~ -1 +
> > group), I gather that the intercept is constrained to (0,0) and
that
> > lmFit(~ 0 + group) does not calculate an intercept.
> > My problem is that I want lmFit to give me an intercept and
not take
> > away my groupCTL! Below is the code showing what I mean.
Everything
> > works, its just that I want my contrast matrix to include
> > groupPE-groupCTL, but I can't do this when the intercept is
calculated.
>
> You are misunderstanding the models you are fitting. In the first
place,
> with ANOVA there is no assumption of a linear relationship between
the
> factor levels, so removing the intercept term doesn't constrain the
> intercept to (0, 0). In this case, the intercept term indicates what
> sort of model you want to fit, either a cell means or factor effects
model.
>
> Without an intercept you are fitting a cell means model in which you
are
> estimating the mean expression for each factor level (e.g., the
model is
> y_ij = u_i + e_ij). In this case, doing the contrasts is quite
> straightforward.
>
> If you add an intercept term, you are fitting a factor effects model
in
> which all of the other factors are specified in relation to some
mean
> value. In this case, all the other factors are specified in relation
to
> the mean of the groupCTL (e.g., the model is y_ij = u. + t_i +
e_ij).
> Here u. is the mean of the groupCTL samples, and the t_i are the
amounts
> that each of the other group means differ from the groupCTL mean.
> Therefore, the contrasts are specified by the t_i values themselves
if
> you are comparing to groupCTL, and are specified by e.g., groupPE -
> groupTIL for the other contrasts.
>
> HTH,
>
> Jim
>
>
> >
> > Any assistance in clarifying this matter would be appreciated.
Thanks
> >
> > Ramsi
> >
> >
> >
> >>table(group)
> >
> > group
> > CTL PE TIL TNL
> > 17 22 12 10
> >
> >
> >>design.e <- model.matrix(~group)
> >
> >
> >>colnames(design.e)
> >
> > [1] "(Intercept)" "groupPE" "groupTIL" "groupTNL"
> >
> >
> >>design.e <- model.matrix(~-1 + group)
> >
> >
> >>colnames(design.e)
> >
> > [1] "groupCTL" "groupPE" "groupTIL" "groupTNL"
> >
> >
> >>design.e <- model.matrix(~0 + group)
> >
> >
> >>colnames(design.e)
> >
> > [1] "groupCTL" "groupPE" "groupTIL" "groupTNL"
> >
> > _______________________________________________
> > Bioconductor mailing list
> > Bioconductor@stat.math.ethz.ch
> > https://stat.ethz.ch/mailman/listinfo/bioconductor
>