首页 > 解决方案 > How to apply time transformation to a factor variable in cph( ) function

问题描述

Hi I'm currently trying to fit a cox regression model but when I run the cox.zph() function, my p value is constantly smaller than 0.05 with the Delay variable being a major issue. It is a binary factor variable (0 or 1) describing whether a patient had early (0) or delayed (1) treatment. So from what I read on how to deal with this issue I tried to apply the tt() function to the Delay variable as such:

cox.death <- cph(Surv(diff, event)~tt(Delay)+rcs(age,3)+female+rcs(hba1c,3)+rcs(bmi,3)+rcs(egfr,3)+rcs(sbp,3),
                   data=cox.model, x = T, y = T)

But then I get this error message: Error in tt(Delay) : could not find function "tt" I'm not quite familiar with the rms package but is there any solution to this problem? Thanks!

标签: rsurvival-analysiscox-regressionrms

解决方案


推荐阅读