[R] Test-Predict R survival analysis

Terry Therneau therneau at mayo.edu
Wed Apr 18 14:56:14 CEST 2012

On 04/18/2012 05:00 AM, r-help-request at r-project.org wrote:
> Hi,
> I'm trying to use the R Survival analysis on a windows 7 system.
> The input data format is described at the end of this mail.
> 1/ I tried to perform a survival analysis including stratified variables
> using the following formula.
> cox.xtab_miR=coxph(Surv(time, status) ~ miR + strata(sex,nbligne, age),
> data=matrix)
> and obtain the following error message
> Warning message:
> In fitter(X, Y, strats, offset, init, control, weights = weights,  :
>     Ran out of iterations and did not converge
> Is this due to the model (error in formula) or is the number of
> stratified variables fixed?
The Cox model compares the deaths to the non-deaths, separately within 
each stratum, then adds up the result.

Your data set and model combination puts each subject into their own 
strata, so there is no one to compare them to.  The fit has no data to 
use and so must fail.  (I admit the error message is misleading, but I 
hadn't ever seen someone make this particular mistake before.)

The following model works much better

 > coxph(Surv(time, status) ~ miR + age + nbligne + strata(sex))
             coef exp(coef) se(coef)     z      p
miR     2.75e-05      1.00 9.35e-06 2.941 0.0033
age     3.39e-03      1.00 1.01e-02 0.334 0.7400
nbligne 7.14e-02      1.07 1.32e-01 0.542 0.5900

Likelihood ratio test=5.87  on 3 df, p=0.118  n= 70, number of events= 59
    (1 observation deleted due to missingness)

Terry Therneau

More information about the R-help mailing list