# Plot of hazard ratio for primary endpoint and continuous covariate

Good morning, I wonder if you could tell me the R code to use to obtain a graph similar to the one below. (from: https://www.nejm.org/doi/full/10.1056/NEJMoa1215740)

That is, I would like to graph the association between the hazard ratio of the primary endpoint (EVENT) VS a continuous covariate (VALUE).

My cox model is as follows: cox<- coxph(Surv(TIME, EVENT) ~ VALUE, data = EBB)

require(rms)

To have more control over the plot use the contrast function (full name contrast.rms) and plot its results as shown in the help file for contrast.rms.
• Anti-log of log relative hazard (you can easily plot the anti-log using an argument to Predict) is a hazard ratio. The HR is relative to the reference value for the covariate. Default in rms for a reference value is the median for most purposes. Nov 8 '21 at 15:52