"censor"
censor
object,
usually used as a response variable in a formula
to a model fitting function for censored data.
censor(time, censor.codes) or censor(time, time2, censor.codes, type=<<see below>>, origin=0, ...) as.censor(x) is.censor(x)
time
,
2 = left censored, and 3 = interval censored.
"right"
,
"left"
,
"interval"
or
"counting"
.
The default is
"right"
or
"interval"
depending on whether the
time2
argument
is absent or present, respectively.
censor
recognizes are
inCodes
,
outCodes
,
event
,
right
,
left
and
interval
.
These arguments provide more
flexibility in the coding of the original data as well as the new codes
that are generated.
These are used in the following way:
inCodes
specifies a set of numeric codes
in the data to be mapped
to numeric values used by the internal estimation routines.
The default is
"0-3"
or
c(1,0,2,3)
which is identical
to what the
Surv
function needs.
outCodes
specifies the numeric codes
generated by
censor
to be used by the
internal estimation routines.
The default is
"1-4"
or
1:4
To generate codes that
coxph
,
survreg
and
survfit
can use specify
outCodes="0-3"
or
outCodes=c(1,0,2,3)
.
event
specifies the numeric codes in the data for
events which are mapped to the internal codes as specified by
outCodes
and used by the estimation routines.
Some examples are
event=1
,
event="failed"
,
event=c("hrt.attack1", "hrt.attack2")
.
right
specifies the numeric codes in the data for
right censoring which are mapped to the internal codes as specified
by
outCodes
and used by the estimation routines.
Some examples are
right=2
,
right="censored"
,
right=c("no-show", "removed")
.
left
specifies the numeric codes in the data
for left censoring which are mapped to the internal codes
as specified by
outCodes
and used by the estimation routines.
Examples are similar to
right
.
interval
specifies the numeric codes in the data
for interval censoring which are mapped to the internal codes
as specified by
outCodes
and used by the estimation routines.
Examples are similar to
right
.
censor
, a matrix of 2 or 3 columns of class
"censor"
containing
time
,
time2
(if provided),
and
censor.codes
.
To include a
"censor"
object in a data frame,
use the
I
function.
In theory it is possible to represent interval censored data without a
third column containing the explicit status.
Exact, right censored, left censored and interval censored observations
would be represented as intervals
of (a,a), (a, infinity), (-infinity,b), and (a,b) respectively;
each interval is a pair of time points within which the event is known to have
occurred.
If
type="interval"
,
censor.codes
must be given.
If
censor.codes
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 contains
time
as a placeholder.
Presently, the only methods allowing interval censored data are
the parametric models computed by
censorReg
and
survreg
,
so the distinction between open and closed intervals is unimportant.
censor(capacitor2$days, capacitor2$event)