Baseline hazards

The hazard and the cumulative hazard functions play a crucial role in survival analysis. These functions define the likelihood function in the presence of censored observations. Thus, they are important in many contexts. For more information about these functions, see Short course on Parametric Survival Analysis.

In Julia, hazard and cumulative hazard functions can be fetched through the hazard(dist, t) and cumhazard(dist, t) functions from SurvivalDistributions.jl, and can be applied to any distribution compliant with Distributions.jl's API. Note that SurvivalDistributions.jl also contains a few more distributions relevant to survival analysis. See also the (deprecated) HazReg.jl Julia Package.

The baseline hazards commonly used with the model classes (and supported by the simulate function) include:

Here are a few plots of hazard and cumulative-hazard curves for some of these distributions:

using Distributions, Plots, StatsBase, SurvivalDistributions
function hazard_cumhazard_plot(dist, distname; tlims=(0,10))
      plt1 = plot(t -> hazard(dist, t),
            xlabel = "x", ylabel = "Hazard", title = "$distname distribution",
            xlims = tlims, xticks = tlims[1]:1:tlims[2], label = "",
            xtickfont = font(16, "Courier"), ytickfont = font(16, "Courier"),
            xguidefontsize=18, yguidefontsize=18, linewidth=3,
            linecolor = "blue")
      plt2 = plot(t -> cumhazard(dist, t),
            xlabel = "x", ylabel = "Cumulative Hazard", title = "$distname distribution",
            xlims = tlims, xticks = tlims[1]:1:tlims[2], label = "",
            xtickfont = font(16, "Courier"), ytickfont = font(16, "Courier"),
            xguidefontsize=18, yguidefontsize=18, linewidth=3,
            linecolor = "blue")
      return plot(plt1, plt2)
end
hazard_cumhazard_plot (generic function with 1 method)

LogNormal

hazard_cumhazard_plot(LogNormal(0.5, 1), "LogNormal")
Example block output

LogLogistic

hazard_cumhazard_plot(Distributions.LogLogistic(1, 0.5), "LogLogistic")
Example block output

Weibull

hazard_cumhazard_plot(Weibull(3, 0.5), "Weibull")
Example block output

Gamma

hazard_cumhazard_plot(Gamma(3, 0.5), "Gamma")
Example block output