Dear R-help,
I was comparing SAS (I do not know what version it is) and R (version
2.6.0 (2007-10-03) on Linux) survival analyses with time-dependent
covariates. The results differed significantly so I tried to understand
on a short example where I went wrong. The following example shows that
even when argument 'method' in R function coxph and argument 'ties' in
SAS procedure phreg are the same, the results of Cox regr. are
different. This seems to happen when there are ties in the
events/covariates times.
My question is what software, R or SAS, is more reliable for the
survival analysis with time-dependent covariates or if you could point
out a problem in the following example.
Example. SAS gives HR=3.236:
data trythis;
input id days timedeli stat;
datalines;
1 3 .5 1
2 1.5 1 1
3 6 1000 0
4 8 1000 1
5 8 1 0
6 21 1000 1
7 11 3 1
run;
proc phreg data=trythis;
model days*stat(0)=deli/risklimits ties=exact;
if timedeli>days then deli=0; else deli=1;
run;
Example (continued). R gives HR=3.91:
tmp = data.frame(id=c(1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 7), start=c(0.0,
0.5, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 3.0), end=c(0.5, 3.0,
1.0, 1.5, 6.0, 8.0, 1.0, 8.0, 21.0, 3.0, 11.0), delir=c(0, 1, 0,
1, 0, 0, 0, 1, 0, 0, 1), outcome=c(0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1))
tmp
surv = Surv(time=tmp$start, time2=tmp$end, tmp$outcome)
cphres = coxph(surv ~ tmp$delir, method="exact")
summary(cphres)[["coef"]]
After breaking a tie b/w an event and a time-dependent observation, R
gives the same result as SAS.
tmp$end[2]=tmp$end[2] + .1
tmp
surv = Surv(time=tmp$start, time2=tmp$end, tmp$outcome)
cphres = coxph(surv ~ tmp$delir, method="exact")
summary(cphres)[["coef"]]
Thank you so much for time,
Svetlana
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.