Nomogram with time-dependent cox model

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Nomogram with time-dependent cox model

Hi R users,
I encounter a problem that I failed to produce nomogram of a time-dependent Cox survival model.

The simplified R code is as the follows:
fit <- cph(Surv(Start, Stop, Event) ~ x1 + x2 + x3,
           x = TRUE, y = TRUE, surv = TRUE)

So far it works well, I can get the parameter estimates accurately.

Then I try to generate a nomogram:

med  <- Quantile(fit)
surv <- Survival(fit)  # This would also work if f was from cph
nom <- nomogram(fit, fun=list(function(x) surv(180, x),
                              function(x) surv(365, x),
                              function(x) surv(1095, x)),
       = c(.001, .05, .2,seq(0,1,by=.2),.8,.9, .95, .99),
                funlabel=c("6-month Survival",
                           "1-Year Survival",
                           "3-Year Survival"),
                lp=FALSE, vnames = "labels")
plot(nom,xfrac=.25, naxes=10)

I get an error message as the follows:
Error in approx(fu[s], xseq[s], fat, ties = mean) :
  need at least two non-NA values to interpolate
Error in plot(nom, xfrac = 0.25, naxes = 10) : object 'nom' not found

How do I successfully to obtain a nomogram of such a time-dependent Cox survival model?

In addition, I also failed to get a “calibration” plot in this time-dependent Cox survival model, the R code is:
cal <- calibrate (fit, B=20 , u=439)

I get an error message as the follows:
Error in polspline::hare(S[, 1], S[, 2], fun(curtail(est.surv)), maxdim = maxdim,  :
  not enough data
In addition: Warning messages:
1: In datadist(survival) : survival is constant
2: In Surv(y[, 1], y[, 2]) : Invalid status value, converted to NA

Error in plot(cal) : object 'cal' not found

Thanks for your help.