[R] Contrasts within ANOVA frame (Repost)
mark_difford at yahoo.co.uk
Thu Aug 20 10:24:24 CEST 2009
>> I have three levels for a factor names "StdLot" and want to make three
>> comparisons, 1 vs 2, 1 vs 3 and 2 vs 3.
With only three levels to your factor, the contrast matrix you are
specifying is over-parametrized (i.e. over-specified): it has 3 rows and 3
## Look at the default behaviour
contrasts(d3$StdLot) <- NULL
contrasts(d3$StdLot) <- contr.helmert
I think what you really want are linear contrasts, which you will find in
package car (?linear.hypothesis), in gmodels (?estimable) [based on Frank
Harrell's approach; so look at his package Design], and package multcomp,
Jun Shen-3 wrote:
> Would like to try my luck to see if I can catch your eyes.
> I was trying to do some contrasts within ANOVA. I searched the archive and
> found a clue posted by Steffen Katzner
> ( http://tolstoy.newcastle.edu.au/R/help/06/01/19385.html)
> I have three levels for a factor names "StdLot" and want to make three
> comparisons, 1 vs 2, 1 vs 3 and 2 vs 3.
> contrasts(d3$StdLot,3)<-matrix(c(1,-1, 0,0,1,-1,1,0,-1),3,3) #d3 is the
> data set. set up the contrast matrix
> summary(mod.aov,split=list(StdLot=list('1 vs 2'=1,'2 vs 3'=2,'1 vs 3'=3)))
> #comparison summary
> Here is the final result I got, the third comparison is missing. Does
> have any idea what is wrong here? If I change the order of the comparisons
> it's always the third one missing. So I guess it's not due to the data.
> Appreciate any comment.
> Df Sum Sq Mean Sq F value Pr(>F)
> StdLot 2 1.905 0.953 10.3769 3.710e-05 ***
> StdLot: 1 vs 2 1 0.223 0.223 2.4239 0.1200
> StdLot: 2 vs 3 1 1.683 1.683 18.3299 2.162e-05 ***
> StdLot: 1 vs 3 1
> Residuals 601 55.173 0.092
> Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
> 2 observations deleted due to missingness
> Jun Shen PhD
> PK/PD Scientist
> BioPharma Services
> Millipore Corporation
> 15 Research Park Dr.
> St Charles, MO 63304
> Direct: 636-720-1589
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
View this message in context: http://www.nabble.com/Contrasts-within-ANOVA-frame-%28Repost%29-tp25052361p25057955.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help