[Rd] contrasts
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Thu May 8 08:46:16 MEST 2003
Torsten Hothorn <Torsten.Hothorn at 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 at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-devel
mailing list