gencens: gencens function

View source: R/spatsurvMisc.R

gencensR Documentation

gencens function

Description

A function to generate observed times given a vector of true survival times and a vector of censoring times. Used in the simulation of survival data.

Usage

gencens(survtimes, censtimes, type = "right")

Arguments

survtimes

a vector of survival times

censtimes

a vector of censoring times for left or right censored data, 2-column matrix of censoring times for interval censoring (number of rows equal to the number of observations).

type

the type of censoring to generate can be 'right' (default), 'left' or 'interval'

Value

an object of class 'Surv', the censoring indicator is equal to 1 if the event is uncensored and 0 otherwise for right/left censored data, or for interval censored data, the indicator is 0 uncensored, 1 right censored, 2 left censored, or 3 interval censored.


spatsurv documentation built on Oct. 19, 2023, 9:07 a.m.