I am quite new in the spline subject and I have a question!
I am using a Cox model and I was afraid that some of the variables included in the model have a non-linear effect on survival.
So I tested each variable for its linear effect using the rcsfunction from the rmspackage with 3 knots.
This was very easy. The knots are located at pre-specified quantiles.
Then, I was doing a graph of Predict(fitted model, tested covariate). And if the variable was not too twisted on the graph, I was considering that the use of spline was not necessary in this case.
My suspervisor recommanded me to also make a likelihood test with each variable in the following way:
fit0 <- coxph(Surv(time, status) ~ age, data = stanford2)
fit1 <- coxph(Surv(time, status) ~ pspline(age, df = 3), data = stanford2)
pred1 <- predict(fit1, type="terms", se=TRUE)
anova(fit0, fit1)
I noticed he used pspline rather that rcs. And I wanted to use rcs also for the likelihood tests he suggested.
Question
Can we consider that rcs(..,knots = 3) can be used in a equivalent manner to pspline(..., df = 3)in my case ? Or one of the two methods should be preferred for the graphs and likelihood tests ?
Thanks a lot for your help :-)