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: hazdat hazrisk

Quantlet: haznar
Description: calculates the size of the risk set at each points of the censord survival time data.

Usage: nar = haznar(data)
Input:
data n x (p+4) matrix, column 1: the sorted observed survival time t, column 2: the cosorted censoring indicator delta, column 3: labels l, column 4: number of ties at time t[i], cosorted, columns 5 to p+4: the cosorted covariate matrix z.
Output:
nar n x 1 vector, the ith entry is the size of the risk set at time t_i.

Example:
library("hazreg")
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
{data,ties} = hazdat(t,delta)   ; preparing data
nar = haznar(data)              ; calculating the
number at risk

Result:
The size of each risk set is listed as a vector in
same order of the sorted data.
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
{data,ties} = hazdat(t,delta)
; preparing data
nar = haznar(data)           ; calculating the number
at risk

Result:
The same risk set size vector, but this time there
are ties in the vector: three 9's, three 6's, two 3's.



Author: Lijian Yang 990601
(C) MD*TECH Method and Data Technologies, 21.07.2002