g11caf returns parameter estimates for the conditional logistic analysis of stratified data, for example, data from case-control studies and survival analyses.
The routine may be called by the names g11caf or nagf_contab_condl_logistic.
3Description
In the analysis of binary data, the logistic model is commonly used. This relates the probability of one of the outcomes, say $y=1$, to $p$ explanatory variates or covariates by
where $\beta $ is a vector of unknown coefficients for the covariates $z$ and $\alpha $ is a constant term. If the observations come from different strata or groups, $\alpha $ would vary from strata to strata. If the observed outcomes are independent then the $y$s follow a Bernoulli distribution, i.e., a binomial distribution with sample size one and the model can be fitted as a generalized linear model with binomial errors.
In some situations the number of observations for which $y=1$ may not be independent. For example, in epidemiological research, case-control studies are widely used in which one or more observed cases are matched with one or more controls. The matching is based on fixed characteristics such as age and sex, and is designed to eliminate the effect of such characteristics in order to more accurately determine the effect of other variables. Each case-control group can be considered as a stratum. In this type of study the binomial model is not appropriate, except if the strata are large, and a conditional logistic model is used. This considers the probability of the cases having the observed vectors of covariates given the set of vectors of covariates in the strata. In the situation of one case per stratum, the conditional likelihood for ${n}_{\mathrm{s}}$ strata can be written as
where ${S}_{i}$ is the set of observations in the $i$th stratum, with associated vectors of covariates ${z}_{l}$, $l\in {S}_{i}$, and ${z}_{i}$ is the vector of covariates of the case in the $i$th stratum. In the general case of ${c}_{i}$ cases per strata then the full conditional likelihood is
where ${s}_{i}$ is the sum of the vectors of covariates for the cases in the $i$th stratum and ${s}_{l}$, $l\in {C}_{i}$ refer to the sum of vectors of covariates for all distinct sets of ${c}_{i}$ observations drawn from the $i$th stratum. The conditional likelihood can be maximized by a Newton–Raphson procedure. The covariances of the parameter estimates can be estimated from the inverse of the matrix of second derivatives of the logarithm of the conditional likelihood, while the first derivatives provide the score function, ${U}_{\mathit{j}}\left(\beta \right)$, for $\mathit{j}=1,2,\dots ,p$, which can be used for testing the significance of parameters.
If the strata are not small, ${C}_{i}$ can be large so to improve the speed of computation, the algorithm in Howard (1972) and described by Krailo and Pike (1984) is used.
A second situation in which the above conditional likelihood arises is in fitting Cox's proportional hazard model (see g12baf) in which the strata refer to the risk sets for each failure time and where the failures are cases. When ties are present in the data g12baf uses an approximation. For an exact estimate, the data can be expanded using g12zaf to create the risk sets/strata and g11caf used.
4References
Cox D R (1972) Regression models in life tables (with discussion) J. Roy. Statist. Soc. Ser. B34 187–220
Cox D R and Hinkley D V (1974) Theoretical Statistics Chapman and Hall
Howard S (1972) Remark on the paper by Cox, D R (1972): Regression methods J. R. Statist. Soc.B 34 and life tables 187–220
Krailo M D and Pike M C (1984) Algorithm AS 196. Conditional multivariate logistic analysis of stratified case-control studies Appl. Statist.33 95–103
Smith P G, Pike M C, Hill P, Breslow N E and Day N E (1981) Algorithm AS 162. Multivariate conditional logistic analysis of stratum-matched case-control studies Appl. Statist.30 190–197
On entry: stratum indicators which also allow data points to be excluded from the analysis.
If ${\mathbf{isi}}\left(i\right)=k$, indicates that the $i$th observation is from the $k$th stratum, where $k=1,2,\dots ,{\mathbf{ns}}$.
If ${\mathbf{isi}}\left(i\right)=0$, indicates that the $i$th observation is to be omitted from the analysis.
Constraint:
$0\le {\mathbf{isi}}\left(\mathit{i}\right)\le {\mathbf{ns}}$ and more than ip values of ${\mathbf{isi}}\left(\mathit{i}\right)>0$, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
10: $\mathbf{dev}$ – Real (Kind=nag_wp)Output
On exit: the deviance, that is, minus twice the maximized log-likelihood.
11: $\mathbf{b}\left({\mathbf{ip}}\right)$ – Real (Kind=nag_wp) arrayInput/Output
On entry: initial estimates of the covariate coefficient parameters $\beta $. ${\mathbf{b}}\left(j\right)$ must contain the initial estimate of the coefficent of the covariate in z corresponding to the $j$th nonzero value of isz.
Suggested value:
in many cases an initial value of zero for ${\mathbf{b}}\left(j\right)$ may be used. For another suggestion see Section 9.
On exit: ${\mathbf{b}}\left(j\right)$ contains the estimate ${\hat{\beta}}_{i}$ of the coefficient of the covariate stored in the $i$th column of z where $i$ is the $j$th nonzero value in the array isz.
12: $\mathbf{se}\left({\mathbf{ip}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: ${\mathbf{se}}\left(\mathit{j}\right)$ is the asymptotic standard error of the estimate contained in ${\mathbf{b}}\left(\mathit{j}\right)$ and score function in ${\mathbf{sc}}\left(\mathit{j}\right)$, for $\mathit{j}=1,2,\dots ,{\mathbf{ip}}$.
13: $\mathbf{sc}\left({\mathbf{ip}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: ${\mathbf{sc}}\left(j\right)$ is the value of the score function ${U}_{j}\left(\beta \right)$ for the estimate contained in ${\mathbf{b}}\left(j\right)$.
14: $\mathbf{cov}\left({\mathbf{ip}}\times ({\mathbf{ip}}+1)/2\right)$ – 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 ${\mathbf{b}}\left(i\right)$ and ${\mathbf{b}}\left(j\right)$, $j\ge i$, is given in ${\mathbf{cov}}\left(j(j-1)/2+i\right)$.
On exit: ${\mathbf{nca}}\left(\mathit{i}\right)$ contains the number of cases in the $\mathit{i}$th stratum, for $\mathit{i}=1,2,\dots ,{\mathbf{ns}}$.
On exit: ${\mathbf{nct}}\left(\mathit{i}\right)$ contains the number of controls in the $\mathit{i}$th stratum, for $\mathit{i}=1,2,\dots ,{\mathbf{ns}}$.
17: $\mathbf{tol}$ – 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 ${\mathbf{tol}}\times (1.0+\mathrm{CurrentDeviance})$. This corresponds approximately to an absolute accuracy if the deviance is small and a relative accuracy if the deviance is large.
On entry: the maximum number of iterations required for computing the estimates. If maxit is set to $0$ then the standard errors, the score functions and the variance-covariance matrix are computed for the input value of $\beta $ in b but $\beta $ is not updated.
Constraint:
${\mathbf{maxit}}\ge 0$.
19: $\mathbf{iprint}$ – IntegerInput
On entry: indicates if the printing of information on the iterations is required.
${\mathbf{iprint}}\le 0$
No printing.
${\mathbf{iprint}}\ge 1$
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).
Suggested value:
${\mathbf{iprint}}=0$.
20: $\mathbf{wk}\left({\mathbf{lwk}}\right)$ – Real (Kind=nag_wp) arrayWorkspace
21: $\mathbf{lwk}$ – IntegerInput
On entry: the dimension of the array wk as declared in the (sub)program from which g11caf is called.
Constraint:
${\mathbf{lwk}}\ge p{n}_{0}+({c}_{\mathrm{m}}+1)(p+1)(p+2)/2+{c}_{\mathrm{m}}$, where ${n}_{0}$ is the number of observations included in the model, i.e., the number of observations for which ${\mathbf{isi}}\left(i\right)\ne 0$ and ${c}_{\mathrm{m}}$ is the maximum number of observations in any stratum.
22: $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ 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).
6Error Indicators and Warnings
If on entry ${\mathbf{ifail}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{ip}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{ip}}\ge 1$.
On entry, ${\mathbf{ldz}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{ldz}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{m}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{m}}\ge 1$.
On entry, ${\mathbf{maxit}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{maxit}}\ge 0$.
On entry, ${\mathbf{n}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{n}}\ge 2$.
On entry, ${\mathbf{ns}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{ns}}\ge 1$.
On entry, ${\mathbf{tol}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{tol}}\ge 10\times \mathit{machineprecision}$.
${\mathbf{ifail}}=2$
On entry, $i=\u27e8\mathit{\text{value}}\u27e9$, ${\mathbf{isi}}\left(i\right)=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{ns}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: $0\le {\mathbf{isi}}\left(i\right)\le {\mathbf{ns}}$.
On entry, $i=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{ic}}\left(i\right)=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{ic}}\left(i\right)=0$ or $1$.
On entry, $i=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{isz}}\left(i\right)<\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{isz}}\left(i\right)\ge 0$.
On entry, there are not ip values of ${\mathbf{isz}}>0$.
On entry, too few observations included in model.
${\mathbf{ifail}}=3$
On entry, lwk is too small, ${\mathbf{lwk}}=\u27e8\mathit{\text{value}}\u27e9$ minimum value $\text{}=\u27e8\mathit{\text{value}}\u27e9$.
${\mathbf{ifail}}=4$
Overflow in calculations. Try using different starting values.
${\mathbf{ifail}}=5$
The matrix of second partial derivatives is singular. Try different starting values or include fewer covariates.
${\mathbf{ifail}}=6$
Convergence not achieved in $\u27e8\mathit{\text{value}}\u27e9$ iterations. The progress towards 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.
${\mathbf{ifail}}=-99$
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
g11caf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g11caf 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.
9Further Comments
The other models described in Section 3 can be fitted using the generalized linear modelling routines g02gbfandg02gcf.
The case with one case per stratum can be analysed by having a dummy response variable $y$ such that $y=1$ for a case and $y=0$ for a control, and fitting a Poisson generalized linear model with a log link and including a factor with a level for each strata. These models can be fitted by using g02gcf.
g11caf 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. In order to reduce the risk of the sums computed by Howard's algorithm becoming too large, the scaling factor described in Krailo and Pike (1984) is used.
If the initial estimates are poor then there may be a problem with overflow in calculating $\mathrm{exp}\left({\beta}^{\mathrm{T}}{z}_{i}\right)$ or there may be non-convergence. Reasonable estimates can often be obtained by fitting an unconditional model.
10Example
The data was used for illustrative purposes by Smith et al. (1981) and consists of two strata and two covariates. The data is input, the model is fitted and the results are printed.