Re: [R] Prediction in Cox Proportional-Hazard Regression

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu 09 Jun 2005 - 20:19:41 EST

On Thu, 9 Jun 2005 Giuseppe.Palermo@bo.infn.it wrote:

> Quoting Prof Brian Ripley <ripley@stats.ox.ac.uk>:
>
>> On Thu, 9 Jun 2005 Giuseppe.Palermo@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?

The linear predictor, as you asked for.

-- 
Brian D. Ripley,                  ripley@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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Jun 09 20:45:23 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:27 EST