[R] Comparison of age categories using contrasts

Patrick Giraudoux patrick.giraudoux at univ-fcomte.fr
Mon Feb 16 05:22:32 CET 2009


Dear listers,

I would like to compare the levels of a factor with 8 age categories 
(0,10] (10,20] (20,30] (30,40] (40,50] (50,60] (60,70] (70,90] (however, 
the factor has not been ordered yet). The default in glm is 
cont.treatment (for unordered factors) and that leads to compare each 
level to the first one. I would rather prefer to compare the 2nd to the 
1st, the 3rd to the 2nd, the 4th to the 3rd, etc... My understanding is 
that cont.poly may make the trick, eg specified like this:

mod3<-glm(AE~agecat, family=binomial,data=qinghai2, 
contrasts=list(agecat="contr.poly"))

but I am not sure to be right.

Would be grateful if a true statistician can confirm or fire me... and 
before definitive fire tell me how to manage with this...




More information about the R-help mailing list