[R] Presenting Hazard ratios for interacting variables in a Cox model

Stuart Patterson stuartjpatterson at googlemail.com
Fri Nov 18 15:56:18 CET 2016

I have a time-dependent cox model with three variables, each of which
interacts with the other two. So my final model is:

fit12<-coxph(formula = Surv(data$TimeIn, data$Timeout, data$Status) ~ data$
Year+data$Life_Stg+data$prev.tb +data$prev.tb*data$Life_Stg + data$Year*data
$Life_Stg + data$Year*data$prev.tb + frailty(data$Natal_Group), data = data)

For my variables, there are 3 categories of year, three of year, and
prev.tb is a binary variable. Because of the interactions, when I present
the results, I want to present the Hazard ratio, 95% CI, and p value for
each combination of the three variables. How do I get R to give me these
values please?

I think that the contrast function does this for other models but does not
work for coxph?

Grateful for any suggestions

Best wishes

Stuart Patterson, Royal Veterinary College, University of London

	[[alternative HTML version deleted]]

More information about the R-help mailing list