I am trying to analyse a dataset (veteran, in package survival in R) with survival analysis. I found the function cph in package rms, which seems like different to coxph. What is the difference between these two functions?
Also, in this example,
model1<-cph(with(data=veteran,Surv(time,status)~rcs(age,4)+trt),x=TRUE,y=TRUE)
what's does rcs(age,4) mean?
Thanks for your help.
RCS = restricted cubic spline. You can find the function's help file by looking at
help(package="rms")Here's an excerpt of the source code, so you can see where the
cphfunction calls thecoxph.fitfunction (the guts ofcoxphin thesurvivalpackage)Both
cphandcoxphgive the same results as far as coefficients:But you can see that the authors of the
cphfunction have added some extra components to the results to fit their needs. Thuscphwill be useful if you need one of those extra features, but otherwise,coxphwill do just fine.