Dear all,
I was wondering if anyone can help? I am an R user but recently I have resorted to SAS to calculate the probability of the event (and the associated confidence interval) for the Cox model with combinations of risk factors. For example, suppose I have a Cox model with two binary variables, one for gender and one for treatment, I wish to calculate the probability of survival for the combinations of 1s and 0s for both variables. In SAS the following code would be used.
I have used the code below to obtain the survival estimates (at 1 year) and confidence intervals for combinations of risk factors for my outcome.
/* Combinations of Risk Factors */
data test2;
input sex treat;
DATALINES;
0 0
1 0
0 1
1 1
;
run;
/* Survival estimates for the above combinations */
proc phreg data = pudat2;
model withtime*wcens(0) = sex treat /ties = efron;
baseline out = surv2 survival = survival lower = slower upper = supper
covariates = test2 /method = ch nomean cltype=loglog;
run;
/* Survival estimates at 1 year */
proc print data = surv2 noobs;
where withtime = 364;
run;
I now would like to do the same thing but in a competing risks setting (cumulative incidence rather than Cox model version (crr from cmprsk in R) however there is no pre-set routine for this in SAS. I am therefore keen to use R to obtain the survival estimates for both the overall outcome and the competing risks outcomes.
Can anyone help me to translate the SAS code above into R code so that I can check I am doing things correctly? I am using R version 2.9.2 on Windows XP Professional.
I think it would begin as follows:
library(cmprsk)
fit1 <- coxph(Surv(withtime,wcens)~ sex+treat,data=pudat2)
my.fit <- survift(fit1)
summary(my.fit)
Unfortunately, the estimates shown do not match those of SAS.
Additionally, can you use survfit with crr? If not, any suggestions as to how I may obtain the necessary estimates in a competing risks setting?
Thank you for any help you can give.
Laura
[[alternative HTML version deleted]]