# Define a SURVIVAL object
obj <- s_factory(s_exponential, lambda = 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, with hazard ratio 0.5
rsurvhr(SURVIVAL = obj, hr = 0.5)
# Plot the survival functions
plot(obj)
Run the code above in your browser using DataLab