create_cycloSurv {cyclomort} | R Documentation |
Create a cycloSurv object
Description
cycloSurv
is a superclass of Surv
, the standard data type for
survival analysis in R, with an additional period attribute necessary for
estimating periodic hazard functions.
Usage
create_cycloSurv(start, end, event, t0 = NULL, period, timeunits = "days")
Arguments
start |
a vector measuring time an individual enters a population (can be POSIX, numeric, or Date) |
end |
a vector measuring time an individual leaves a population, e.g. via death (or other precipitation event of interest) or censoring. (as a POSIXct, numeric, or Date) |
event |
the status indicator, normally 0=alive/censored, 1=dead. |
t0 |
reference time for event times. By default, |
period |
length of one period in the input data |
timeunits |
units that dates are inputted in if dates are being used |
Value
an object of class cycloSurv
which is identical to and
compatible with a 'Surv
object, with, however, an addition "period"
attribute.
Examples
startTimes = as.Date(origin = "2010-01-01",
c(0, 0, 0, 50, 0, 50, 100, 150, 0, 100)) #in days
endTimes = as.Date(origin = "2010-01-01",
c(50, 50, 100, 150, 150, 200, 200, 250, 350, 500)) #in days
censored = c(1, 1, 0, 1, 1, 0, 1, 0, 0, 0)
period = 365
morts = create_cycloSurv(start = startTimes, end = endTimes,
event = censored, period = period)