Learn R Programming

bayesCureRateModel (version 1.5)

Surv: Create a Survival Object

Description

Create a survival object for use in survival analysis, as imported from the survival package.

Usage

Surv(time, time2, event, type = c("right", "left", "interval", 
	"counting", "interval2", "mstate"), origin = 0)

Value

An object of class "Surv" which is used as a response in survival models.

Arguments

time

The follow-up time. For counting process data, this is the start time.

time2

The end time for counting process or interval-censored data. Optional for right-censored data.

event

The event indicator, normally 0=alive/censored, 1=dead/event occurred. Can also be a factor or logical.

type

Type of censoring. Options are "right", "left", "interval", "counting", "interval2", or "mstate".

origin

Starting point for time scale. Default is 0. Only used for type "counting".

Details

The Surv function creates an object of class "Surv", which is used to represent survival data. Depending on the arguments, the object can represent different types of censoring.

  • Right-censoring: one time and event indicator.

  • Left-censoring: similar to right-censoring but event=1 for censored.

  • Interval-censoring: requires both time and time2.

  • Counting process: both time and time2 used to specify start and stop times.

The resulting object is used as a response in survival regression models and estimation functions.

References

Therneau T (2024). A Package for Survival Analysis in R. R package version 3.7-0, https://CRAN.R-project.org/package=survival.

See Also

cure_rate_MC3

Examples

Run this code
# Right-censored survival data
Surv(5, 1)
Surv(c(5, 10), c(1, 0))

Run the code above in your browser using DataLab