[R] Variable centring within "predict.coxph"
L.J.Bonnett at liverpool.ac.uk
Fri Mar 2 14:38:43 CET 2018
I am using R-3.3.2 on Windows 10. I teach on a course which has 4 computer practical sessions related to the development and validation of clinical prediction models. These are currently written for Stata and I am in the process of writing them for use in R too (as I far prefer R to Stata!)
I notice that predictions made from a Cox model in Stata are based on un-centred variables, while they are based on centred variables in R. I am aware that variable centring is the preferred approach to ensure sensible predictions from models and thus usually I am pleased that variable centring is automatically applied within coxph in R. However, for the sake of producing identical results across the software packages, is there a way to produce predictions from a Cox model in R without variable centring?
I am using the 'survival' package as follows (for example):
test1 <- list(time=c(4,3,1,1,2,2,3),
mod1 <- coxph(Surv(time, status) ~ x + sex, test1)
[This can of course be alternatively obtained from mod1$linear.predictor]
Many thanks for your assistance.
[[alternative HTML version deleted]]
More information about the R-help