Library: | hazreg |
See also: | hazdat hazregll hazbeta hazsurv |
Quantlet: | hazcoxb | |
Description: | calculates the baseline hazard and survival function, using the maximum likelihood estimate of the regression parameter beta obatined through hazbeta. |
Usage: | {bcumhaz, bsurv} = hazcoxb(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: | ||
bcumhaz | n x 2 matrix, column 1: the sorted observed survival time t, column 2: estimated cumulative baseline hazard function at the points of t. | |
bsurv | n x 2 matrix, column 1: the sorted observed survival time t, column 2: estimated baseline survival function at the points of t. |
library("hazreg") n = 20 p = 2 beta = 1|2 ; regression parameter z = 1 + uniform(n,p) ; covariates y = -log(1-uniform(n)) ; exponential survival y = y./exp(z*beta) ; covariate effects c = 4*uniform(n) ; uniform censoring t = min(y~c,2) ; censored time delta =(y<=c) ; censoring indicator {data,ties} = hazdat(t,delta, z) ; preparing data {bcumhaz,bsurv} = hazcoxb(data) ; estimation of the ; baseline hazard and ; survival functions
The baseline hazard and survival functions are estimated.