[R] Linear model - coefficients

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Jun 12 20:32:24 CEST 2011


?dummy.coef

(NB: 'R' does as you tell it, and if you ask for the default contrasts 
you get coefficients a2 and a3, not a1 and a2.  So perhaps you did 
something else and failed to tell us?  And see the comment in 
?dummy.coef about treatment contrasts.)


On Sun, 12 Jun 2011, Robert Ruser wrote:

> Dear R Users,
> Using lm() function with categorical variable R use contrasts. Let
> assume that I have one X independent variable with 3-levels. Because R
> estimate only 2 parameters ( e.g. a1, a2)  the coef function returns
> only 2 estimators. Is there any function or trick to get another a3
> values. I know that using contrast sum (?contr.sum) I could compute a3
> = -(a1+a2). But I have many independent categorical variables and I'm
> looking for a fast solution.
>
> Robert
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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