PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_surviv_coxmodel_risksets (g12za)
Purpose
nag_surviv_coxmodel_risksets (g12za) creates the risk sets associated with the Cox proportional hazards model for fixed covariates.
Syntax
[
num,
ixs,
nxs,
x,
id,
nd,
tp,
irs,
ifail] = g12za(
ns,
z,
isz,
ip,
t,
ic,
isi,
mxn, 'n',
n, 'm',
m)
[
num,
ixs,
nxs,
x,
id,
nd,
tp,
irs,
ifail] = nag_surviv_coxmodel_risksets(
ns,
z,
isz,
ip,
t,
ic,
isi,
mxn, 'n',
n, 'm',
m)
Description
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
.
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_coxmodel_risksets (g12za) 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_correg_glm_poisson (g02gc) with
nag_anova_dummyvars (g04ea) to compute dummy variables) using Breslow's approximation for ties (see
Breslow (1974)). This will give the same fit as
nag_surviv_coxmodel (g12ba). 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_contab_condl_logistic (g11ca).
References
Breslow N E (1974) Covariate analysis of censored survival data Biometrics 30 89–99
Cox D R (1972) Regression models in life tables (with discussion) J. Roy. Statist. Soc. Ser. B 34 187–220
Gross A J and Clark V A (1975) Survival Distributions: Reliability Applications in the Biomedical Sciences Wiley
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int scalar
-
The number of strata. If
then the stratum for each observation must be supplied in
isi.
Constraint:
.
- 2:
– double array
-
ldz, the first dimension of the array, must satisfy the constraint
.
The
th row must contain the covariates which are associated with the
th failure time given in
t.
- 3:
– int64int32nag_int array
-
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.
- 4:
– int64int32nag_int scalar
-
, the number of covariates included in the model as indicated by
isz.
Constraint:
the number of nonzero values of
isz.
- 5:
– double array
-
The vector of failure censoring times.
- 6:
– int64int32nag_int array
-
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 .
- 7:
– int64int32nag_int array
-
The dimension of the array
isi
must be at least
if
, and at least
otherwise
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 .
- 8:
– int64int32nag_int scalar
-
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
or
.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
t,
ic and the first dimension of the array
z. (An error is raised if these dimensions are not equal.)
, the number of data points.
Constraint:
.
- 2:
– int64int32nag_int scalar
-
Default:
the dimension of the array
isz and the second dimension of the array
z. (An error is raised if these dimensions are not equal.)
The number of covariates in array
z.
Constraint:
.
Output Parameters
- 1:
– int64int32nag_int scalar
-
The number of values in the combined risk sets.
- 2:
– int64int32nag_int array
-
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.
- 3:
– int64int32nag_int scalar
-
The number of levels for the risk sets/strata factor given in
ixs.
- 4:
– double array
-
The dimension of the array
x will be
The first
num rows contain the values of the covariates for the members of the risk sets.
- 5:
– int64int32nag_int array
-
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.
- 6:
– int64int32nag_int scalar
-
The number of distinct failure times, i.e., the number of risk sets.
- 7:
– double array
-
contains the th distinct failure time, for .
- 8:
– int64int32nag_int array
-
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
.
- 9:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
On entry, | , |
or | , |
or | , |
or | . |
-
-
On entry, | for some , |
or | the value of ip is incompatible with isz, |
or | or . |
or | and , |
or | and . |
-
-
mxn is too small, the minimum value is returned in
num.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
Not applicable.
Further Comments
When there are strata present, i.e.,
, not all the
nxs groups may be present.
Example
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_coxmodel_risksets (g12za) and the Cox's proportional hazard model is fitted using
nag_contab_condl_logistic (g11ca).
Open in the MATLAB editor:
g12za_example
function g12za_example
fprintf('g12za example results\n\n');
n = 42;
m = 1;
z = zeros(n,m);
ic = zeros(n,1,'int64');
ic(31:end) = 1;
z(22:end) = 1;
isz = [int64(1)];
t = [ 1; 1; 2; 2; 3; 4; 4;
5; 5; 8; 8; 8; 8; 11;
11; 12; 12; 15; 17; 22; 23;
6; 6; 6; 7; 10; 13; 16;
22; 23; 6; 9; 10; 11; 17;
19; 20; 25; 32; 32; 34; 35];
ns = int64(0);
ip = int64(m);
isi = [int64(0)];
mxn = int64(1000);
[num, ixs, nxs, x, id, nd, tp, irs, ifail] = ...
g12za(...
ns, z, isz, ip, t, ic, isi, mxn);
tol = 1e-05;
maxit = int64(10);
b = zeros(m,1);
[dev, b, se, sc, covar, nca, nct, ifail] = ...
g11ca( ...
nxs, x, isz, id, ixs, b, tol, maxit, 'n', num);
ns = max(ns,1);
fprintf(' Parameter Estimate Standard Error\n\n');
ivar = [1:m]';
fprintf('%6d%18.4f%18.4f\n',[ivar b se]');
g12za example results
Parameter Estimate Standard Error
1 1.6282 0.4331
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015