[R] Confusion about coxph and Helmert contrasts

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Mar 3 09:57:34 CET 2004


christianlederer at t-online.de (Christian Lederer) writes:

> Hi,
> 
> perhaps this is a stupid question, but i need some help about
> Helmert contrasts in the Cox model.
> 
> 
> I have a survival data frame with an unordered factor `group'
> with levels 0 ... 5.
> Calculating the Cox model with Helmert contrasts, i expected that
> the first coefficient would be the same as if i had used treatment
> contrasts, but this is not true.
> I this a error in reasoning, or is it possible, that both contrasts use
> a different ordering of the levels?
> I am confused about the fact, that coefficients for different levels
> are calculated, depending on weather i include level 0 or not:
> 
> If level 0 is included, with both contrasts coxph calculates
> coefficients for group 1 ... group 5.
> But if i exclude level 0, coxph calculates coeffficients for
> group 2 ... 5 with treatment and coefficients for group 1 ... 4 using
> helmert:
.....
> A am absolutely confused; any help is welcome.

You are not the first... Probably the best way of becoming less
confused is to look at the contrast matrices:


> contr.treatment(5)
  2 3 4 5
1 0 0 0 0
2 1 0 0 0
3 0 1 0 0
4 0 0 1 0
5 0 0 0 1
> contr.helmert(5)
  [,1] [,2] [,3] [,4]
1   -1   -1   -1   -1
2    1   -1   -1   -1
3    0    2   -1   -1
4    0    0    3   -1
5    0    0    0    4

These give the coefficient matrices for mapping from regression
coefficients to individual group levels (determined up to an additive
constant of course). Staring long enough at these you'll realize
that the first treatment contrast is the difference between gr1 and
gr2 but the first Helmert contr. is *half* that difference, etc. 

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list