search for: contr_mat

Displaying 1 result from an estimated 1 matches for "contr_mat".

2010 Aug 02
1
Specify contrasts in R
...iment)? 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...