| Library: | hazreg |
| See also: | haznar hazrisk |
| Quantlet: | hazdat | |
| Description: | sorts the right-censored data to prepare it for hazard regression analysis. |
| 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 | n x p matrix of covariates. | |
| Output: | ||
| data | n x (p+4) matrix, the first column is the sorted t, followed by the sorted delta, labels l, a column containing the number of ties, and lastly, the sorted covariate matrix z. | |
| ties | a scalar equaling either 1 (there are ties) or 0 (there are no ties) | |
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
The censored data is sorted and information about ties in the data presented.
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
The censored data is sorted and this time there are ties in the data: three 1's, three 2's, two 3's.
| Library: | hazreg |
| See also: | haznar hazrisk |