Dear Listers, Could anyone advise if this is the 'correct' contrast matrix to use to make contrasts between one treatment and the mean of 2 other treatments (in this case, mid-parent values to the F1 and F2 from a line cross experiment)? Desired contrasts are 1) P1 versus P2 2) average of P1 and P2 versus F1 3) average of P1 and P2 versus F2 levels(MyData$Type) "P1", "F1", "F2","P2" (I have renamed these A, B, C, D in the actual data so they appear in the order above) Contrast matrix: contr_mat<-cbind( c(1,0,0,-1), c(-1,2,0,-1), c(-1,0,2,-1))
contrasts(MyData$Type)<-contr_mat Model: mod<-lm(Trait~Type,data=MyData) Also, I would ideally like to run this in lme with a random effect for Block mod2<-lme(Trait~Type,random=~1|Block,data=MyData) Each treatment appears once in each block (ie balanced). Is there any problem using this contrast set-up in a mixed model? I am not sure how the 'block' effect would be interpreted for the mid-parent values, or indeed if it is sensible to include it as a random effect. Thank you in advance for your help, Rebecca Ross University of Oxford [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.