Dear R list, I need some help in extracting comparisons in the result of lme. I have a data set similar to the example data, Orthodont, using patient subject as a random effect and did something below: library(nlme) library(gregmisc) data(Orthodont) Orthodont$AgeGroup <- gtools::quantcut(Orthodont$age) fm2 <- lme(distance ~ AgeGroup + Sex + AgeGroup*Sex, data = Orthodont, random = ~1|Subject) fit.contrast(fm2, "Sex", c(-1,1), conf=0.95) fit.contrast(fm2, "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: ## 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 I'll greatly appreciate it if you may help! JP Jin Ph.D. Bioinformatics scientist Center for Bioinformatics UNC at Chapel Hill Chapel Hill, NC US [[alternative HTML version deleted]]