[BioC] RE: How to fit patient as a fixed effect/paired samples

Gordon K Smyth smyth at wehi.EDU.AU
Thu Mar 10 13:00:27 CET 2005

> Date: Wed, 9 Mar 2005 16:36:40 +0100
> From: <PJARES at clinic.ub.es>
> Subject: [BioC] RE: How to fit patient as a fixed effect/paired
> 	samples
> To: <bioconductor at stat.math.ethz.ch>
> I am using affymetrix arrays to study primary and
> metastic tumors from the same patients (five patients,
> so five primary and five metastatic tumors). As we
> have two classes and paired experiments I have been
> using a paired t-test. However, I would like to use
> limma with my arrays.
> It seems that one can fit patient as a fixed effect in order to limma
> compute paired t-tests with moderated denominators.

A paired t-test is the same as a two-way additive anova, in limma and also in traditional statistics.

> How to fit patient as a fixed effect? It would be by adding it in the
> phenotable.

Have you tried the code below and found it didn't work?  Trying it out and looking at the results
may help you to understand what's going on.

> tmp<-pData(eset)
> tmp<-cbind(tmp,TumorMetastasis=factor(c(0,1,0,1,0,1,0,1,0,1)))
> tmp<-cbind(tmp,BLOCKpaireddata=factor(c(1,1,2,2,3,3,4,4,5,5)))
> pData(eset)<-tmp
> and then
> design<-model.matrix(~TumorMetastasis*BLOCKpaireddata, data=pData(eset))

You need "+" not "*".  You would see that you need something different when you fit the model and
find that there are no degrees of freedom for residuals.

> fit<-lmFit(eset,design)
> contrast.matrix<-makeContrasts(Tumor_Metastasis,levels=design)

What is "Tumor_Metastasis", i.e., why the underscore "_"?  This function will give an error, so
you know it must be wrong.  Actually you don't need to use constrasts as all.  Just use

fit <- eBayes(fit)

and pick out the coefficient corresponding to the tumour effect.  Type


to see what the name of this coefficient is.  The corresponding t-statistic is the paired


> fit2<-contrasts.fit(fit,contrast.matrix)
> Thank you very much for your help,
> Best wishes,
> Pedro
> Pedro Jares, Ph.D.
> Genomics Unit, IDIBAPS
> University of Barcelona
> C/ Villarroel 170
> 08036, Barcelona, Spain
> Telf 93 2275400
> Ext. 2184 o 2129
> Fax 93 2275717

More information about the Bioconductor mailing list