# [BioC] Paired samples and origin question, Limma

James W. MacDonald jmacdon at med.umich.edu
Thu May 11 15:45:41 CEST 2006

```Hi Morten,

Morten Mattingsdal wrote:
> Hello everyone,
>
> First: Im really sorry for posting this because Ive found several topics
> in the mail archive, but I cant seem to get any smarter.
>
> Backgound: I have 6 patients which cells have been divided into two
> groups: annexin positive and annexin negative, thus having 12 samples
> from 6 patients. In addition the 12 Affymetrix arrays have been produced
> at two differet labs. I want to correct for the variance introduced by
> the different labs and biological differences from the repsective
> patients. As I understand it I can use the block option in lmFit to
> correct for this.
>
> Do the following Limma code correct for the origin of the samples, and
> how can I add information that the samples are paired by patients ?
> Should I use an ANOVA model for this instead of a Limma linear model ?

Well, limma linear models _are_ ANOVA models. Any time you specify the
independent variables as factors (as you do in your model.matrix() call
below), you are by default doing ANOVA.

In your case, you have two blocking variables (lab and patient), so you
are going to have to handle the patient pairing by hand. Remember that a
paired t-test involves the difference of the pairs divided by the
standard error of that difference. If you pre-compute the differences
and then fit a model with just one factor level, but with blocks, then
you should get what you are looking for.

So, assuming that I deduced the pairs correctly from your code,

paired <- exprs(eset)[,1:6] - exprs(eset)[,7:12]
origin <- rep(1:2, each = 3)
dupcor <- duplicateCorrelation(paired, block = origin)
fit <- lmFit(paired, block = origin, correlation = dupcor\$cons)
fit2 <- eBayes(fit2)

If you don't specify a design matrix, you will by default get a vector
of ones, indicating that the samples are all the same and you are
testing to see if there is any difference between the mean of the
samples (in your case the paired differences) and zero, which is what a
paired t-test does.

>
> design <- model.matrix(~ -1+factor(c(1,1,1,1,1,1,2,2,2,2,2,2)))
> colnames(design)=c("positive","negative")
> origin=c(1,1,1,2,2,2,1,1,1,2,2,2)
> dupcor <- duplicateCorrelation(eset,design,block=origin)
> fit <- lmFit(eset,design,block=origin,correlation=dupcor\$consensus)
> contrast.matrix <- makeContrasts(positive-negative, levels=design)
> fit2 <- contrasts.fit(fit, contrast.matrix)
> fit2 <- eBayes(fit2)
>
> To sum up, I want to ask limma this: "Give me DE genes from Annexin
> positive vs Annexin negative after taking into account that the samples
> are paired patient and location wise"
>
> be gentle with me. Im only a biologist :)

This reminds me of a quote I heard concerning a local (foreign born) PI.
"Arrgh! Must I do all the thinking in this lab? I buy whip!!"

Let this be a warning to you ;-D

Best,

Jim

> morten
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

--
James W. MacDonald, M.S.
Biostatistician
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623

**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.

```

More information about the Bioconductor mailing list