Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: hazreg
See also: haznar hazrisk

Quantlet: hazdat
Description: sorts the right-censored data of n individuals to prepare it for hazard regression analysis. The observed data are n triples (t_i,delta_i,z_i): t_i denotes the observed survival time of the i-th individual, delta_i is the censoring indicator, z_i denotes the p-dimensional covariate vector associated with the i-th individual.

Reference(s):

Link:
Usage: {data,ties} = hazdat(t, delta {,z})
Input:
t n x 1 vector, the censored survival time.
delta n x 1 vector, the censoring indicator, showing if censoring occured (0) or not (1).
z optional, n x p matrix of covariates (default is an empty matrix): each row denotes the p-dimensional covariate vector associated with the i-th individual
Output:
data n x (p+4) matrix of cosorted time-to-event data: column 1: sorted observed times t_i column 2: cosorted censoring indicator delta_i column 3: cosorted original observation labels i (i=1,...,n) column 4: cosorted number of tied observations at time t_i columns 5 through (p+4): cosorted covariate matrix z
ties scalar, either 1 (there are ties) or 0 (there are no ties)

Example:
library("hazreg")
randomize(1)
y = -log(1-uniform(20))         ; exponential survival
c = 2*uniform(20)               ; uniform censoring
t = min(y~c,2)                  ; censored time
delta =(y<=c)                  ; censoring indicator
res= hazdat(t,delta)            ; preparing data
res

Result:
The censored data is sorted and information about
ties in the data presented:

Contents of res.data
[ 1,]  0.0004326        1        1        1
[ 2,]  0.010333        0       13        1
[ 3,]  0.024494        1        3        1
[ 4,]  0.036793        1        5        1
  .
  .
  .
[18,]  0.72464        0        2        1
[19,]   1.3491        1        7        1
[20,]   1.5549        0       20        1

Contents of res.ties
[1,]        0
Example:
library("hazreg")
y = 2|1|3|2|4|7|1|3|2        ; hypothetical survival
c = 3|1|5|6|1|6|2|4|5        ; hypothetical censoring
t = min(y~c,2)               ; censored time
delta =(y<=c)               ; censoring indicator
res = hazdat(t,delta)        ; preparing data
res

Result:
The censored data is sorted and this time there are
ties in the data: three 1's, three 2's, two 3's:

Contents of res.data
[1,]        1        0        5        3
[2,]        1        1        7        3
[3,]        1        1        2        3
[4,]        2        1        4        3
[5,]        2        1        9        3
[6,]        2        1        1        3
[7,]        3        1        8        2
[8,]        3        1        3        2
[9,]        6        0        6        1

Contents of res.ties

[1,]        1



Author: L. Yang, 19990601 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006