nag_surviv_risk_sets (g12zac) 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 right-censored, that is, the exact time to failure is not known, only that it is greater than a known time.
Let
, for
, be the failure time or censored time for the
th observation with the vector of
covariates
.
The covariance matrix
is constructed so that it contains
rows with the
th row containing the
covariates
.
It is assumed that censoring and failure mechanisms are independent. The hazard function,
, is the probability that an individual with covariates
fails at time
given that the individual survived up to time
. In the Cox proportional hazards model,
is of the form
where
is the base-line hazard function, an unspecified function of time, and
is a vector of unknown arguments. As
is unknown, the arguments
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 varies from strata to strata but remains constant, then nag_surviv_risk_sets (g12zac) 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 (
nag_glm_poisson (g02gcc) with
nag_dummy_vars (g04eac) to compute dummy variables) using Breslow's approximation for ties (see
Breslow (1974)). This will give the same fit as
nag_surviv_cox_model (g12bac). 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
nag_condl_logistic (g11cac).
- 1:
– Nag_OrderTypeInput
-
On entry: the
order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by
. See
Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint:
or .
- 2:
– IntegerInput
-
On entry: , the number of data points.
Constraint:
.
- 3:
– IntegerInput
-
On entry: the number of covariates in array
z.
Constraint:
.
- 4:
– IntegerInput
-
On entry: the number of strata. If
then the stratum for each observation must be supplied in
isi.
Constraint:
.
- 5:
– const doubleInput
-
Note: the dimension,
dim, of the array
z
must be at least
- when ;
- when .
The
th element of the matrix
is stored in
- when ;
- when .
On entry: must contain the covariates in column or row major order.
- 6:
– IntegerInput
-
On entry: the stride separating row or column elements (depending on the value of
order) in the array
z.
Constraints:
- if ,
;
- if , .
- 7:
– const IntegerInput
-
On entry: indicates which subset of covariates are to be included in the model.
- The th covariate is included in the model.
- The th covariate is excluded from the model and not referenced.
Constraint:
and at least one value must be nonzero.
- 8:
– IntegerInput
-
On entry:
, the number of covariates included in the model as indicated by
isz.
Constraint:
the number of nonzero values of
isz.
- 9:
– const doubleInput
-
On entry: the vector of failure censoring times.
- 10:
– const IntegerInput
-
On entry: the status of the individual at time
given in
t.
- Indicates that the th individual has failed at time .
- Indicates that the th individual has been censored at time .
Constraint:
or , for .
- 11:
– const IntegerInput
-
Note: the dimension,
dim, of the array
isi
must be at least
- when ;
- otherwise.
On entry: if
, the stratum indicators which also allow data points to be excluded from the analysis.
If
,
isi is not referenced.
- Indicates that the th data point is in the th stratum, where .
- Indicates that the th data point is omitted from the analysis.
Constraint:
if , , for .
- 12:
– Integer *Output
-
On exit: the number of values in the combined risk sets.
- 13:
– IntegerOutput
-
On exit: the factor giving the risk sets/strata for the data in
x and
id.
If or , for members of the th risk set.
If , for the observations in the th risk set for the th strata.
- 14:
– Integer *Output
-
On exit: the number of levels for the risk sets/strata factor given in
ixs.
- 15:
– doubleOutput
-
Note: the
th element of the matrix
is stored in
- when ;
- when .
On exit: the first
num rows contain the values of the covariates for the members of the risk sets.
- 16:
– IntegerInput
-
On entry: the
first
dimension of the array
x and the dimension of the arrays
ixs and
id.
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 function exits with
NE_INT.
- 17:
– IntegerOutput
-
On exit: indicates if the member of the risk set given in
x failed.
if the member of the risk set failed at the time defining the risk set and otherwise.
- 18:
– Integer *Output
-
On exit: the number of distinct failure times, i.e., the number of risk sets.
- 19:
– doubleOutput
-
On exit: contains the th distinct failure time, for .
- 20:
– IntegerOutput
-
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
is given by rows
to
. The
th risk set is given by rows
to
, for
.
- 21:
– NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
Not applicable.
Not applicable.
When there are strata present, i.e.,
, 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 nag_surviv_risk_sets (g12zac) and the Cox's proportional hazard model is fitted using
nag_condl_logistic (g11cac).