KTBLE
Prints Kaplan‑Meier estimates of survival probabilities in stratified samples.
Required Arguments
X — NOBS by NCOL matrix containing the data. (Input)
IRT — Column number of X containing the response variable. (Input)
For the i‑th right‑censored observation, X(i, IRT) contains the right‑censoring time. Otherwise, X(i, IRT) contains the failure time. See argument ICEN.
SPROB — NOBS by 2 matrix. (Input)
SPROB (i, 1) contains the estimated survival probability at time X(i, IRT) in the i‑th observation’s stratum, while SPROB(i, 2) contains Greenwood’s estimate of the standard deviation of this estimated probability. SPROB will usually be computed by routine KAPMR. It may contain missing values after the last failed observation in each group.
Optional Arguments
NOBS — Number of observations. (Input)
Default: NOBS = size (X,1).
NCOL — Number of columns in X. (Input)
Default: NCOL = size (X,2).
LDX — Leading dimension of X exactly as specified in the dimension statement in the calling program. (Input)
Default: LDX = size (X,1).
IFRQ — Frequency option. (Input)
IFRQ = 0 means that all frequencies are 1.0. For positive IFRQ, column number IFRQ of X contains the frequencies.
Default: IFRQ = 0.
ICEN — Column number of X containing the censoring code for this observation. (Input)
Default: ICEN = 0.
If ICEN = 0, a censoring code of 0 is assumed. Valid censoring codes are:
Code |
Meaning |
0 |
Exact failure at X(i, IRT). |
1 |
Right censored. The response is greater than X(i, IRT). |
If X(i, ICEN) is not zero or one, then the i‑th observation is omitted from the analysis.
IGRP — Column number of X containing the stratum number for this observation. (Input)
If IGRP = 0, the data are assumed to be from one stratum. Otherwise, column IGRP of X contains a unique value for each stratum in the data. Kaplan‑Meier estimates are computed within each stratum.
Default: IGRP = 0.
ISRT — Sorting option. (Input)
If ISRT = 1, column IRT of X is assumed to be sorted in ascending order within each stratum. Otherwise, a detached sort will be performed by KTBLE. If sorting is performed by KTBLE, all censored observations are assumed to follow failing observations with the same response time in X (i, IRT).
Default: ISRT = 0.
LDSPRO — Leading dimension of SPROB exactly as specified in the dimension statement in the calling program. (Input)
Default: LDSPRO = size (SPROB,1).
FORTRAN 90 Interface
Generic: CALL KTBLE (X, IRT, SPROB [, …])
Specific: The specific interface names are S_KTBLE and D_KTBLE.
FORTRAN 77 Interface
Single: CALL KTBLE (NOBS, NCOL, X, LDX, IRT, IFRQ, ICEN, IGRP, ISRT, SPROB, LDSPRO)
Double: The double precision name is DKTBLE.
Description
Routine KTBLE prints life tables based upon the Kaplan‑Meier estimates of the survival probabilities (see routine KAPMR). One table for each stratum is printed. In addition to the survival probabilities at each failure point, the following is also printed: the number of individuals remaining at risk, Greenwood’s estimate of the standard errors for the survival probabilities, and the Kaplan‑Meier log‑likelihood. The Kaplan‑Meier log‑likelihood is computed as:
where the sum is with respect to the distinct failure times s(j), d(j) is the number of failures occurring at time s(j), and n(j) is the number of observations that had not yet failed immediately prior to s(j). Note that sorting is performed by both KAPMR, and by routine KTBLE. The user may sort the data to be increasing in failure time and then use the ISRT = 1 option to avoid this double sorting.
Comments
1. Workspace may be explicitly provided, if desired, by use of K2BLE/DK2BLE. The reference is:
CALL K2BLE (NOBS, NCOL, X, LDX, IRT, IFRQ, ICEN, IGRP, ISRT, SPROB, LDSPRO, ALGL, IPERM, INDDR, WK, WK1, IWK)
The additional arguments are as follows:
ALGL — Work vector of length NOBS that contains the log likelihoods of the Kaplan‑Meier estimates. If the number of groups is known to be m or less, then ALGL can be of length m.
IPERM — Work vector of length NOBS.
INDDR — Work vector of length NOBS.
WK — Work vector of length NOBS.
WK1 — Work vector of length 2 * max(NOBS, NCOL).
IWK — Work vector of length max(NOBS, NCOL).
2. Informational errors
Type |
Code |
Description |
4 |
1 |
An invalid value for SPROB has been detected. The estimated survival probability must be between zero and one, inclusive, and nonincreasing with failure time within each group. |
4 |
2 |
A negative frequency has been detected. |
4 |
3 |
A missing value for SPROB has been detected but later failures occur. Missing values are not allowed prior to the last failed observation. |
3. Missing values may occur in any of the columns of X. Any row of X that contains missing values in the IRT, ICEN, or IFRQ columns (when the ICEN and IFRQ columns are present) is omitted from the analysis. Missing values in the IGRP column, if present, are classified into an additional “missing” group.
Example
This example illustrates the typical use of KTBLE. First, routine KAPMR is used to compute the survival probabilities. This is followed by a call to KTBLE that performs the printing. The input data is given as:
143, 164, 188(2), 190, 192, 206, 209, 213, 216, 220, 227, 230, 234, 246, 265, 304, 216*, 244*, 142, 156, 163, 198, 205, 232(2), 233(4), 239, 240, 261, 280(2), 296(2), 323, 204*, 344*
where items marked with an * are right censored, and the frequency of each failure time, if different from 1, is given in parenthesis.
USE KAPMR_INT
USE KTBLE_INT
IMPLICIT NONE
INTEGER ICEN, IFRQ, IGRP, IRT, ISRT, LDSPRO, LDX, NCOL, NOBS
PARAMETER (ICEN=3, IFRQ=4, IGRP=2, IRT=1, ISRT=0, LDSPRO=33, &
LDX=33, NCOL=4, NOBS=33)
!
INTEGER NRMISS
REAL SPROB(LDSPRO,2), X(LDX,NCOL)
!
DATA X/143, 164, 188, 190, 192, 206, 209, 213, 216, 220, 227, &
230, 234, 246, 265, 304, 216, 244, 142, 156, 163, 198, 205, &
232, 233, 239, 240, 261, 280, 296, 323, 204, 344, 18*5, &
15*7, 16*0, 2*1, 13*0, 4*1, 2, 20*1, 2, 4, 3*1, 2*2, 3*1/
!
CALL KAPMR (X, IRT, SPROB, IFRQ=IFRQ, ICEN=ICEN, IGRP=IGRP)
!
CALL KTBLE (X, IRT, SPROB, IFRQ=IFRQ, ICEN=ICEN, IGRP=IGRP)
END
Output
Kaplan Meier Survival Probabilities
For Group Value = 5.00000
Number Number Survival Estimated
at risk Failing Time Probability Std. Error
19 1 143 0.94737 0.05123
18 1 164 0.89474 0.07041
17 2 188 0.78947 0.09353
15 1 190 0.73684 0.10102
14 1 192 0.68421 0.10664
13 1 206 0.63158 0.11066
12 1 209 0.57895 0.11327
11 1 213 0.52632 0.11455
10 1 216 0.47368 0.11455
8 1 220 0.41447 0.11452
7 1 227 0.35526 0.11243
6 1 230 0.29605 0.10816
5 1 234 0.23684 0.10145
3 1 246 0.15789 0.09343
2 1 265 0.07895 0.07279
1 1 304 0.00000 NaN
Total number in group = 19
Total number failing = 17
Product Limit Likelihood = -49.1692
Kaplan Meier Survival Probabilities
For Group Value = 7.00000
Number Number Survival Estimated
at risk Failing Time Probability Std. Error
21 1 142 0.95238 0.04647
20 1 156 0.90476 0.06406
19 1 163 0.85714 0.07636
18 1 198 0.80952 0.08569
16 1 205 0.75893 0.09409
15 2 232 0.65774 0.10529
13 4 233 0.45536 0.11137
9 1 239 0.40476 0.10989
8 1 240 0.35417 0.10717
7 1 261 0.30357 0.10311
6 2 280 0.20238 0.09021
4 2 296 0.10119 0.06778
2 1 323 0.05060 0.04928
Total number in group = 21
Total number failing = 19
Product Limit Likelihood = -50.4277