Hi, Sorry not to provide R-code in my previous mail. R code is below
#install.packages("rms") require(rms) #install.packages("mstate") library(mstate) require(splines) library(ggplot2) library(survival) library(splines) #install.packages("survsim") require(survsim) set.seed(10) df<-crisk.sim(n=500, foltime=10, dist.ev=rep("lnorm",2), anc.ev=c(1.48,0.53),beta0.ev = c(3.80,2.54), dist.cens = "lnorm", anc.cens = 3.5, beta0.cens = 5.42, z=NULL, beta = list(c(0.21, 0.017), c(0.37, 0.016)), x=list(c("normal",0,1), c("bern",0.564)), nsit=2) table(status) table(cause) df$cause<-ifelse(is.na(df$cause),0,df$cause) table(df$cause) df.w<-crprep("time","cause", data=df, trans=c(1,2), cens=0, id="nid", keep=c("x", "x.1")) with(df.w,table(failcode,status)) ddist<-datadist(df.w) options(datadist='ddist') mod<-cph(Surv(Tstart,Tstop,status==1)~rcs(x,3)+x.1,data=df.w, weight=weight.cens, subset=failcode==1, x=T, y=T, surv=T, time.inc = 2.5) mod2<-cph(Surv(Tstart,Tstop,status==1)~(x.1+rcs(x,3))^2,data=df.w, weight=weight.cens, subset=failcode==1, x=T, y=T, surv=T, time.inc = 2.5) mod2 ########################## To develop nomogram surv<-Survival(mod) nom.sur<-nomogram(mod,fun=list(function(x) 1-surv(3,x), function(x) 1-surv(5,x), function(x) 1-surv(7,x), function(x) 1-surv(9,x)), funlabel=c("3-year event 1 Prob.", "5-year event 1 Prob.", "7-year event 1 Prob.", "9-year event 1 Prob."), lp=T) #plot(nom.sur, fun.side=list(rep(1,8), c(1,1,1,3,1,3,1,3,1,3,1,3,1,3,1),rep(1,10),rep(1,12))x) plot(nom.sur) #plot(nom.sur, fun.side=list(rep(1,8),c(1,1,1,3,1,3,1,3,1,3,1,3,1,3,1))) #plot(nom.sur, fun.side=list(rep(1,10), c(1,1,1,1,3,1,3,1,3,1,3,1,3,1,3,1), rep(1,10), rep(1,10))) #table(status) ########################### #or f <- psm(S ~ ...) pa <- 'polspline'%in% row.names(installed.packages()) if(pa) { cal <- calibrate(mod, u=2.5, m=20, B=20) # cmethod= ' hare ' plot(cal) } #################################### # validate v<-validate(mod, method='boot', B=5) v #################################### #################################### # Calibration set.seed(717) cal<-calibrate(mod, method="boot", u=1, B=120, pr=FALSE, force=NULL, estimates=TRUE, bw=FALSE, aics=0, what="observed-predicted", tol=1e-12, maxdim=5) plot(cal, subtitles=FALSE) plot(cal) cal.km <- calibrate(mod, u=1, cmethod='KM', m=10, B=10, pr=FALSE) plot(cal.km) cal.hare = calibrate(mod, u=1, cmethod='hare', m=20, B=20) plot(cal.hare) ##################################### Regards Amalraj From: Raja, Dr. Edwin Amalraj Sent: 16 February 2018 10:37 To: 'r-help@r-project.org' <r-help@r-project.org> Subject: Competing risks - calibration curve Dear R users, I am new to R and wanted to apply competing risk methods in my research work. I used the R code given by Zhang et al in his paper 'Nomogram for survival analysis in the presence of competing risks published in Ann Trans Med 2017:5(20):403. I am struggling with getting calibration curve thro' internal validation. I am happy to receive suggestion in the coding as well as any reference Can someone help with it? Regards Amalraj Raja University of Aberdeen The University of Aberdeen is a charity registered in Scotland, No SC013683. Tha Oilthigh Obar Dheathain na charthannas cl?raichte ann an Alba, ?ir. SC013683. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.