Learn R Programming

Introduction to the survobj Package

by John Aponte

Introduction

This package defines a set of classes that encapsulate survival distributions

The objects of the class SURVIVAL encapsulate 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:

  • survival time function: sfx(),

  • hazard time function: hfx(),

  • cumulative hazard function: Cum_Hfx()

  • the inverse of the cumulative hazard function: invCum_Hfx().

  • generate random survival times: rsurv()

  • generate random survival times under proportional hazard ratio: rsurvhr().

  • generate random survival times under accelerated failure : rsuvrvaft()

  • generate random survival times under accelerate hazard: rsurvah()

There are several functions to plot the distributions

  • generic S3: plot.SURVIVAL()

  • plot_survival(): to plot the functions

  • ggplot_survival_random(): to ggplot random draws from the distribution

  • ggplot_survival_hr(): to ggplot random draws from the distribution using hazard ratio

  • ggplot_survival_aft(): to ggplot random draws from the distribution using accelerated time failure

  • ggplot_survival_ah(): to ggplot random draws from the distribution using accelerated hazard

  • compare_survival(): to graphically compare the functions of two SURVIVAL objects

Distributions

The current factories are implemented:

  • s_exponential(): for Exponential distributions

  • s_weibull(): for Weibull distributions

  • s_gompertz(): for Gompertz distributions

  • s_piecewise(): for Piecewise exponential distributions

  • s_loglogistic(): for Log Logistic distributions

  • s_lognormal(): for Log Normal distributions

See the vignettes for examples on the use on simulation of survival data.

Installation

To install the development version of this package from github use:

devtools::install_github("johnaponte/survobj", build_manual = T, build_vignettes = T)

For more information:

https://johnaponte.github.io/survobj/

Copy Link

Version

Install

install.packages('survobj')

Monthly Downloads

149

Version

3.1.1

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Aponte John

Last Published

August 16th, 2024

Functions in survobj (3.1.1)

s_exponential

Factory of SURVIVAL objects with Exponential distributions
fx_h_time

Functions to help in time conversion
is_single_number

Confirm is a single number
s_factory

Factory of objects of class SURVIVAL
s_gompertz

Factory of SURVIVAL objects with Gompertz distributions
nhpp

Generate random recurrent episodes under a non homogeneous Poisson process
s_loglogistic

Factory of SURVIVAL objects with Log Logistic distributions
censor_event

Censor of events
sfx

Functions for SURVIVAL objects
renewal

Generate random recurrent episodes under a renewal Poisson process
s_lognormal

Factory of SURVIVAL objects with Log Normal distributions
s_piecewise

Factory of SURVIVAL objects with Piecewise Exponential distributions
s_weibull

Factory of SURVIVAL objects with Weibull distributions
survobj-package

survobj: Objects to Simulate Survival Times