G12ZAF creates the risk sets associated with the Cox proportional hazards model for fixed covariates.
The Cox proportional hazards model (see
Cox (1972)) relates the time to an event, usually death or failure, to a number of explanatory variables known as covariates. Some of the observations may be rightcensored, that is, the exact time to failure is not known, only that it is greater than a known time.
Let
${t}_{\mathit{i}}$, for
$\mathit{i}=1,2,\dots ,n$, be the failure time or censored time for the
$i$th observation with the vector of
$p$ covariates
${z}_{i}$.
It is assumed that censoring and failure mechanisms are independent. The hazard function,
$\lambda \left(t,z\right)$, is the probability that an individual with covariates
$z$ fails at time
$t$ given that the individual survived up to time
$t$. In the Cox proportional hazards model,
$\lambda \left(t,z\right)$ is of the form
where
${\lambda}_{0}$ is the baseline hazard function, an unspecified function of time, and
$\beta $ is a vector of unknown parameters. As
${\lambda}_{0}$ is unknown, the parameters
$\beta $ are estimated using the conditional or marginal likelihood. This involves considering the covariate values of all subjects that are at risk at the time when a failure occurs. The probability that the subject that failed had their observed set of covariate values is computed.
The risk set at a failure time consists of those subjects that fail or are censored at that time and those who survive beyond that time. As risk sets are computed for every distinct failure time, it should be noted that the combined risk sets may be considerably larger than the original data. If the data can be considered as coming from different strata such that ${\lambda}_{0}$ varies from strata to strata but $\beta $ remains constant, then G12ZAF will return a factor that indicates to which risk set/strata each member of the risk sets belongs rather than just to which risk set.
Given the risk sets the Cox proportional hazards model can then be fitted using a Poisson generalized linear model (
G02GCF with
G04EAF to compute dummy variables) using Breslow's approximation for ties (see
Breslow (1974)). This will give the same fit as
G12BAF. If the exact treatment of ties in discrete time is required, as given by
Cox (1972), then the model is fitted as a conditional logistic model using
G11CAF.
 1: $\mathrm{N}$ – INTEGERInput

On entry: $n$, the number of data points.
Constraint:
${\mathbf{N}}\ge 2$.
 2: $\mathrm{M}$ – INTEGERInput

On entry: the number of covariates in array
Z.
Constraint:
${\mathbf{M}}\ge 1$.
 3: $\mathrm{NS}$ – INTEGERInput

On entry: the number of strata. If
${\mathbf{NS}}>0$ then the stratum for each observation must be supplied in
ISI.
Constraint:
${\mathbf{NS}}\ge 0$.
 4: $\mathrm{Z}\left({\mathbf{LDZ}},{\mathbf{M}}\right)$ – REAL (KIND=nag_wp) arrayInput

On entry: the
$i$th row must contain the covariates which are associated with the
$i$th failure time given in
T.
 5: $\mathrm{LDZ}$ – INTEGERInput

On entry: the first dimension of the array
Z as declared in the (sub)program from which G12ZAF is called.
Constraint:
${\mathbf{LDZ}}\ge {\mathbf{N}}$.
 6: $\mathrm{ISZ}\left({\mathbf{M}}\right)$ – INTEGER arrayInput

On entry: indicates which subset of covariates are to be included in the model.
 ${\mathbf{ISZ}}\left(j\right)\ge 1$
 The $j$th covariate is included in the model.
 ${\mathbf{ISZ}}\left(j\right)=0$
 The $j$th covariate is excluded from the model and not referenced.
Constraint:
${\mathbf{ISZ}}\left(j\right)\ge 0$ and at least one value must be nonzero.
 7: $\mathrm{IP}$ – INTEGERInput

On entry:
$p$, the number of covariates included in the model as indicated by
ISZ.
Constraint:
${\mathbf{IP}}=\text{}$ the number of nonzero values of
ISZ.
 8: $\mathrm{T}\left({\mathbf{N}}\right)$ – REAL (KIND=nag_wp) arrayInput

On entry: the vector of $n$ failure censoring times.
 9: $\mathrm{IC}\left({\mathbf{N}}\right)$ – INTEGER arrayInput

On entry: the status of the individual at time
$t$ given in
T.
 ${\mathbf{IC}}\left(i\right)=0$
 Indicates that the $i$th individual has failed at time ${\mathbf{T}}\left(i\right)$.
 ${\mathbf{IC}}\left(i\right)=1$
 Indicates that the $i$th individual has been censored at time ${\mathbf{T}}\left(i\right)$.
Constraint:
${\mathbf{IC}}\left(\mathit{i}\right)=0$ or $1$, for $\mathit{i}=1,2,\dots ,{\mathbf{N}}$.
 10: $\mathrm{ISI}\left(*\right)$ – INTEGER arrayInput

