I have set up several Cox proportional hazards models in R, and am using cox.zph from the survival package to test the proportional hazards assumption. Mostly this works well.

However, in a couple of cases running cox.zph(model) returns NA values for all covariates:

                   chisq df  p
variable_of_interest  NA  3 NA
GLOBAL                NA  3 NA

How should I interpret this? What could explain it?

More details

  • Example model set-up: coxph(Surv(age_entry, age_exit, event_status) ~ strata(sex) + variable_of_interest, my_data) (simplified from original but still recreates the problem)
  • If I adjust for, rather than stratify by, sex I no longer get NA values.
  • If I change the model to coxph(Surv(time_on_study, event_status) ~ strata(sex) + variable_of_interest, my_data) I no longer get NA values.
  • If I use only using particular subsets of the data, I sometimes no longer get NA values (but it doesn't seem quite as simple as a single problem row).
  • The models are in epidemiologic data with 50,000 - 90,000 rows and ~1,500 events.
  • I'm not familiar with all the aspects of the full cox.zph object, but with the models which output NA values, y seems to be entirely NaN, var is NaN, but everything else looks ok.
New contributor
r_epi is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • $\begingroup$ Your variable_of_interest seems to be 4-level categorical. Please edit your question to show the breakdown of that variable by sex in the overall data set and in a subset for which the model worked. Also, please triple check that all age_exit values are greater than the corresponding age_entry values. If cox.zph() can't get the scaled Schoenfeld residuals from the model (y values in the cox.zph object), there might be something wrong with the original model, too. Please summarize in your question the results of residuals() on the original coxph object for each residual type. $\endgroup$ – EdM 18 hours ago

Your Answer

r_epi is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.