# Re: [R] Explaining Survival difference between Stata and R

From: Thomas Lumley (tlumley@u.washington.edu)
Date: Thu 13 May 2004 - 00:27:50 EST

```Message-id: <Pine.A41.4.58.0405120716410.198264@homer07.u.washington.edu>

```

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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help