In a COX model, i included an interaction item between A(continuous variate) and B(category variate),and the p value of A:B1 (reference to A:B2) was <0.05. Could i conclude that A and B have an interactive effect in the model, and how could i plot this interactive relation. Like the answer in Plotting smoothed hazard ratio intervals for interaction terms, but i have another 2 question, does the HR in the vertical coordinate have real meaning just like other survival analysis, when the HR was less than 1, it expresses a protect meaning and otherwise, a damaging meaning. Another question was that when i draw the interaction effect of A and B, how could i included some other variates just like a multivariates analysis ?
1 Answers
The discussion on the page to which you linked already has many useful suggestions for plotting the association of outcome with your continuous covariate separately for each of your levels of the categorical covariate B, or displaying the hazard ratio between levels of B as a function of your continuous covariate. A hazard ratio is simply a hazard ratio with the standard meaning. The only danger with the hazard ratio is keeping straight which level of the categorical predictor B is the reference level; the default choice of reference in R is not the same as in some other statistical software.
Those methods all depend on plotting results for some assumed set of values for the other covariates via some type of predict()
function. If you want to specify covariate values other than some "average" or "typical" values you simply specify them as part of what you provide to the predict()
function.
One thing that I have done in situations like this is to display sets of predicted survival curves, with error estimates, for informative combinations of covariate values. That would be particularly helpful if there are several different sets of covariates other than A and B that you would like to examine in this regard. That can be done either within single panels of a figure or with adjoining panels. For example, you could show a panel with B at its reference level next to a panel with B at its second level, with each panel separately showing particular corresponding choices of your continuous covariate A and other covariates of interest.
For implementation, consider using the rms
package in R. Some survival software uses "average" cases as the default for non-specified covariate values in predictions, sometimes even assuming an "average" among levels of a categorical predictor. If data are preprocessed with the datadist()
function in rms
and the output from datadist()
is specified as an option correctly, then the default choices for predictions will be typical values rather than such potentially meaningless average values. There is a learning curve to start with that package, but if you will be doing a lot of regression analyses (Cox or otherwise) it is worth the investment of time and effort.

- 57,766
- 7
- 66
- 187