[R] Categorical Variables and glm()

Daniel Malter daniel at umd.edu
Fri Jan 23 18:26:48 CET 2009


Hi,

contrasts(yourvariablename)=contr.treatment(levels(yourvariablename),base=3)


3 is the number of the category that you want to be your baseline. Replace
accordingly.

Cheers,
Daniel


-------------------------
cuncta stricte discussurus
-------------------------

-----Ursprüngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im
Auftrag von Stephen Collins
Gesendet: Friday, January 23, 2009 12:10 PM
An: r-help at stat.math.ethz.ch
Betreff: [R] Categorical Variables and glm()

When including categorical variables in a regression, the default in R is to
set the first level as the base.  Is there an option to specify a different
level as the base? 

Regards, 
 
Stephen Collins, MPP | Analyst
Health & Benefits | Aon Consulting

	[[alternative HTML version deleted]]

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




More information about the R-help mailing list