Create an object of class "censor"

DESCRIPTION:

Create a censor object, usually used as a response variable in a formula to a model fitting function for censored data.

USAGE:

censor(time, censor.codes)
or
censor(time, time2, censor.codes, type=<<see below>>, origin=0, ...)
as.censor(x)
is.censor(x)

REQUIRED ARGUMENTS:

time
a numeric vector of times or response values for right censored data. This is the follow up time. For interval data, the first argument is the starting time for the interval.
x
a numeric vector.

OPTIONAL ARGUMENTS:

time2
numeric vector of ending times of the interval for interval censored or counting process data only. Intervals are assumed to be open on the left and closed on the right, (start, end].
censor.codes
status indicator, normally 0 = alive and 1 = dead. Other choices are T/F (T = death) or 1/2 (2=death). For interval censored data, the status indicator is 0 = right censored, 1 = event at time, 2 = left censored, and 3 = interval censored.
type
character string specifying the type of censoring. Possible values are "right", "left", "interval" or "counting". The default is "right" or "interval" depending on whether the time2 argument is absent or present, respectively.
origin
hazard function origin for counting process data. Most often used in a model containing time dependent strata to align the subjects properly when they change from one strata to another.
...
additional arguments that 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.

VALUE:

from 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.

METHOD:

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.

SEE ALSO:

EXAMPLES:

censor(capacitor2$days, capacitor2$event)