Entering edit mode
Dear Xiaokuan,
You haven't told us about your data, but it must contain missing
values or
weights, because otherwise the two topTable results you give would
have
been identical. In the absence of missing values or weights, the
results
would have been as you expected.
With missing values or weights, the first topTable result you give
(the
one with designcontr) is exact whereas the second result is
approximate.
The fact that contrast.fit() gives approximate results in the presence
of
missing values or weights is mentioned on the documentation page for
contrast.fit, and has been discussed a few times on this list, see
https://www.stat.math.ethz.ch/pipermail/bioconductor/2009-December/030
947.html
Professor Albyn Jones is trying to pursuade me to implement something
similar to contrasts.fit() that would be exact in all cases. The only
way
I could do this would be to add an argument 'contrasts' to lmFit. I
may
yet do that!
Best wishes
Gordon
> Date: Sat, 14 Aug 2010 12:30:57 -0700 (PDT)
> From: Xiaokuan Wei <weixiaokuan at="" yahoo.com="">
> To: bioconductor <bioconductor at="" stat.math.ethz.ch="">
> Subject: [BioC] how does limma calculate the coefficients with using
> different design matrix?
>
> Dear list,
>
> I have two design matrixes:
>
> design<-model.matrix(~-1+factor(grp))
> designcontr<-model.matrix(~factor(grp))
>
> then make contrast matrix:
> cont.matrix<-rbind(rep(-1,9),diag(9))
> cont.matrix_contr <- rbind(rep(0,9),diag(9))
>
> after using topTable to get the specific probe values, I found:
> e.g.
> using designcontr and cont.matrix_contr:
> ID Coef1 Coef2 Coef3 Coef4 Coef5 Coef6 Coef7 Coef8 Coef9 AveExpr F
P.Value
> adj.P.Val
>
> feature1 -0.07976 2.900216 3.06401 3.210565 0.229553 1.545972
2.433364 2.62326
> 2.719911 13.18788 1133.135 1.60E-15 7.20E-11
>
>
> using design and cont.matrix:
> ID Coef1 Coef2 Coef3 Coef4 Coef5 Coef6 Coef7 Coef8 Coef9 AveExpr F
P.Value
> adj.P.Val
>
> feature1 -0.07976 0.229553 1.545972 2.433364 2.62326 2.719911
2.900216 3.06401
> 3.210565 13.18788 1133.135 1.60E-15 7.20E-11
>
>
>
> I try to understand why there is difference between
cont.matrix_contr and
> cont.matrx results, since both of them is try to get the difference
between each
> grp(grp2 to grp10) and grp1. i.e. grp[i](i=2-10) - grp[1]
>
> even I used the different contrasts, the coef should? be the same. I
am
> confused.
>
>
> Thank you for your help.
>
> Regards,
> Xiaokuan