#' # Define a SURVIVAL object
obj <- s_factory(s_weibull, surv = 0.8, t = 2, shape = 1.2)
# Survival, Hazard and Cumulative hazard at time 0.4
sfx(SURVIVAL = obj, t= 0.4)
hfx(SURVIVAL = obj, t = 0.4)
Cum_Hfx(SURVIVAL = obj, t = 0.4)
# Time when the Cumulative hazard is 0.8
invCum_Hfx(SURVIVAL = obj, H = 0.8)
# Draw one random survival time from the distribution
rsurv(SURVIVAL = obj, n = 1)
# Draw one random survival time from the distribution under Proportional
# hazard, Accelerated time failure or Accelerated hazard.
rsurvhr(SURVIVAL = obj, hr = 0.5)
rsurvaft(SURVIVAL = obj, aft = 2)
rsurvah(SURVIVAL = obj, aft = 2, hr = 0.5)
# Plot the survival functions
plot_survival(SURVIVAL = obj, timeto = 2, main = "Example of Weibull distribution" )
Run the code above in your browser using DataLab