I noticed slight differences in the predicted probabilities between coxph and cph Function, and the difference increases as the time increases. I set parameters to be the same and even obtained similar coefficient estimates. I noticed there was a similar question but, in my case, I set specific covariates in both functions.
Here are the codes from both functions:
From the coxph function:
S_t <- coxph(Surv(time = Y, event = d) ~ ns(age)+ns(psa)+tstage+deyo+gs+insurance+income+education+race, ties="breslow", data = data)
S_t_pred.obj <- survfit(S_t, stype=1, newdata=X, se.fit = FALSE)
S_t_pred.sum <- summary(S_t_pred.obj, times=c(3.452538, 9.724030, 131.384242, 150.000000), extend = TRUE)$surv
t(S_t_pred.sum[,1:5])
3.452538 9.724030 131.384242 150.000000
1 0.9930111 0.9720974 0.1174563 1.462549e-68
2 0.9975552 0.9901719 0.4735629 2.113293e-24
3 0.9966625 0.9866011 0.3602773 4.624577e-33
4 0.9969770 0.9878579 0.3967149 5.207450e-30
5 0.9957809 0.9830846 0.2749658 1.276493e-41
From the cph function:
S_t1 <- cph(Surv(time = Y, event = d) ~ ns(age)+ns(psa)+tstage+deyo+gs+insurance+income+education+race, method="breslow", data = data, surv=T)
S_t_pred.sum1 <- survest(S_t1, stype=1, times=c(3.452538, 9.724030, 131.384242, 150.000000), newdata=X, se.fit = FALSE, extend = TRUE)$surv
S_t_pred.sum1[1:5,]
3.452538 9.724030 131.384242 150.000000
1 0.9930182 0.9652215 0.1183159 0.0001055417
2 0.9975577 0.9877219 0.4747697 0.0409388941
3 0.9966659 0.9832685 0.3615318 0.0127198369
4 0.9969801 0.9848355 0.3979659 0.0192029730
5 0.9957852 0.9788867 0.2761774 0.0040062571
Is this difference due to some numerical approximations? I would greatly appreciate any insights or guidance on why these differences may be occurring. Thank you for your time.