I am examining seedling survival using Cox PH Regression in the Survival package in R. The survival of individual plants from 9 species have been tracked biannually for several years. Most simply, I want to 1) compare survival rates and hazard ratios between species, and later, 2) perform multivariate, mixed effect analysis based on various treatments, traits, and plots. When I run the cox model I find that my basic models do not meeting model assumptions (proportional hazards assumption). I am curious if my problem is because I need a time-dependent interaction, or if it is something simple such as data or model formatting .
My data looks like this and a subset my data is pasted further down in my post. (SpCode: species, Time: months, Event: 0 = live, 1 = dead, Assessment: assessment period, 1 = first, 6 = last):
> head(myData)
SpCode Time Event Assessment
1 A 28 0 6
2 B 28 0 6
3 B 28 0 6
4 A 28 0 6
5 C 28 0 6
6 D 28 0 6
Here is my code to run these models
myCPH <- coxph(Surv(Time, Event) ~ SpCode, data = myData) #runs model
summary(myCPH) #examine output - hazard ratios (expressed as exp(coef)) actually makes sense relative to reference species "A"
cox.zph(myCPH) # test proportionality assumption, should not be significant
I have experimented with including a time-dependent interaction but am wondering if I am applying it correctly?:
myTDCPH <- coxph(Surv(Time, Event) ~ SpCode*Assessment, data = myData).
Here I have used SpCode*Assessment as my interaction since Time cannot be on both the left and right sides of the formula. This approach doesn't meet model assumptions and the summary output makes even less sense. Moreover I get the following warning
Warning message: In fitter(X, Y, istrat, offset, init, control, weights = weights, : Ran out of iterations and did not converge
Here is a Dropbox link to some example data. I have included a large, 1000 individual subset of dummy data (~10% of total dataset) since I don't seem to get this error when I run this on a small dataset (<200 individuals)
In summary, my questions for the forum are
- Most importantly, how can I meet model assumptions given my data? Is my time-dependent interaction formatted correctly?
- Any chance my
SpCodecovariate (which contains 9 factors) could be causing a problem? - Should my data be formatted differently? I have seen the
survival objectformatted as(TimeStart, TimeEnd, Event), but I haven't had success when I try this.
Thank you
