Error in adding interaction in Cox model?

I'm doing a survival analysis and after plotting the Schoenfeld residuals and test the significance of the correlation of residuals with time, I've decided to incorporate a interaction in the model. It makes sense since the variable outcome have a varying effect over time, for those who defaulted the previous episode, the probability to have another episode is much quicker than for those who completed the previous episode.

I've tried to add an interaction but this is a bit confusing and leads to a numerical singularity.

modf <- coxph(Surv(time, status) ~ Vac + CliForm + Sit + Prison + HIV + age + Sit:time, data2)

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

However using this also gave the same error:

modf <- coxph(Surv(ini, end, status) ~ Vac + CliForm + Sit + Prison + HIV + age + Sit:end, data2)

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

Another option is to separate the time in two:

data4$statusCured <- ifelse(data4$time >= 250, data4$status, 0) data4$statusDef <- ifelse(data4$time < 250, data4$status, 0)
summary(coxph(Surv(time, statusDef) ~ Vac + CliForm + Sit + Prison + HIV + age, data4))
summary(coxph(Surv(time, statusCured) ~ Vac + CliForm + Sit + Prison + HIV + age, data4))


My main question is what is the best approach to this problem? How should I include an interaction in my model? In the case that the variable outcome has a variation with time.

Any pointers would be extremely helpful.

• In your model, the response (time) appears on the right hand side. So you are trying to predict time with time... – Michael M Jun 26 '14 at 17:24
• Perhaps, I'm doing things wrong. The variable Sit has a time-varying coefficient. Therefore, the idea was to include an interaction between Sit and time into the model. I've seen in some places over the internet that it is possible to include an interaction with time (it seems although that I have to use the end variable). However, I must be doing something wrong since it is not working. – psoares Jun 26 '14 at 19:23