coxph() ran out of iterations and did not converge Am relatively new in conducting survival analyses in R. I wanted to perform an univariate cox regression on my data set. For some of my variables this worked, but for the variable “white blood cell count” (WBCC) I got an warning message.
The data frame looks a bit like this (dummy data):
|sample_ID  | Age  |Gender |WBCC  |overallsurvival |status  | status_numeric|
------------|------|-------|------|----------------|--------|---------------|
|Id_001     | 30   | F     |30    | 335            | Alive  | 1             |
|Id_002     | 50   | M     |60    | 838            | Alive  | 1             |
|Id_003     | 36   | M     |35    | 462            | Dead   | 2             |
|Id_004     | 42   | F     |29    | 705            | Dead   | 2             |
|Id_005     | 28   | F     |65    | 633            | Alive  | 1             |

In reality I have a large cohort (>400 sample_IDs) for the analysis but when I want to perform the univariate cox regression on the WBCC (using the code below)  (R package survival):
cox.mod <- coxph( Surv(as.numeric(overallsurvival), status_numeric) ~ WBCC,
                     ties = 'breslow', data = df_tmp)

This code works for all the other variables I wanted to test, such as age and gender. However for the variable WBCC I get the following warning:
“In coxph.fit(X, Y, istrat, offset, init, control, weights = weights, ... : Ran out of iterations and did not converge”

I have checked some previous answers to "Ran out of iterations..." questions, but they do not solve/explain my warning message. I read it could be due to the fact that “"the actual MLE estimate of a coefficient is infinity" – but I don’t quite understand what that means…
Could someone explain to me why this warning is popping up?

Without seeing the data it's hard to say just what's going on. As this was a "warning" about the reported result rather than an "error" that prevented analysis you could try several approaches.
First, try increasing the number of iterations (iter.max) or playing with other settings in coxph.control(). It's possible that convergence is just unusually slow or you are bouncing back and forth among some solutions that are pretty close but don't quite meet the eps parameter requirement to stop the iteration.
Second, look carefully at the structure of your data with respect to the WBCC covariate. Look back at this page. It's possible to get this type of warning in different scenarios. I've typically gotten this warning when there are no cases with events for some categorical predictor value and there's an infinite coefficient estimate. It can, however, arise with particular combinations of censoring/event times and continuous predictor values. You'll notice that this answer shows you can get this type of warning with a continuous predictor even if the coefficient estimate is 0.
Third, move away from the single-predictor models.* They aren't very informative and can even be misleading, as Cox models can suffer from omitted-variable bias even when an omitted outcome-associated predictor isn't correlated with the included ones. I suspect that a Cox multiple regression with all of your predictors won't throw this error.

*It's best not to call single-predictor models "univariate" although that terminology is admittedly often used. The word "multivariate" is best reserved for models with multiple outcomes, such as competing-risk or multi-state survival models. A Cox multiple regression with your data would still be considered "univariate" as there is only one type of event.
