[BioC] R: need help on

Manca Marco (PATH) m.manca at maastrichtuniversity.nl
Tue Oct 26 16:13:09 CEST 2010

Dear JP

I am temporarily unable to replay your example code on my workstation but it seems to me that you could simply give your contrasts to the function "lme" itself.

In fact, "lme" accept an argument "contrast" that is set by default as NULL but could be changed indicating any object fitting into the category of contrast argument as defined following:

contrasts.arg: A list, whose entries are values (numeric matrices or
          character strings naming functions) to be used as replacement
          values for the ‘contrasts’ replacement function and whose
          names are the names of columns of ‘data’ containing

Otherwise you could use the "contrasts.fit" function from limma instead of the "fit.contrast" (which I do not know by heart... to which package does it belong to? Maybe it is also accepting a matrix as input to the value "contrasts") which would accept a contrast.arg too:

> contrasts.fit(fit, contrasts=NULL, coefficients=NULL)

I'm quite not sure what do you mean for "comparison among males" though, as to me is not clear what are you supposed to use as a contrast within the variable "sex" when all the subjects have only one value and the patients' IDs have been modeled as random effects... maybe you'd rather want to subset your dataset by sex:

> Data<-Orthodont[Orthodont$Sex=="Male"]

and then produce a contrast matrix on some other variables (AgeGroup as instance?)

...but maybe I am going off since I haven't understood the purpose of the analysis.

I hope this helps you anyway. Good luck,

Marco Manca, MD
University of Maastricht
Faculty of Health, Medicine and Life Sciences (FHML)
Cardiovascular Research Institute (CARIM)

Mailing address: PO Box 616, 6200 MD Maastricht (The Netherlands)
Visiting address: Experimental Vascular Pathology group, Dept of Pathology - Room5.08,  Maastricht University Medical Center, P. Debyelaan 25, 6229  HX Maastricht

E-mail: m.manca at maastrichtuniversity.nl
Office telephone: +31(0)433874633
Personal mobile: +31(0)626441205
Twitter: @markomanka


This email and any files transmitted with it are confidential and solely for the use of the intended recipient.

It may contain material protected by privacy or attorney-client privilege. If you are not the intended recipient or the person responsible for

delivering to the intended recipient, be advised that you have received this email in error and that any use is STRICTLY PROHIBITED.

If you have received this email in error please notify us by telephone on +31626441205 Dr Marco MANCA

Da: bioconductor-bounces at stat.math.ethz.ch [bioconductor-bounces at stat.math.ethz.ch] per conto di Jin, Jp [jjin at email.unc.edu]
Inviato: martedì 26 ottobre 2010 15.40
A: bioconductor at stat.math.ethz.ch
Oggetto: [BioC] need help on

Dear statisticians of the list,

I am a limma user and have a small data set that I used the lme mixed effect model for analysis. I need some help in extracting comparisons from the result. I sent my questions to the R help list, but it appears that there is no people there care about the questions. I know my questions may not be related to this list, but if you would help could you please point me out what I can do or I should do something else? Your help will be greatly appreciated.

My data set is similar to the example data, Orthodont, and I used patient subject as a random effect and did something below:

Orthodont$AgeGroup <- gtools::quantcut(Orthodont$age)
fm <- lme(distance ~ AgeGroup + Sex + AgeGroup*Sex, data = Orthodont, random = ~1|Subject)
fit.contrast(fm, "Sex", c(-1,1), conf=0.95)
fit.contrast(fm, "AgeGroup", rbind("1 vs 2"=c(-1,1,0,0), "2 vs 3"=c(0,-1,1,0)), conf=0.95)

But how can I compare different age groups among Male, Female or between Male and Female as illustrated below (age groups on rows):

## comparison among Male
     Male Female
[1,]   -1      0
[2,]    1      0
[3,]    0      0
[4,]    0      0

## among Female
     Male Female
[1,]    0      0
[2,]    0     -1
[3,]    0      0
[4,]    0      1

## between Male and Female
     Male Female
[1,]   -1      0
[2,]    0      0
[3,]    0      0
[4,]    0      1

JP Jin Ph.D.
Bioinformatics scientist
Center for Bioinformatics
UNC at Chapel Hill
Chapel Hill, NC

        [[alternative HTML version deleted]]

Bioconductor mailing list
Bioconductor at stat.math.ethz.ch
Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

More information about the Bioconductor mailing list