oceFormat {oceCens}R Documentation

Format ordered composite endpoint.

Description

Usually called from within oceTest. Input data.frame with one row for each individual and columns for k time-to-event outcomes, k status variables, and a group variable. Format output so that each individual has several rows representing different intervals at risk. Returns a list with elements used for later calculations.

Usage

oceFormat(
  data,
  oceTime,
  oceStatus,
  group,
  id = NULL,
  oceNames = NULL,
  outputDataFrame = FALSE
)

Arguments

data

data.frame name, must have variables with names listed in oceTime, oceStatus, group

oceTime

character vector with ordered (primary is first) names of different time-to-event variables.

oceStatus

character vector with ordered names of status (0=censored, 1=event) variables.

group

name of group variable.

id

name of ID variable, NULL creates integer IDs.

oceNames

long names of ordered endpoints, NULL uses oceTime.

outputDataFrame

logical, output a data.frame in the list, defaults to FALSE for speed in the bootstrap.

Value

A list with the following elements:

timeMatrix

n by k matrix with input values for k time-to-event values for each of n individuals

statusMatrix

n by k matrix of status values

Z

n vector of group variable with elements either 0 or 1

oceNames

k vector of long oceNames (for plotting labels)

id

m vector of individual ids, one element for each interval, so m>n

group

m vector of group values, either 0 or 1

status

m vector of status for each interval

START

m vector, START of interval

STOP

m vector, end of interval

TAU

maximum of the time-to-event outcomes

IZMatrix

m by k matrix, with jth column an indicator of representing ordering score 'time' for the jth endpoint

data

a data.frame output if outputDataFrame=TRUE, with variables: id, group, status, START, STOP, IZ1,...,IZk (columns of IZMatrix)

Examples

 d.temp<-data.frame(T1=c(1,4,3,6),s1=c(0,0,1,0),T2=c(4,1,5,3),
   s2=c(1,0,0,1),z=c(0,0,1,1))
 d.temp
 x<-oceFormat(data=d.temp,oceTime=c("T1","T2"),oceStatus=c("s1","s2"),
   group="z",outputDataFrame=TRUE)
 # put time to second event starting at TAU
 x$TAU
 x$data


[Package oceCens version 0.1.2 Index]