# How to get convergence using coxph (R) given that model converges using proc phreg (SAS)

I have a data set

> head(data)
id centre        u      time event x c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14
1      1 0.729891 0.3300478     1 0  1  0  0  0  0  0  0  0  0   0   0   0   0   0
2      1 0.729891 7.0100000     0 0  1  0  0  0  0  0  0  0  0   0   0   0   0   0
3      1 0.729891 7.0150000     0 1  1  0  0  0  0  0  0  0  0   0   0   0   0   0
4      1 0.729891 1.3616940     1 0  1  0  0  0  0  0  0  0  0   0   0   0   0   0
5      1 0.729891 7.0250000     0 0  1  0  0  0  0  0  0  0  0   0   0   0   0   0
6      1 0.729891 5.0824055     1 0  1  0  0  0  0  0  0  0  0   0   0   0   0   0


and I want to fit a proportional hazards model.

IN R

I first defined formula:

> formula
Surv(time, event) ~ x + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 +
c9 + c10 + c11 + c12 + c13 + c14


and I used the coxph function:

> library(survival)
> mod <- coxph(formula, data=data)
Erreur dans fitter(X, Y, strats, offset, init, control, weights = weights,  :
NA/NaN/Inf dans un appel à une fonction externe (argument 6)
De plus : Message d'avis :
In fitter(X, Y, strats, offset, init, control, weights = weights,  :
Ran out of iterations and did not converge


IN SAS

I used proc phreg:

proc phreg data=data;
model time*event(0) = x c1-c14 / ties=breslow;
run;


Partial output:

                      Convergence Status

Convergence criterion (GCONV=1E-8) satisfied.


### Question:

• Do you have any suggestion to make it work in R?

I have tried to increase iter.max but the problem is still there... If needed, I can provide the data (600 rows).

-
What about changing of the starting values? Supply to init similar values to the output of SAS and see what happens. –  mpiktas May 6 '11 at 8:31
@mpiktas: Thank you very much !!! It works ! I did not realize that the default initial value is zero for all variables in R. On the other hand, I have still to investigate what are the initial values in SAS. Again, Thank you very much !!! –  ocram May 6 '11 at 9:08
glad to be helpful :) Note this is a dirty cheat, since you use other software package to provide starting values, which is not feasible in the long run. But when debugging this is a first thing to try. –  mpiktas May 6 '11 at 9:23
@mpiktas Now, please, put this as an answer so that @ocram can accept it :-) –  chl May 6 '11 at 12:02

What about changing of the starting values? Supply to init similar values to the output of SAS and see what happens. This in general is not a good strategy to get the convergence, but it helps to see whether the problem is in algorithm, or just in starting values.