HAZST
Performs hazard rate estimation over a grid of points using a kernel function.
Required Arguments
ST — Vector of length NOBS containing the event times, sorted in ascending order. (Input)
ST may not contain missing values.
JCEN — Vector of length NOBS containing the censor codes. (Input)
JCEN(i) = 1 means that event i was (right) censored at time ST(i), i = 1, …, NOBS. JCEN(i) = 0 means that event i was a failure at time ST(i).
NGRID — Number of grid points at which to compute the hazard. (Input)
GSTRT — First grid value. (Input)
GINC — Increment between grid values. (Input)
ALPHA — Value for parameter α. (Input)
BTA — Value for parameter β. (Input)
K — Value for parameter k. (Input)
H — Vector of length 5 * NOBS containing the constants used in computing the k‑th failure distance. (Input, if IHCOMP = 1; Output, otherwise)
HAZ — Vector of length NGRID containing the estimated hazard rates. (Output)
Optional Arguments
NOBS — Number of observations. (Input)
If HAZRD or HAZEZ is called prior to this routine and the original data contained missing values, then NOBS in HAZST must be adjusted for the number of missing values from the value used in HAZRD or HAZEZ. That is, NOBS in HAZST is NOBS minus NMISS from HAZRD or HAZEZ.
Default: NOBS = size (ST,1).
IWTO — Weighting option. (Input)
IWTO = 1 means use weights ln(1 + 1/(NOBS ‑ i + 1)). IWTO = 0 means use weights 1/(NOBS ‑ i + 1). Not used if IHCOMP = 1.
Default: IWTO = 0.
IHCOMP — Option parameter. (Input)
If IHCOMP = 0, H is computed. If IHCOMP = 1, H has already been computed (generally by HAZRD or HAZEZ).
Default: IHCOMP = 0.
FORTRAN 90 Interface
Generic: CALL HAZST (ST, JCEN, NGRID, GSTRT, GINC, ALPHA, BTA, K, H, HAZ [, …])
Specific: The specific interface names are S_HAZST and D_HAZST.
FORTRAN 77 Interface
Single: CALL HAZST (NOBS, ST, JCEN, IWTO, NGRID, GSTRT, GINC, ALPHA, BTA, K, IHCOMP, H, HAZ)
Double: The double precision name is DHAZST.
Description
Routine HAZST estimates the hazard function by use of the biweight kernel,
Because a “smoothed” estimate is computed, one generally would use either routine HAZRD or HAZEZ routine to obtain maximum (modified) likelihood estimates of the smoothing parameters α, β, and k. Maximum (modified) likelihood estimates of these parameters are not required, however. A user‑specified grid of points is generated. For each point, the hazard estimate is computed as
where n = NOBS, δi is the i‑th observation’s censoring code (0 = failed, 1 = censored), wi is the i‑th observation’s weight (either 1/(n ‑ i + 1) or ln(1 + 1/(n ‑ i + 1)) depending upon IWTO), and Ks(x ‑ x(i)), the “smoothed kernel”, is as follows:
Here, dik is the distance to the k‑th nearest failure from the i‑th observation. Because of the dik, HAZST requires the computation of matrix H, which contains constants needed to quickly compute dik. Often, H will have been computed in routine HAZRD or HAZEZ. In this case, the parameter IHCOMP should be set to zero and H should be input to HAZST. If H must be computed by HAZST, set IHCOMP = 1.
Comments
1. Informational error
Type |
Code |
Description |
4 |
13 |
At least one missing (NaN, not a number) value was found in ST. Missing values are not allowed in this routine. |
2. The user‑defined grid is given by GSTRT + j * GINC, j = 0, …, NGRID ‑ 1.
3. Routine HAZST assumes that the grid points are new data points.
Example
The following example is a continuation of the example from HAZRD. The data are from Stablein, Carter, and Novak (1981), and involve the survival times of individuals with nonresectable gastric carcinoma. Only those individuals treated with both radiation and chemotherapy are used.
USE HAZST_INT
USE WRRRN_INT
IMPLICIT NONE
INTEGER K, NGRID, NOBS
REAL ALPHA, BTA, GINC, GSTRT
PARAMETER (ALPHA=1.540537, BTA=1.631553, GINC=10, GSTRT=0.0, &
K=20, NGRID=100, NOBS=45)
!
INTEGER JCEN(NOBS), NOUT
REAL H(5*NOBS), HAZ(NGRID), ST(NOBS)
!
DATA ST/17, 42, 44, 48, 60, 72, 74, 95, 103, 108, 122, 144, 167, &
170, 183, 185, 193, 195, 197, 208, 234, 235, 254, 307, 315, &
401, 445, 464, 484, 528, 542, 567, 577, 580, 795, 855, 882, &
892, 1031, 1033, 1306, 1335, 1366, 1452, 1472/
DATA JCEN/36*0, 9*1/
!
CALL HAZST (ST, JCEN, NGRID, GSTRT, GINC, ALPHA, &
BTA, K, H, HAZ)
!
CALL WRRRN ('Ten elements of HAZ', HAZ, 1, 10, 1)
CALL WRRRN ('The first 10 rows of H', H, 10, 5, NOBS)
END
Output
Ten elements of HAZ
1 2 3 4 5 6 7
0.000962 0.001111 0.001276 0.001451 0.001634 0.001819 0.002004
8 9 10
0.002185 0.002359 0.002523
The first 10 rows of H
1 2 3 4 5
1 217.0 218.0 1.0 21.0 1.0
2 192.0 193.0 1.0 21.0 0.5
3 190.0 191.0 1.0 21.0 0.3
4 186.0 187.0 1.0 21.0 0.2
5 174.0 175.0 1.0 21.0 0.2
6 162.0 163.0 1.0 21.0 0.2
7 160.0 161.0 1.0 21.0 0.1
8 139.0 140.0 1.0 21.0 0.1
9 131.0 132.0 1.0 21.0 0.1
10 126.0 127.0 1.0 21.0 0.1