Coxph predictions don't match the coefficients

后端 未结 1 885
死守一世寂寞
死守一世寂寞 2021-01-24 07:55

Good afternoon,

I could post reproducible code and certainly will if everyone agrees that something is wrong, but right now I think my question is quite simple and someo

相关标签:
1条回答
  • 2021-01-24 08:47

    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.)

    0 讨论(0)
提交回复
热议问题