[R] Cannot get contrasts to work with aov.

bbolker bolker at ufl.edu
Mon Sep 17 23:33:35 CEST 2007




ThatDeadDude wrote:
> 
> I have been trying for hours now to perform an orthogonal contrast through
> an ANOVA in R.   
> 
> I have done a two-factor factorial experiment, each factor having three
> levels.  I converted this dataset to a dataframe with one factor with nine
> treatments, as I couldn't work out what else to do.   
> I have set up a matrix with the eight orthogonal contrasts that I wish to
> perform, but despite having searched this mailing list's archives
> thoroughly, I cannot get it to work. 
> 
> I am looking to get output along the lines of 
>             Df  Sum Sq Mean Sq F value    Pr(>F)     
> trt1         1    X         X              X           X 
> trt2         1    X         X              X           X 
>  ............... 
> trt9         1    X         X              X           X 
> Residuals   27   495.1   18.3 
> 
>   [snippage]
> 
> Any responses would be greatly appreciated 
> Marc Burgess
> 

   I think instead of aov(model) you should try lm(model) and/or
summary(lm(model));
aov() is a special-purpose command that prints only the ANOVA table of a
linear model.
The other commands will print the parameter estimates, which is what you
want.

  I also don't see why you need to convert to a one-way layout: why not

lm(y~treat1*treat2)   ... ?

  good luck
    Ben Bolker
-- 
View this message in context: http://www.nabble.com/Cannot-get-contrasts-to-work-with-aov.-tf4449485.html#a12745636
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list