[R] parameterization of factor in R

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Dec 27 20:58:45 CET 2005


?contr.sum

And Chapter 6 of MASS would have explained all this to you, so if you have 
further questions please consult it.

On Tue, 27 Dec 2005, Oana Mocila wrote:

> I encountered this problem with parameterization in R:
>
> I have two factors in a regression. how about if I want to
> set constraint so that for each factor, the sum of their
> coefficients equals to zero(instead of choosing a reference
> category)? for example, I have factor(variable) A(with three
> categories) and factor(variable) B(with 4 categories), and I want
> to parameterize so that the sum of the three coefficients of
> A = 0, and sum of the four coefficients of B = 0? I
> mean how to do it in R?

-- 
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