Philippe Guardiola
2008-Aug-22 06:09 UTC
[R] Help on competing risk package cmprsk with time dependent covariate
Dear R users, I d like to assess the effect of "treatment" covariate on a disease relapse risk with the package cmprsk. However, the effect of this covariate on survival is time-dependent (assessed with cox.zph): no significant effect during the first year of follow-up, then after 1 year a favorable effect is observed on survival (step function might be the correct way to say that ?). For overall survival analysis I have used a time dependent Cox model which has confirmed this positive effect after 1 year. Now I m moving to disease relapse incidence and a similar time dependency seems to be present. what I d like to have is that: for patients without "treatment" the code for "treatment" covariate is always 0, and for patients who received "treatment" covariate I d like to have it = 0 during time interval 0 to 1 year, and equal to 1 after 1 year. Correct me if I m wrong in trying to do so. First, I have run the following script (R2.7.1 under XPpro) according to previous advices: library(cmprsk) attach(LAMrelapse) fit1<- crr(rel.t, rel.s, treatment, treatment, function(uft) cbind(ifelse(uft<=1,1,0),ifelse(uft>1,1,0)), failcode=1, cencode=0, na.action=na.omit, gtol-06, maxiter) fit1 where: rel.t = time to event (in years) rel.s = status , =1 if disease relapse, =2 if death from non disease related cause (toxicity of previous chemotherapy), =0 if alive & not in relapse treatment binary covariate (value: 0 or 1) representing the treatment to test (different from chemotherapy above, with no known toxicity) I have not yet added other covariates in the model. this script gave me the following result:> fit1 <- crr(relcmp.t, relcmp.s, treatment, treatment, function(uft) cbind(ifelse(uft <= 1, 1, 0), ifelse(uft > 1, 1, 0)), failcode = 1, cencode = 0,na.action = na.omit, gtol = 1e-006, maxiter = 10)> fit1convergence: TRUE coefficients: [1] -0.6808 0.7508 standard errors: [1] 0.2881 0.3644 two-sided p-values: [1] 0.018 0.039 ...That I dont understand at all since it looks like if "treatment" covariate had also a significant effect of the first period of time !? This is absolutely not the case. So I m surely wrong with a part of this script... cov2 and tf are pretty obscure for me in the help file of the package. I would really appreciate advices regarding these 2 "terms". I was thinking that I might changed : cbind(ifelse(uft <= 1, 1, 0), ifelse(uft > 1, 1, 0) into: cbind(ifelse(uft <= 1, 0, 1), ifelse(uft > 1, 1, 0) But since I only have one covariate (treatment) to test, shouldnt I only write the following: fit1<- crr(rel.t, rel.s, treatment, treatment, function(uft) ifelse(uft<=1,0,1)), failcode=1, cencode=0, na.action=na.omit, gtol-06, maxiter) which gives me :> fit1convergence: TRUE coefficients: [1] 0.06995 -0.75080 standard errors: [1] 0.2236 0.3644 two-sided p-values: [1] 0.750 0.039 which, if I understand things correctly (I m not sure at all !) confirms that before 1 year, the effect of "treatment" covariate is not significant, but is significant after 1 year of follow up. But there I m again not sure of the result I obtain... any help would be greatly appreciated with cov2 and tf thanks for if you have some time for this, Philippe Guardiola _____________________________________________________________________________ o.fr [[alternative HTML version deleted]]
Arthur Allignol
2008-Aug-22 09:53 UTC
[R] Help on competing risk package cmprsk with time dependent covariate
Hello, Something i don't understand in your question. Is treatment a time-dependent covariate? That is, do patients receive the treatment at the beginning of the study or later? cmprsk cannot handle time-dependent covariates. But if treatment is a baseline covariate, but has a time-varying effect (i.e. does the subdistribution hazard ratio varies with time?), your solution to assess that is weird, because you will transform your baseline covariate into a time-dependent one, thus considering all the patients to receive no treatment the first year. For sure, the treatment wont have any effect for the first year. To assess a time-varying effect on competing risks, i would either follow the cmprsk documentation, including an interaction with functions of time, or use the comp.risk function in the timereg package, which fits more flexible models for the cumulative incidence functions. Best regards, Arthur Allignol Philippe Guardiola wrote:> Dear R users, > > > I d like to assess the effect of "treatment" covariate on a disease relapse risk with the package cmprsk. > However, the effect of this covariate on survival is time-dependent > (assessed with cox.zph): no significant effect during the first year of follow-up, > then after 1 year a favorable effect is observed on survival (step > function might be the correct way to say that ?). > For overall survival analysis > I have used a time dependent Cox model which has confirmed this positive effect after > 1 year. > Now I m moving to disease relapse incidence and a similar time dependency seems to be present. > > what I d like to have is that: for > patients without "treatment" the code for "treatment" covariate is > always 0, and for patients who received "treatment" covariate I d like > to have it = 0 during time interval 0 to 1 year, and equal to 1 after 1 > year. Correct me if I m wrong in trying to do so. > > > First, I have run the following script (R2.7.1 under XPpro) according to previous advices: > > library(cmprsk) > attach(LAMrelapse) > fit1<- crr(rel.t, rel.s, treatment, treatment, function(uft) > cbind(ifelse(uft<=1,1,0),ifelse(uft>1,1,0)), failcode=1, > cencode=0, na.action=na.omit, gtol-06, maxiter) > fit1 > > where: > rel.t = time to event (in years) > rel.s = status , =1 if disease relapse, =2 if death from non disease > related cause (toxicity of previous chemotherapy), =0 if alive & > not in relapse > treatment > binary covariate (value: 0 or 1) representing the treatment to test > (different from chemotherapy above, with no known toxicity) > I have not yet added other covariates in the model. > > > this script gave me the following result: >> fit1 <- crr(relcmp.t, relcmp.s, treatment, treatment, function(uft) cbind(ifelse(uft <= 1, 1, 0), ifelse(uft > 1, 1, 0)), failcode = 1, cencode = 0, > na.action = na.omit, gtol = 1e-006, maxiter = 10) >> fit1 > convergence: TRUE > coefficients: > [1] -0.6808 0.7508 > standard errors: > [1] 0.2881 0.3644 > two-sided p-values: > [1] 0.018 0.039 > > ...That I dont understand at all since it looks like if "treatment" > covariate had also a significant effect of the first period of time !? > This is absolutely not the case. > So I m surely wrong with a part of this script... cov2 and tf are > pretty obscure for me in the help file of the package. I would really > appreciate advices regarding these 2 "terms". > > I was thinking that I might changed : cbind(ifelse(uft <= 1, 1, 0), ifelse(uft > 1, 1, 0) into: cbind(ifelse(uft <= 1, 0, 1), ifelse(uft > 1, 1, 0) > > But since I only have one covariate (treatment) to test, shouldnt I only write the following: > fit1<- crr(rel.t, > rel.s, treatment, treatment, function(uft) ifelse(uft<=1,0,1)), failcode=1, > cencode=0, na.action=na.omit, gtol-06, maxiter) > > which gives me : >> fit1 > convergence: TRUE > coefficients: > [1] 0.06995 -0.75080 > standard errors: > [1] 0.2236 0.3644 > two-sided p-values: > [1] 0.750 0.039 > > which, if I understand things > correctly (I m not sure at all !) confirms that before 1 year, the effect of "treatment" covariate is not > significant, but is significant after 1 year of follow up. But there I m again not sure of the result I obtain... > > any help would be greatly appreciated with cov2 and tf > > thanks for if you have some time for this, > > > Philippe Guardiola > > > _____________________________________________________________________________ > > o.fr > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org 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. >