[R] Explaining Survival difference between Stata and R

Thomas Lumley tlumley at u.washington.edu
Wed May 12 16:27:50 CEST 2004


On Wed, 12 May 2004, [iso-8859-1] Göran Broström wrote:

>
> Is it the data? Let's try 'coxreg' (eha):
> ---------------------------------------------------------------
> Call:
> coxreg(formula = Surv(yrs2, ratify) ~ haz.wst + pol.free, data = dat)
>
> Covariate           Mean       Coef        RR       Wald p
> haz.wst           2054901     0.000     1.000        0.372
> pol.free            2.090     0.009     1.009        0.958
>
> Events                    21
> Total time at risk            78
> Max. log. likelihood      -45.001
> LR test statistic         0.76
> Degrees of freedom        2
> Overall p-value           0.684583
> ----------------------------------------------------------------
>
> This worked just fine (Paul, same results as in Stata?). But, we
> seem to have a scaling problem; lok at the means of the covariates!

Yes.

> Some rescaling gives:
> ----------------------------------------------------------------
> Call:
> coxph(formula = Surv(yrs2, ratify) ~ I(haz.wst * 1e-06) + pol.free,
>     data = dat)
>
>
>                       coef exp(coef) se(coef)      z    p
> I(haz.wst * 1e-06) 0.08479      1.09    0.095 0.8920 0.37
> pol.free           0.00896      1.01    0.170 0.0526 0.96
>
> Likelihood ratio test=0.76  on 2 df, p=0.685  n= 21
> ----------------------------------------------------------------
> and now 'coxph' gets the same results as 'coxreg'. I don't know about coxph
> for sure, but I do know that coxreg centers all covariates before the NR
> procedure starts. Maybe we also should rescale to unit variance? And of
> course scale back the coefficients and se:s at the end?

That would make sense.  coxph does center, but it doesn't scale.


	-thomas




More information about the R-help mailing list