[R] Question about design matrix

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jan 26 20:34:35 CET 2004


On Mon, 26 Jan 2004, Yongwan Chun wrote:

> Now, I am working with some design matrices. My problem is to set
> "contrasts" option. Now I want to use "contr.sum" as the option, and it
> works properly. However, this option sets the last element of a factor
> as -1. For example, if I have a factor which has 5 elements and want to
> use the "contr.sum" option, the 5th elements is always set to -1. I want
> set -1 to other element such as 1st or 2nd. Is it possible? 

Yes, just recode the factor so the level you want is the last one.
Or, write your own contrast function to replace contr.sum.

-- 
Brian D. Ripley,                  ripley at 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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list