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:


> options(contrasts = c("contr.treatment", "contr.poly"))
> cox.t <- coxph(Surv(time,cens) ~ as.factor(group), data=data)
> options(contrasts = c("contr.helmert", "contr.poly"))
> cox.h <- coxph(Surv(time,cens) ~ as.factor(group), data=data)
> cox.t$coefficients
as.factor(group)1 as.factor(group)2 as.factor(group)3 as.factor(group)4
       -0.4301351         0.2078431        -0.0694138         0.3442058
as.factor(group)5
        0.1368716
> cox.h$coefficients
as.factor(group)1 as.factor(group)2 as.factor(group)3 as.factor(group)4
     -0.215067529       0.140970216       0.001170877       0.083426449
as.factor(group)5
      0.021061935

> data <- data[data$group > 0,]
> options(contrasts = c("contr.treatment", "contr.poly"))
> cox.t <- coxph(Surv(time,cens) ~ as.factor(group), data=data)
> options(contrasts = c("contr.helmert", "contr.poly"))
> cox.h <- coxph(Surv(time,cens) ~ as.factor(group), data=data)
> cox.t$coefficients
as.factor(group)2 as.factor(group)3 as.factor(group)4 as.factor(group)5
        0.6399999         0.3612753         0.7762236         0.5688559
> cox.h$coefficients
as.factor(group)1 as.factor(group)2 as.factor(group)3 as.factor(group)4
       0.31999997        0.01375844        0.11061629        0.02489624

A am absolutely confused; any help is welcome.

Christian :-)

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to