Skip to contents

For use with non-proportional hazards models (survextrap(...,nonprop=TRUE)). Intended as a quick check of a model fit, so there are limited customisation options. The underlying data can be extracted with hazard_ratio.


  newdata = NULL,
  t = NULL,
  tmax = NULL,
  niter = NULL,
  ci = TRUE,
  xlab = "Time",
  ylab = "Hazard ratio",
  line_size = 1.5,
  ci_alpha = 0.2



A fitted model object as returned by survextrap


A data frame with two rows. The hazard ratio will be defined as hazard(second row) divided by hazard(first row). If the only covariate in the model is a factor with two levels, then newdata defaults to a data frame containing the levels of this factor, so that the hazard ratio for the second level versus the first level is computed. For any other models, newdata must be supplied explicitly.


Vector of times at which to compute the estimates.


Maximum time at which to compute the estimates. If t is supplied, then this is ignored. If t is not supplied, then t is set to a set of 100 equally spaced time points from 0 to tmax. If both tmax and t are not supplied, then tmax is set to the maximum follow up time in the data.


Number of MCMC iterations to use to compute credible intervals. Set to a low value to make this function quicker, at the cost of some approximation error (which may not be important for plotting or model development).


If TRUE then credible intervals are drawn. Defaults to drawing the intervals if the plot shows the curve for only one covariate value.


X-axis label


Y-axis label


Passed to geom_line


Transparency for the credible interval ribbons