Skip to content
Prev 314074 / 398506 Next

how to control the naming of factors in regression

The '.L', ..., '^6' are the column names from the output contr.poly(),
the default contrasts function for ordered factors.  You can define
your own contrasts function that calls contr.poly() and renames the
columns to something you like, then set options("contrasts") so your
contrasts function is used for ordered factors.
Call:
lm(formula = y ~ x, data = d)

Coefficients:
(Intercept)     xDegree1     xDegree2     xDegree3     xDegree4     xDegree5  
    10.5000       1.3148       1.3093       0.4472      -1.1339       0.7559  

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com