Surv(time, event)
or
Surv(time, time2, event, type=, origin=0)
is.Surv(x)
time
, 2=left censored, 3=interval censored.
Although unu(start, end]
.
For counting process data,
event
indicates whether an event o"right"
, "left"
, "counting"
, "interval"
, or "interval2"
.
The default is "right"
or "counting"
Surv
. There are methods for print
, is.na
, and
subscripting survival objects. To include a survival object inside a
data frame, use the I()
function. Surv
objects are implemented as
a matrix of 2 or 3 columns.
In the case of is.Surv
, a logical value T
if x
inherits from
class "Surv"
, otherwise an F
.
If type = "interval2"
then the representation given above is
assumed, with NA taking the place of infinity. If `type="interval"
event
must be given. If event
is 0
, 1
, or 2
, the relevant
information is assumed to be contained in time
, the value in time2
is ignored, and the second column of the result will contain a
placeholder.
Presently, the only methods allowing interval censored data are the
parametric models computed by survreg
,
so the distinction between open and closed intervals
is unimportant.
The distinction is important for counting process data and
the Cox model.
The function tries to distinguish between the use of 0/1 and 1/2 coding for
left and right censored data using if (max(status)==2)
.
If 1/2 coding is used and all the subjects are censored, it will
guess wrong. Use 0/1 coding in this case.
coxph
, survfit
, survreg
.data(aml)
Surv(aml$time, aml$status)
Run the code above in your browser using DataLab