[R] Setting the desired reference category with contr.sum

autarkie kovla123 at hotmail.com
Fri Oct 5 14:01:47 CEST 2012


Hi,

I have 6 career types, represented as a factor in R, coded from 1 to 6. I
need to use the effect coding (also known as deviation coding) which is
normally done by contr.sum, e.g. 

contrasts(career) <- contr.sum(6)

However, this results in the 6th category being the reference, that is being
coded as -1: 

$contrasts
  [,1] [,2] [,3] [,4] [,5]
1    1    0    0    0    0
2    0    1    0    0    0
3    0    0    1    0    0
4    0    0    0    1    0
5    0    0    0    0    1
6   -1   -1   -1   -1   -1

In fact, I need number 1 to be the reference. How do I achieve that? Thank
you. 

Regards,
Maxim



--
View this message in context: http://r.789695.n4.nabble.com/Setting-the-desired-reference-category-with-contr-sum-tp4645150.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list