Coxph predictions don't match the coefficients

早过忘川 提交于 2019-12-02 04:04:12

The Details section in ?predict.coxph reads:

The Cox model is a relative risk model; predictions of type "linear predictor", "risk", and "terms" are all relative to the sample from which they came. By default, the reference value for each of these is the mean covariate within strata.

To illustrate what this means, we can look at a simple example. Some fake data:

test1 <- list(time=c(4,3,1,1,1), 
             status=c(1,1,1,0,0), 
             x=c(0,2,1,1,0)) 

We fit a model and view predictions:

fit <- coxph(Surv(time, status) ~ x, test1) 
predict(fit, type = "lp")
# [1] -0.6976630  1.0464945  0.1744157  0.1744157 -0.6976630

The predictions are the same as:

(test1$x - mean(test1$x)) * coef(fit)
# [1] -0.6976630  1.0464945  0.1744157  0.1744157 -0.6976630

(Using this logic and some arithmetic we can back out from your results that you have 8849 "trues" out of 9000 observations for your created_as_free_user variable.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!