Note: the dimension of the array
ISI
must be at least
${\mathbf{N}}$ if
${\mathbf{NS}}>0$, and at least
$1$ otherwise.
On entry: if
${\mathbf{NS}}>0$, the stratum indicators which also allow data points to be excluded from the analysis.
If
${\mathbf{NS}}=0$,
ISI is not referenced.
 ${\mathbf{ISI}}\left(i\right)=k$
 Indicates that the $i$th data point is in the $k$th stratum, where $k=1,2,\dots ,{\mathbf{NS}}$.
 ${\mathbf{ISI}}\left(i\right)=0$
 Indicates that the $i$th data point is omitted from the analysis.
Constraint:
if ${\mathbf{NS}}>0$, $0\le {\mathbf{ISI}}\left(\mathit{i}\right)\le {\mathbf{NS}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{N}}$.
 11: $\mathrm{NUM}$ – INTEGEROutput

On exit: the number of values in the combined risk sets.
 12: $\mathrm{IXS}\left({\mathbf{MXN}}\right)$ – INTEGER arrayOutput

On exit: the factor giving the risk sets/strata for the data in
X and
ID.
If ${\mathbf{NS}}=0$ or $1$, ${\mathbf{IXS}}\left(i\right)=l$ for members of the $l$th risk set.
If ${\mathbf{NS}}>1$, ${\mathbf{IXS}}\left(i\right)=\left(j1\right)\times {\mathbf{ND}}+l$ for the observations in the $l$th risk set for the $j$th strata.
 13: $\mathrm{NXS}$ – INTEGEROutput

On exit: the number of levels for the risk sets/strata factor given in
IXS.
 14: $\mathrm{X}\left({\mathbf{MXN}},{\mathbf{IP}}\right)$ – REAL (KIND=nag_wp) arrayOutput

On exit: the first
NUM rows contain the values of the covariates for the members of the risk sets.
 15: $\mathrm{MXN}$ – INTEGERInput

On entry: the first dimension of the array
X and the dimension of the arrays
IXS and
ID as declared in the (sub)program from which G12ZAF is called.
Constraint:
MXN must be sufficiently large for the arrays to contain the expanded risk sets. The size will depend on the pattern of failures times and censored times. The minimum value will be returned in
NUM unless the routine exits with
${\mathbf{IFAIL}}={\mathbf{1}}$ or
${\mathbf{2}}$.
 16: $\mathrm{ID}\left({\mathbf{MXN}}\right)$ – INTEGER arrayOutput

On exit: indicates if the member of the risk set given in
X failed.
${\mathbf{ID}}\left(i\right)=1$ if the member of the risk set failed at the time defining the risk set and ${\mathbf{ID}}\left(i\right)=0$ otherwise.
 17: $\mathrm{ND}$ – INTEGEROutput

On exit: the number of distinct failure times, i.e., the number of risk sets.
 18: $\mathrm{TP}\left({\mathbf{N}}\right)$ – REAL (KIND=nag_wp) arrayOutput

On exit: ${\mathbf{TP}}\left(\mathit{i}\right)$ contains the $\mathit{i}$th distinct failure time, for $\mathit{i}=1,2,\dots ,{\mathbf{ND}}$.
 19: $\mathrm{IRS}\left({\mathbf{N}}\right)$ – INTEGER arrayOutput

On exit: indicates rows in
X and elements in
IXS and
ID corresponding to the risk sets. The first risk set corresponding to failure time
${\mathbf{TP}}\left(1\right)$ is given by rows
$1$ to
${\mathbf{IRS}}\left(1\right)$. The
$\mathit{l}$th risk set is given by rows
${\mathbf{IRS}}\left(\mathit{l}1\right)+1$ to
${\mathbf{IRS}}\left(\mathit{l}\right)$, for
$\mathit{l}=1,2,\dots ,{\mathbf{ND}}$.
 20: $\mathrm{IFAIL}$ – INTEGERInput/Output

On entry:
IFAIL must be set to
$0$,
$1\text{ or}1$. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
$1\text{ or}1$ is recommended. If the output of error messages is undesirable, then the value
$1$ is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
$0$.
When the value $\mathbf{1}\text{ or}\mathbf{1}$ is used it is essential to test the value of IFAIL on exit.
On exit:
${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see
Section 6).
If on entry
${\mathbf{IFAIL}}={\mathbf{0}}$ or
${{\mathbf{1}}}$, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Not applicable.
Not applicable.
When there are strata present, i.e.,
${\mathbf{NS}}>1$, not all the
NXS groups may be present.
The data are the remission times for two groups of leukemia patients (see page 242 of
Gross and Clark (1975)). A dummy variable indicates which group they come from. The risk sets are computed using G12ZAF and the Cox's proportional hazard model is fitted using
G11CAF.