[R] ANOVA model

Douglas Bates bates at stat.wisc.edu
Thu Apr 21 18:28:10 CEST 2005


Street N.R. wrote:
> Hi,
> 
> Could someone tell me if this is the correct model syntax for the
> following dataset:
> 
> lme(height~treatment+genotype+treatment*genotype,drought,random=~genotyp
> e)
> 
> The dataset has two factors: one fixed - treatment, and one random -
> genotype. I need to test the effect of both factors to identify their
> significance. There are multiple (but not equal) replicates at each
> level of genotype (the replicates are independent biological samples).
> 
> What I need are the p values for genotype, treatment and their
> interaction. It is the specification of the random factor that I am
> unsure of.
> 
> Also, does anyone know if biologists 'expect' to see type I or type III
> SS results presented in a standard (i.e. non statistical) journal
> article?

I'm not sure exactly what you want but the syntax you have given won't 
work.  If you say that you want a fixed effect for treatment plus random 
effects for genotype and for the treatment:genotype interaction then I 
would write the model as

lme(height ~ treatment, drought, random = list(genotype = ~ treatment - 1))

or, from the lme4 package,

lmer(height ~ treatment + (treatment - 1 | genotype), drought)

How many levels of treatment do you have?  If you have k levels you will 
end up estimating (k * (k + 1))/2 variance-covariance parameters for the 
random effects.  This is not difficult for a small value of k but larger 
k would produce a problem.

I'm not even going to start discussing Type I and Type III sums of 
squares again.  There has been an active thread on that topic for the 
last several days.  Please refer to the archives.




More information about the R-help mailing list