The duke of hazard

[This article was first published on R | Gianluca Baio, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

More changes to survHE. Earlier this week, I gave a talk at the Virtual Ispor US conference (our panel was W11). In preparation for the panel (and other things I was doing anyway), I got to talk to colleagues and thought a bit more of how survival modelling in HTA is kind of weird and “special”…

In particular, I realised how survHE doesn’t give by default any real information about the hazard and the cumulative hazard functions — this isn’t entirely true, because once the survival curve has been estimated (which is the whole point of survHE!) then \(h(t)\) and \(H(t)\) can be derived analytically in many cases, or at least numerically.

But I had not planned for a graphical representation of these two functions, which in fact is not really good practice, because they can be very helpful in understanding the model, particularly in the extrapolation portion (more on this here and in the NICE guidelines, among other places).

So, I’ve changed the code on the devel branch of the survHE GitHub repository so that the plot function now has an extra option what, which allows the user to choose whether the graph should depict \(S(t)\), \(h(t)\) or \(H(t)\).

library(survHE)
# Fits a simple model to the built-in dataset, using a Weibull distribution
m=fit.models(Surv(time,censored)~as.factor(arm),data,"wei")
# Plots the survival curve
plot(m)

# Plots the hazard curve
plot(m,what="hazard")

# Plots the cumulative hazard curve
plot(m,what="cumhazard")

The hazard curve is approximated by computing numerically the derivative of the cumulative hazard function.

To leave a comment for the author, please follow the link and comment on their blog: R | Gianluca Baio.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)