[R] using pre-calculated coefficients and LP in coxph()?

Dimitris Rizopoulos d.rizopoulos at erasmusmc.nl
Sun Mar 13 20:05:23 CET 2011


On 3/13/2011 7:43 PM, Ravi Varadhan wrote:
> Like David, I too thought that `offset' is the way to do this.  I was actually in the midst of testing the differences between using `offset' and `init' when David's email came.
>
> Here is what I could figure out so far:
>
> 1.  If you want to fix only a subset of regressors, but let others be estimated, then you must use `offset'.  The `init' approach will not work.
>

Yes, indeed, this is right.

> 2. Even when all the regressors are fixed (I have to admit that I do not see the point of this, like David said), there seems to be a difference in using `init' and `offset'.  First of all, we cannot interpret or use the standard errors, CIs, abd p-values when iter.max=0.  Secondly, there is major disagreement in the predictions between `offset' and `init' with no iterations. You can run the following code to verify this:
>

Of course, indeed, I don't know what Angel has in mind, but there are 
some cases where you might want to compute the hessian matrix at 
specific values using vcov() (local approximation of the likelihood for 
sensitivity analysis), and in this case the `offset' approach will not work.

> ans1<- coxph(Surv(time, status) ~ age + ph.karno, data = lung, init = c(0.05, -0.05), iter.max = 0)
> ans2<- coxph(Surv(time, status) ~ offset(0.05*age) + offset(-0.05*ph.karno), data = lung)
>
> lp1<- predict(ans1, type="lp")
> lp2<- predict(ans2, type="lp")
>
> all.equal(lp1, lp2)
>> all.equal(lp1, lp2)
> [1] "Mean relative difference: 1.463598"
>

in fact both are the same, only in the first one they are centered, e.g.,

ans1$linear.predictors
ans2$linear.predictors - mean(ans2$linear.predictors)

> The results from `offset' are correct, i.e. lp2 can be readily verified to be equal to 0.05 * (age - ph.karno).  I don't know how lp1 is computed.
>
> Ravi.
> ____________________________________________________________________
>
> Ravi Varadhan, Ph.D.
> Assistant Professor,
> Division of Geriatric Medicine and Gerontology
> School of Medicine
> Johns Hopkins University
>
> Ph. (410) 502-2619
> email: rvaradhan at jhmi.edu
>
>
> ----- Original Message -----
> From: David Winsemius<dwinsemius at comcast.net>
> Date: Sunday, March 13, 2011 2:29 pm
> Subject: Re: [R] using pre-calculated coefficients and LP in coxph()?
> To: Dimitris Rizopoulos<d.rizopoulos at erasmusmc.nl>
> Cc: r-help at r-project.org, Angel Russo<angerusso1980 at gmail.com>
>
>
>>   On Mar 13, 2011, at 1:32 PM, Dimitris Rizopoulos wrote:
>>
>>   >probably you want to use the 'init' argument and 'iter.max'
>> control-argument of coxph(). For example, for the Lung dataset, we fix
>> the coefficients of age and ph.karno at 0.05 and -0.05, respectively:
>>   >
>>   >library(survival)
>>   >
>>   >coxph(Surv(time, status) ~ age + ph.karno, data = lung,
>>   >    init = c(0.05, -0.05), iter.max = 0)
>>
>>   >
>>   >
>>   >I hope it helps.
>>   >
>>   >Best,
>>   >Dimitris
>>   >
>>   >
>>   >On 3/13/2011 6:08 PM, Angel Russo wrote:
>>   >>I need to force a coxph() function in R to use a pre-calculated set
>> of beta
>>   >>coefficients of a gene signature consisting of xx genes and the gene
>>   >>expression is also provided of those xx genes.
>>
>>   I would have guessed (and that is all one can do without an example
>> and better description of what the setting and goal might be) that the
>> use of the offset capablity in coxph might be needed.
>>
>>   --
>>   David.
>>   >>
>>   >>If I try to use "coxph()" function in R using just the gene
>> expression data
>>   >>alone, the beta coefficients and coxph$linear.predictors will
>> change and I
>>   >>need to use the pre-calcuated linear predictor not re-computed
>> using coxph()
>>   >>function. The reason is I need to compute a quantity that uses as
>> it's input
>>   >>the coxph() output but I need this output to be pre-calculated
>>   >>beta-coefficients and linear.predictor.
>>   >>
>>   >>Any one can show me how to do this in R?
>>   >>
>>   >>Thanks a lot.
>>
>>   David Winsemius, MD
>>   West Hartford, CT
>>
>>   ______________________________________________
>>   R-help at r-project.org mailing list
>>
>>   PLEASE do read the posting guide
>>   and provide commented, minimal, self-contained, reproducible code.
>

-- 
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014
Web: http://www.erasmusmc.nl/biostatistiek/



More information about the R-help mailing list