[R] convergence issues with coxph
Therneau, Terry M., Ph.D.
therneau at mayo.edu
Wed Mar 30 14:13:04 CEST 2016
Failure to converge in a coxph model is very rare. If the program does not make it in 20
iterations it likely will never converge, so your control argument will do little.
Without the data set I have no way to guess what is happening. My first question,
however, is to ask how many events you have, e.g. table(bca). I count 19 covariates on
the right hand side, and a good rule of thumb is that one should have at least 5- 10
endpoints per covariate for simple numerical stability and 10-20 for statistical
stability. That means 100-200 events. Most medical data sets have fewer than this. A
data set with 5000 rows and 4 death counts as "4" in this calculation by the way.
I am always interested in data sets that push the boundaries of the code and can look
deeper if you want to send me a copy. Details of how things are coded can matter, e.g.,
centered covariates. Otherwise there is little we can do.
Terry Therneau
On 03/30/2016 05:00 AM, r-help-request at r-project.org wrote:
> I am having convergence issues when I use coxph with a interaction term (glarg*bca_py) and interaction term with the restricted cubic spline (glarg*bca_time_ns). I use survival and spline package to create the Cox model and cubic splines respectively. Without the interaction term and/or spline, I have no convergence problem. I read some forums about changing the iterations and I have but it did not work. I was just wondering if I am using the inter.max and outer.max appropriately. I read the survival manual, other R-help and stackoverflow pages and it suggested changing the iterations but it doesn't specify what is the max I can go. I ran something similar in SAS and did not run into a convergence problem.
>
> This is my code:
>
> bca_time_ns <- ns(ins_ca$bca_py, knots=3, Boundary.knots=range(2,5,10))
> test <- ins_ca$glarg*ins_ca$bca_py
> test1 <- ins_ca$glarg*bca_time_ns
>
> coxit <- coxph.control(iter.max=10000, outer.max=10000)
>
> bca<-coxph(Surv(bca_py,bca) ~ glarg + test + test1 + age + calyr + diab_dur + hba1c + adm_met + adm_sulfo + adm_tzd + adm_oth +
> med_statin + med_aspirin + med_nsaids + bmi_cat + ccscat + alc + smk, data=ins_ca, control=coxit, ties=c("breslow"))
More information about the R-help
mailing list