naginterfaces.library.surviv.coxmodel_​risksets

naginterfaces.library.surviv.coxmodel_risksets(ns, z, isz, ip, t, ic, isi, mxn)[source]

coxmodel_risksets creates the risk sets associated with the Cox proportional hazards model for fixed covariates.

For full information please refer to the NAG Library document for g12za

https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/g12/g12zaf.html

Parameters
nsint

The number of strata. If then the stratum for each observation must be supplied in .

zfloat, array-like, shape

The th row must contain the covariates which are associated with the th failure time given in .

iszint, array-like, shape

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.

ipint

, the number of covariates included in the model as indicated by .

tfloat, array-like, shape

The vector of failure censoring times.

icint, array-like, shape

The status of the individual at time given in .

Indicates that the th individual has failed at time .

Indicates that the th individual has been censored at time .

isiint, array-like, shape

Note: the required length for this argument is determined as follows: if : ; otherwise: .

If , the stratum indicators which also allow data points to be excluded from the analysis.

If , 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.

mxnint

The first dimension of the array .

The dimension of the arrays and .

Returns
numint

The number of values in the combined risk sets.

ixsint, ndarray, shape

The factor giving the risk sets/strata for the data in and .

If or , for members of the th risk set.

If , for the observations in the th risk set for the th strata.

nxsint

The number of levels for the risk sets/strata factor given in .

xfloat, ndarray, shape

The first rows contain the values of the covariates for the members of the risk sets.

fidint, ndarray, shape

Indicates if the member of the risk set given in failed.

if the member of the risk set failed at the time defining the risk set and otherwise.

ndint

The number of distinct failure times, i.e., the number of risk sets.

tpfloat, ndarray, shape

contains the th distinct failure time, for .

irsint, ndarray, shape

Indicates rows in and elements in and 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 .

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, and .

Constraint: or .

(errno )

On entry, there are not values of .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, and minimum value for .

Constraint: must be sufficiently large for the arrays to contain the expanded risk set.

Notes

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 parameters. As is unknown, the parameters 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 coxmodel_risksets 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 (correg.glm_poisson with anova.dummyvars to compute dummy variables) using Breslow’s approximation for ties (see Breslow (1974)). This will give the same fit as coxmodel(). 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 contab.condl_logistic.

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