'How to present results of restricted cubic splines in a cox regression

I have used the 'rms' package to use restricted cubic splines in my cox regression model.

Example of my univariate code

S_HTN<-Surv(data_HTN$time+data_HTN$age, data_HTN$event_HTN)
htn_dd<-datadist(data_HTN)
option(datadist='htn_dd')
HTN_spline<-cph(S_HTN~rcs(centiles,3), data=data_HTN)

I have plotted these via ggplot fine but what I want to know if I can see where the knots are and then use these in other analyses?

r


Solution 1:[1]

You can access the formula of your fitted model along with the knot locations by using the function Function(), i.e. Function(HTN_spline).

However, you can also adjust knot locations manually, with x, y and z being your three desired knots:

HTN_spline <- cph(S_HTN ~ rms::rcs(centiles, c(x, y, z)), data=data_HTN)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gnueghoidune