[R] Preferable contrasts?
Frank E Harrell Jr
fharrell at virginia.edu
Thu Nov 7 17:23:32 CET 2002
On Thu, 7 Nov 2002 10:36:50 +0100
"Grathwohl,Dominik,LAUSANNE,NRC/NT" <dominik.grathwohl at rdls.nestle.com> wrote:
> Dear all,
>
> I'm working with Cox-regression, because data could be censored.
> But in this particular case not.
> Now I have a simple example: PRO and PRE are (0,1) coded.
> The response is not normal distributed.
> We are interested in a model which could describe interaction.
> But my results are depending strongly in the choose of the contrast option.
> It is clear that there is some dependence in the contrasts, but in this
> simple case
> I could get the vice versa effect.
> My R output:
>
> > options(contrasts = c(unordered = "contr.treatment", ordered =
> "contr.poly"))
> > summary(coxph(Surv(ILOG, alive) ~ factor(PRO)*factor(PRE)))
> ...
> coef exp(coef) se(coef) z p
> factor(PRO)1 0.6576 1.930 0.302 2.177 0.029
> factor(PRE)1 0.0681 1.070 0.304 0.224 0.820
> factor(PRO)1:factor(PRE)1 -0.7703 0.463 0.431 -1.789 0.074
> ...
> > options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly"))
> > summary(coxph(Surv(ILOG, alive) ~ factor(PRO)*factor(PRE)))
> ...
> coef exp(coef) se(coef) z p
> factor(PRO)0 0.113 1.119 0.304 0.370 0.710
> factor(PRE)0 0.702 2.018 0.299 2.350 0.019
> factor(PRO)0:factor(PRE)0 -0.770 0.463 0.431 -1.789 0.074
> ...
>
> What would the experts recommend?
>
> Kind regards,
>
> Dominik
>
> Dominik Grathwohl
> Biostatistician
> Nestlé Research Center
> PO Box 44, CH-1000 Lausanne 26
> Phone: + 41 21 785 8034
> Fax: + 41 21 785 8556
> e-mail: dominik.grathwohl at rdls.nestle.com
Think of what you want to estimate. I like to think of differences in predicted values (or the anti-log of such differences, i.e., hazard ratios). To make estimates independent of all coding decisions I wrote contrast.Design for the Design library. Here is an example:
library(Design) # from http://hesweb1.med.virginia.edu/biostat/s/Design.html
f <- cph(Surv(dtime,event) ~ PRO*PRE)
# make PRO and PRE factors in the data frame
contrast(f, list(PRO='somevalue',PRE='somevalue'),
list(PRO='someothervalue',PRE='someothervalue'))
The contrast compares predicted values for the two pairs of settings of (PRE,PRO).
Frank
--
Frank E Harrell Jr Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine http://hesweb1.med.virginia.edu/biostat
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list