NAG Library Routine Document
G12BAF
1 Purpose
G12BAF returns parameter estimates and other statistics that are associated with the Cox proportional hazards model for fixed covariates.
2 Specification
SUBROUTINE G12BAF ( |
OFFSET, N, M, NS, Z, LDZ, ISZ, IP, T, IC, OMEGA, ISI, DEV, B, SE, SC, COV, RES, ND, TP, SUR, NDMAX, TOL, MAXIT, IPRINT, WK, IWK, IFAIL) |
INTEGER |
N, M, NS, LDZ, ISZ(M), IP, IC(N), ISI(*), ND, NDMAX, MAXIT, IPRINT, IWK(2*N), IFAIL |
REAL (KIND=nag_wp) |
Z(LDZ,M), T(N), OMEGA(*), DEV, B(IP), SE(IP), SC(IP), COV(IP*(IP+1)/2), RES(N), TP(NDMAX), SUR(NDMAX,*), TOL, WK(IP*(IP+9)/2+N) |
CHARACTER(1) |
OFFSET |
|
3 Description
The proportional hazard model 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 (see
Cox (1972))
is of the form:
where
is the base-line hazard function, an unspecified function of time,
is a vector of unknown parameters and
is a known offset.
Assuming there are ties in the failure times giving
distinct failure times,
such that
individuals fail at
, it follows that the marginal likelihood for
is well approximated (see
Kalbfleisch and Prentice (1980)) by:
where
is the sum of the covariates of individuals observed to fail at
and
is the set of individuals at risk just prior to
, that is, it is all individuals that fail or are censored at time
along with all individuals that survive beyond time
. The maximum likelihood estimates (MLEs) of
, given by
, are obtained by maximizing
(1) using a Newton–Raphson iteration technique that includes step halving and utilizes the first and second partial derivatives of
(1) which are given by equations
(2) and
(3) below:
for
, where
is the
th element in the vector
and
Similarly,
where
is the
th component of a score vector and
is the
element of the observed information matrix
whose inverse
gives the variance-covariance matrix of
.
It should be noted that if a covariate or a linear combination of covariates is monotonically increasing or decreasing with time then one or more of the 's will be infinite.
If
varies across
strata, where the number of individuals in the
th stratum is
, for
with
, then rather than maximizing
(1) to obtain
, the following marginal likelihood is maximized:
where
is the contribution to likelihood for the
observations in the
th stratum treated as a single sample in
(1). When strata are included the covariate coefficients are constant across strata but there is a different base-line hazard function
.
The base-line survivor function associated with a failure time
, is estimated as
, where
where
is the number of failures at time
. The residual for the
th observation is computed as:
where
. The deviance is defined as
(logarithm of marginal likelihood). There are two ways to test whether individual covariates are significant: the differences between the deviances of nested models can be compared with the appropriate
-distribution; or, the asymptotic normality of the parameter estimates can be used to form
tests by dividing the estimates by their standard errors or the score function for the model under the null hypothesis can be used to form
tests.
4 References
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
Kalbfleisch J D and Prentice R L (1980) The Statistical Analysis of Failure Time Data Wiley
5 Parameters
- 1: – CHARACTER(1)Input
-
On entry: indicates if an offset is to be used.
- An offset must be included in OMEGA.
- No offset is included in the model.
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: – REAL (KIND=nag_wp) arrayInput
-
On entry: the
th row must contain the covariates which are associated with the
th failure time given in
T.
- 6: – INTEGERInput
-
On entry: the first dimension of the array
Z as declared in the (sub)program from which G12BAF is called.
Constraint:
.
- 7: – INTEGER arrayInput
-
On entry: indicates which subset of covariates is 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 and at most
elements of
ISZ must be nonzero where
is the number of observations excluding any with zero value of
ISI.
- 8: – INTEGERInput
-
On entry: the number of covariates included in the model as indicated by
ISZ.
Constraints:
- ;
- .
- 9: – REAL (KIND=nag_wp) arrayInput
-
On entry: the vector of failure censoring times.
- 10: – INTEGER arrayInput
-
On entry: the status of the individual at time
given in
T.
- The th individual has failed at time .
- The th individual has been censored at time .
Constraint:
or , for .
- 11: – REAL (KIND=nag_wp) arrayInput
-
Note: the dimension of the array
OMEGA
must be at least
if
, and at least
otherwise.
On entry: if
, the offset,
, for
. Otherwise
OMEGA is not referenced.
- 12: – INTEGER arrayInput
-
Note: the dimension of the array
ISI
must be at least
if
, and at least
otherwise.
On entry: if
, the stratum indicators which also allow data points to be excluded from the analysis.
If
,
ISI is not referenced.
- The th data point is in the th stratum, where .
- The th data point is omitted from the analysis.
Constraint:
if
,
and more than
IP values of
, for
.
- 13: – REAL (KIND=nag_wp)Output
-
On exit: the deviance, that is (maximized log marginal likelihood).
- 14: – REAL (KIND=nag_wp) arrayInput/Output
-
On entry: initial estimates of the covariate coefficient parameters
.
must contain the initial estimate of the coefficient of the covariate in
Z corresponding to the
th nonzero value of
ISZ.
Suggested value:
in many cases an initial value of zero for
may be used. For other suggestions see
Section 9.
On exit:
contains the estimate
, the coefficient of the covariate stored in the
th column of
Z where
is the
th nonzero value in the array
ISZ.
- 15: – REAL (KIND=nag_wp) arrayOutput
-
On exit: is the asymptotic standard error of the estimate contained in and score function in , for .
- 16: – REAL (KIND=nag_wp) arrayOutput
-
On exit: is the value of the score function, , for the estimate contained in .
- 17: – REAL (KIND=nag_wp) arrayOutput
-
On exit: the variance-covariance matrix of the parameter estimates in
B stored in packed form by column, i.e., the covariance between the parameter estimates given in
and
,
, is stored in
.
- 18: – REAL (KIND=nag_wp) arrayOutput
-
On exit: the residuals,
, for .
- 19: – INTEGEROutput
-
On exit: the number of distinct failure times.
- 20: – REAL (KIND=nag_wp) arrayOutput
-
On exit: contains the th distinct failure time, for .
- 21: – REAL (KIND=nag_wp) arrayOutput
-
Note: the second dimension of the array
SUR
must be at least
.
On exit: if
,
contains the estimated survival function for the
th distinct failure time.
If , contains the estimated survival function for the th distinct failure time in the th stratum.
- 22: – INTEGERInput
-
On entry: the dimension of the array
TP and the first dimension of the array
SUR as declared in the (sub)program from which G12BAF is called.
Constraint:
.
- 23: – REAL (KIND=nag_wp)Input
-
On entry: indicates the accuracy required for the estimation. Convergence is assumed when the decrease in deviance is less than . This corresponds approximately to an absolute precision if the deviance is small and a relative precision if the deviance is large.
Constraint:
.
- 24: – INTEGERInput
-
On entry: the maximum number of iterations to be used for computing the estimates. If
MAXIT is set to
then the standard errors, score functions, variance-covariance matrix and the survival function are computed for the input value of
in
B but
is not updated.
Constraint:
.
- 25: – INTEGERInput
-
On entry: indicates if the printing of information on the iterations is required.
- No printing.
- The deviance and the current estimates are printed every IPRINT iterations. When printing occurs the output is directed to the current advisory message unit (see X04ABF).
- 26: – REAL (KIND=nag_wp) arrayWorkspace
-
- 27: – INTEGER arrayWorkspace
-
- 28: – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. 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
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Errors or warnings detected by the routine:
-
On entry, | or , |
or | , |
or | , |
or | , |
or | , |
or | , |
or | , |
or | . |
-
On entry, | for some , |
or | the value of IP is incompatible with ISZ, |
or | or . |
or | or , |
or | number of values of is greater than or equal to , the number of observations excluding any with , |
or | all observations are censored, i.e., for all , |
or | NDMAX is too small. |
-
The matrix of second partial derivatives is singular. Try different starting values or include fewer covariates.
-
Overflow has been detected. Try using different starting values.
-
Convergence has not been achieved in
MAXIT iterations. The progress toward convergence can be examined by using a nonzero value of
IPRINT. Any non-convergence may be due to a linear combination of covariates being monotonic with time.
Full results are returned.
-
In the current iteration step halvings have been performed without decreasing the deviance from the previous iteration. Convergence is assumed.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.8 in the Essential Introduction for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.7 in the Essential Introduction for further information.
Dynamic memory allocation failed.
See
Section 3.6 in the Essential Introduction for further information.
7 Accuracy
The accuracy is specified by
TOL.
8 Parallelism and Performance
G12BAF is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
G12BAF makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
G12BAF uses mean centering which involves subtracting the means from the covariables prior to computation of any statistics. This helps to minimize the effect of outlying observations and accelerates convergence.
If the initial estimates are poor then there may be a problem with overflow in calculating
or there may be non-convergence. Reasonable estimates can often be obtained by fitting an exponential model using
G02GCF.
10 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. An initial estimate is computed using the exponential model and then the Cox proportional hazard model is fitted and parameter estimates and the survival function are printed.
10.1 Program Text
Program Text (g12bafe.f90)
10.2 Program Data
Program Data (g12bafe.d)
10.3 Program Results
Program Results (g12bafe.r)