[Rd] documentation for contrasts and contrasts<- (PR#607)

Prof Brian D Ripley ripley@stats.ox.ac.uk
Fri, 14 Jul 2000 07:28:07 +0100 (BST)


On Thu, 13 Jul 2000 Setzer.Woodrow@epamail.epa.gov wrote:

> 
> 
> The documentation (in ver 1.1) for contrasts and contrasts<- does not list all
> the arguments for those functions.  In addition to x, the factor whose contrasts
> are being extracted or set, contrasts() has the argument 'contrasts=TRUE', and
> contrasts<-() has the argument 'how.many'.

Thanks, I have written enhanced versions.

> 
> It was this latter that had me flummoxed, because I wanted to reparametrize a
> model by specifying a full-rank contrast matrix (fitting without an intercept).
> 
That happens automatically the intercept.  It can't be a `contrast matrix' 
though, as the contrasts do not span the full space (they are orthogonal
to the constant).  To continue the ?contrasts example, you can do

> contrasts(fff, 3) <- contr.sum(5)[,1:3]
> contrasts(fff) # treatment
  [,1] [,2] [,3] 
a    1    0    0
c    0    1    0
i    0    0    1
s    0    0    0
t   -1   -1   -1

to set three contrasts.  You cannot set 5, though, as you can't generate
them.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._