From p.dalgaard at biostat.ku.dk  Thu May  8 08:46:16 2003
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard BSA)
Date: Thu May  8 09:46:17 2003
Subject: [Rd] contrasts
In-Reply-To: <Pine.LNX.4.51.0305080913080.16342@artemis.imbe.med.uni-erlangen.de>
References: <Pine.LNX.4.44.0305071609340.5546-100000@gannet.stats>
	<Pine.LNX.4.51.0305080913080.16342@artemis.imbe.med.uni-erlangen.de>
Message-ID: <x2brydx4fb.fsf@biostat.ku.dk>

Torsten Hothorn <Torsten.Hothorn@rzmail.uni-erlangen.de> writes:

> > >From model.matrix, only the number of levels is passed: src/main/model.c
> > line 1626 (in R-devel and probably also 1.7.0).
> 
> Thank you! Therefore one cannot compute contrasts that depend on
> the number of observations at each level, right? Looking at the code in
> `contr.treatment' that handles this case: may I conclude that this is on
> the wishlist?

That's not what it does. It just allows you to give the vector of
levels instead of the count. At the moment, this seems to be used only
for labeling:

> contr.treatment(4:1)
  3 2 1
4 0 0 0
3 1 0 0
2 0 1 0
1 0 0 1

Notice that C() allows a matrix argument, so even if model.matrix
doesn't use this feature, you could still use y~C(g,contr.xxx(levs))
in modeling.

One place where something like this might be useful, but (one of my
ancient gripes) isn't, is for generating polynomial contrasts over a
non-equidistant level set. 

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


[Rd] contrasts
Peter Dalgaard BSA