[R] Convergence issues when using ns splines (pkg: spline) in Cox model (coxph) even when changing coxph.control

Jennifer Wu, Miss jennifer.wu2 at mail.mcgill.ca
Tue Mar 29 22:47:35 CEST 2016


I am currently using R v3.2.3 and on Windows 10 OS 64Bit.

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"))

This is the error message I get:

Warning message:
In fitter(X, Y, strats, offset, init, control, weights = weights,  :
  Ran out of iterations and did not converge

	[[alternative HTML version deleted]]

More information about the R-help mailing list