[R] Categorical Variables and glm()

2009-01-23 Thread Stephen Collins
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@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.


Re: [R] Categorical Variables and glm()

2009-01-23 Thread Marc Schwartz
on 01/23/2009 11:10 AM Stephen Collins wrote:
 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? 

See ?relevel and the See Also's listed therein.

HTH,

Marc Schwartz

__
R-help@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.


Re: [R] Categorical Variables and glm()

2009-01-23 Thread Daniel Malter
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-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im
Auftrag von Stephen Collins
Gesendet: Friday, January 23, 2009 12:10 PM
An: r-h...@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@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.

__
R-help@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.