TABLE OF CONTENTS


methodsBiv/Surv2 [ Functions ]

NAME

    Surv2 --- bivariate survival response object

FUNCTION

Construct a bivariate survival response from times and status indicators. This just entails checking the input and returning a matrix with four columns.

SYNOPSIS

225 Surv2 <- function(start, stop, status1, status2)

INPUTS

    start      interval start times
    stop       interval stop times
    status1    0-1 status indicators for event 1
    status2    0-1 status indicators for event 2

OUTPUTS

    an object of class Surv2

SOURCE

228 {
229     l <- length(start)
230     if(length(stop) != l || length(status1) != l || length(status2) != l)
231         stop("All four vectors must be of the same length")
232     if(!all(sort(unique(status1)) == c(0, 1)) || !all(sort(unique(status2)) == c(0, 1)))
233         stop("status must be 0 - 1")
234     if(!all(stop >= start))
235         stop("stop must be greater than start")
236     out <- cbind(start, stop, status1, status2)
237     attr(out, "processnames") <- as.character(c(match.call()[[4]], match.call()[[5]]))
238     class(out) <- "Surv2"
239     invisible(out)
240 }