[R] problem with se.contrast()

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Feb 21 03:29:55 CET 2005


Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:

> >> test.aov <- with(testdata,aov(Measurement ~ Material + Error(Lab/Material)))
> >> se.contrast(test.aov,
> >>             list(Material=="A",Material=="B",Material=="C",Material=="D"),
> >>             coef=c(0.5,0.5,-0.5,-0.5),data=testdata)
> >> [1] 0.1432572
> >
> > I got a different result and I have admit that I didn't understand why
> > there is a differnce between the lme model and this one. There are some
> > comments in the help pages but I'm not sure if this is the answer.
> 
> It is.  You used the default `constrasts', which are not actually
> contrasts.  With
> 
> options(contrasts=c("contr.helmert", "contr.poly"))
> 
> it gives the same answer as the other two.  Because you used
> non-contrasts there was an efficiency loss (to the Intercept stratum).

Brian, 

I'm not sure how useful that contrasts-that-are-not-contrasts line is.
It certainly depends on your definition of "contrasts". Contrast
matrices having zero column sums was not part of the definition I was
taught. I have contrasts as "representations of the group mean
structure that are invariant to changes of the overall level", so
treatment contrasts are perfectly good contrasts in my book. 

The zero-sum condition strikes me as a bit arbitrary: after all there
are perfectly nice orthogonal designs where some levels of a factor
occur more frequently than others. This in turn makes me a bit wary of
what is going on inside se.contrasts, but it's gotten too late for me
to actually study the code tonight.

Could you elaborate on where precisely the condition on the contrast
matrices comes into play?

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list