Skip to content

Dummy variables in Factors with more than 2 levels

3 messages · carlos ramirez, Martin Henry H. Stevens, Douglas Bates

#
By default, R uses the 'opposite' approach: the intercept is the mean  
of the first level, and the other parameters of the differences  
between the first level and that level. See ?contrasts
Hank
On May 21, 2008, at 5:59 AM, carlos ramirez wrote:
Dr. Hank Stevens, Associate Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/~stevenmh/
http://www.users.muohio.edu/harkesae/
http://www.cas.muohio.edu/ecology
http://www.muohio.edu/botany/
"E Pluribus Unum"

"I love deadlines. I love the whooshing noise they make as they go by."
                                             (Douglas Adams)


If you send an attachment, please try to send it in a format anyone  
can read, such as PDF, text, Open Document Format, HTML, or RTF.
Why? See:  http://www.gnu.org/philosophy/no-word-attachments.html
#
On Wed, May 21, 2008 at 5:16 AM, Martin Henry H. Stevens
<HStevens at muohio.edu> wrote:
In R the terminology is that variables expressed as factors
(categorical data) or ordered factors (ordered categorical data) are
converted to a set of contrasts when incorporated in a linear or
generalized linear model.  The default behavior is to use the
"treatment" contrasts.  You can set an option to use the "SAS"
contrasts where the last level is the reference level.  Try

options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")

then refit your model.