0

I am trying to run a Cox proportional hazard model to determine the effects of covariates on the survival of neonates. Previously when I ran coxph with numeric Predictor Variables, I had a result.

# Create a survival object using age and event variables
surv_data <- Surv(research$Q220N, research$QEVENT)
# Fit the Cox proportional hazards regression model with a specified ties argument
cox_model <- coxph(surv_data ~ Q405 + Q414 + Q420 + Q426B + Q430 + Q433A, data = research, ties = "exact")

Warning message:
In coxph.fit(X, Y, istrat, offset, init, control, weights = weights,  :
  Ran out of iterations and did not converge

I tried fitting the model with one variable at a time. Just to identify the variable causing the error. I have 365 observation and initially I was considering 10 predictor variables. Can the sample size be the problem?

toyota Supra
  • 3,181
  • 4
  • 15
  • 19
  • Please read [1](https://stackoverflow.com/help/how-to-ask) how do I ask a good question and [2](https://stackoverflow.com/help/minimal-reproducible-example) or [3](https://stackoverflow.com/a/5963610/5784831) how to provide a minimal reproducible example in R. Then we can help you. – Christoph Aug 08 '23 at 13:44
  • Please provide enough code so others can better understand or reproduce the problem. – Community Aug 08 '23 at 15:26
  • read `?coxph.control`. As an additional comment, you should probably NOT construct `Surv` objects outside the `coxph` call. Much better to just use the column names in a `Surv` call within the formula. Then the environment for evaluation is much clearer. This is not something I made up. It is straight from the words of Terry Therneau. – IRTFM Aug 11 '23 at 23:54

0 Answers0