s_factory {survobj}R Documentation

Factory of objects of class SURVIVAL

Description

Create objects of the class SURVIVAL

Usage

s_factory(s_family, ...)

Arguments

s_family

a factory for a specific distribution

...

parameters to define the survival distribution

Details

The objects of the class SURVIVAL define different distributions of survival times. Each class has its own set of parameters but once the SURVIVAL object is defined, they have access to the same functions to calculate:

There several functions to plot the distributions

Value

a SURVIVAL object

Distributions

The current factories are implemented:

Examples

# 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)

[Package survobj version 3.1.0 Index]