[R] Prediction in Cox Proportional-Hazard Regression

Giuseppe.Palermo@bo.infn.it Giuseppe.Palermo at bo.infn.it
Thu Jun 9 12:13:46 CEST 2005


Quoting Prof Brian Ripley <ripley at stats.ox.ac.uk>:

> On Thu, 9 Jun 2005 Giuseppe.Palermo at bo.infn.it wrote:
>
>> He,
>> I used the "coxph" function, with four covariates.
>>
>> Let's say something like that
>>
>>> model.1 <- coxph(Surv(Time,Event)~X1+X2+X3+X4,data=DATA)
>>
>> So I obtain the 4 coefficients B1,B2,B3,B4 such that
>>
>> h(t) = h0(t) exp(B1*X1+ B2*X2 + B3*X3 + B4*X4).
>>
>> When I use the function on the same data
>>
>>> predict.coxph(model.1,type="lp")
>
> How does that work?  predict.coxph is not an exported function!
>
>> how it works in making the prediction?
>> I mean which is the formula, given the data-point 
>> P1=[X1(1),X2(1),X3(1),X4(1)],
>> that the function "predict.coxph" use to make the prediction of P1.
>
> From the code (getAnywhere("predict.coxph"))
>
>     if (type == "lp" || type == "risk") {
>         if (missing(newdata)) {
>             pred <- object$linear.predictors
>             names(pred) <- names(object$residuals)
>         }
>         else pred <- x %*% coef + offset
> ...
>
> so that is the formula it uses.  As you did not supply 'newdata', it 
> quotes the 'linear.predictors' component of the fit: see 
> ?coxph.object.
>
> Effectively it centred the explanatory variables on their means and 
> then applied the linear regression formula to give the linear 
> predictor. It is the centring that may be non-obvious: effectively 
> h_0(t), the baseline hazard, is taken at the average of the subjects.
>

Dear Prof. Ripley
Thanks for replying to me email.
I only have an other question:

since h(t) = h0(t) exp(B1*X1+ B2*X2 + B3*X3 + B4*X4)
represent the hazard at time t.

In a linear prediction,
what     Value = B1*(X1-mean(X1)) + B2*(X2-mean(X2)) + ....
represent?

> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>




More information about the R-help mailing list