Library: | hazreg |
See also: | hazdat haznar |
Macro: | hazrisk | |
Description: | determines which observations are ar risk at the time point t_i. |
Usage: | inrisk = hazrisk(data,i) | |
Input: | ||
data | n x (p+4) matrix, the first column is the sorted survival time, followed by the sorted censoring indicator, labels l, a column containing the number of ties, and lastly, the sorted covariate matrix z. This data is produced by hazdat.xpl. | |
i | an integer between 1 and n. | |
Output: | ||
inrisk | n x 1 vector, the jth entry is 1 if the jth observation is at risk at time i, 0 otherwise. |
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 inrisk = hazrisk(data,5) ; the risk set at observation 5
The risk set at observation 5 is listed as a vector where 1 indicating risk and 0 otherwise.
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 inrisk = hazrisk(data,3) ;the risk set at observation 3
The risk set at observation 3 is listed as a vector where 1 indicating risk and 0 otherwise.
Library: | hazreg |
See also: | hazdat haznar |