PHGLM
Analyzes time event data via the proportional hazards model.
Required Arguments
XNOBS by NCOL matrix containing the data. (Input)
When ITIE = 1, the observations in X must be grouped by stratum and sorted from largest to smallest failure time within each stratum, with the strata separated.
IRT — Column number in X containing the response variable. (Input)
For point observations, X(iIRT) contains the time of the i‑th event. For right‑censored observations, X(iIRT) contains the right‑censoring time. Note that because PHGLM only uses the order of the events, negative “times” are allowed.
NVEF — Vector of length NEF containing the number of variables associated with each effect in the model. (Input)
INDEF — Index vector of length NVEF(1) +  + NVEF(NEF) containing the column numbers of X associated with each effect. (Input)
The first NVEF(1) elements of INDEF contain the column numbers of X for the variables in the first effect. The next NVEF(2) elements in INDEF contain the column numbers for the second effect, etc.
MAXCL — An upper bound on the sum of the number distinct values taken by the classification variables. (Input)
NCOEF — Number of estimated coefficients in the model. (Output)
COEFNCOEF by 4 matrix containing the parameter estimates and associated statistics. (Output, if INIT = 0; Input, if INIT = 1 and MAXIT = 0; Input/Output, if INIT = 1 and MAXIT > 0)
Col.
Statistic
1
Coefficient estimate
2
Estimated standard deviation of the estimated coefficient.
3
Asymptotic normal score for testing that the coefficient is zero against the two‑sided alternative.
4
p‑value associated with the normal score in column 3.
When COEF is input, only column 1 needs to be given.
ALGL — The maximized log‑likelihood. (Output)
COVNCOEF by NCOEF matrix containing the estimated asymptotic variance‑covariance matrix of the parameters. (Output)
For MAXIT = 0, COV is the inverse of the Hessian of the negative of the log‑likelihood, computed at the estimates input in COEF.
XMEAN — Vector of length NCOEF containing the means of the design variables. (Output)
CASENOBS by 5 matrix containing the case statistics for each observation. (Output if MAXIT > 0; used as working storage otherwise)
Col.
Statistic
1
Estimated survival probability at the observation time.
2
Estimated observation influence or leverage.
3
A residual estimate.
4
Estimated cumulative baseline hazard rate.
5
Observation proportionality constant.
GR — Vector of length NCOEF containing the last parameter updates (excluding step halvings). (Output)
For MAXIT = 0, GR contains the inverse of the Hessian times the gradient vector computed at the estimates input in COEF.
IGRP — Vector of length NOBS giving the stratum number used for each observation. (Output)
If RATIO is not 1.0, additional “strata” (other than those specified by column ISTRAT of X) may be generated. IGRP also contains a record of the generated strata. See the “Description” section for more detail.
Optional Arguments
NOBS — Number of observations. (Input)
Default: NOBS = size (X,1).
NCOL — Number of columns in X. (Input)
Default: NCOL = size (X,2).
LDX — Leading dimension of X exactly as specified in the dimension statement in the calling program. (Input)
Default: LDX = size (X,1).
IFRQ — Column number in X containing the frequency of response for each observation. (Input)
If IFRQ = 0, a response frequency of 1 for each observation is assumed.
Default: IFRQ = 0.
IFIX — Column number in X containing a constant to be added to the linear response. (Input)
Default: IFIX = 0.
The linear response is taken to be , where wi is the observation constant, zi is the observation design row vector, and is the vector of estimated parameters. The “fixed” constant allows one to test hypotheses about parameters via the log-likelihoods. If IFIX = 0, the fixed parameter is assumed to be 0.
ICEN — Column number in X containing the censoring code for each observation. (Input)
Default: ICEN = 0.
If ICEN = 0 a censoring code of 0 is assumed for all observations.
X(i, ICEN)
Censoring
0
Point observation at X(i, IRT).
1
Right censored. The response is greater than X(i, IRT).
ISTRAT — Column number in X containing the stratification variable. (Input)
If ISTRAT = 0, all observations are considered to be in one stratum. Otherwise, column ISTRAT in X contains a unique number for each stratum. The risk set for an observation is determined by the its stratum.
Default: ISTRAT = 0.
MAXIT — Maximum number of iterations. (Input)
MAXIT = 30 will usually be sufficient. Use MAXIT = 0 to compute the Hessian and gradient, stored in COV and GR, at the initial estimates. When MAXIT = 0, INIT must be 1.
Default: MAXIT = 30.
EPS — Convergence criterion. (Input)
Convergence is assumed when the relative change in ALGL from one iteration to the next is less than EPS. If EPS is zero, EPS = 0.0001 is assumed.
Default: EPS = 0.0001.
RATIO — Ratio at which a stratum is split into two strata. (Input)
Default: RATIO = 1000.0.
Let
be the observation proportionality constant, where zk is the design row vector for the k‑th observation and wk is the optional fixed parameter specified by X(kIFIX). Let rmin be the minimum value rk in a stratum, where, for failed observations, the minimum is over all times less than or equal to the time of occurrence of the k‑th observation. Let rmax be the maximum value of rk for the remaining observations in the group. Then, if rmin > RATIO rmax, the observations in the group are divided into two groups at k. RATIO = 1000 is usually a good value. Set RATIO = 1.0 if no division into strata is to be made.
NCLVAR — Number of classification variables. (Input)
Dummy variables are generated for classification variables using the IDUMMY = 2 option of IMSL routine GRGLM (see Chapter 2, “Regression”). See also Comment 3.
Default: NCLVAR = 0.
INDCL — Index vector of length NCLVAR containing the column numbers of X that are the classification variables. (Input, if NCLVAR is positive, not used otherwise)
If NCLVAR is 0, INDCL is not referenced and can be dimensioned of length 1 in the calling program.
NEF — Number of effects in the model. (Input)
In addition to effects involving classification variables, simple covariates and the product of simple covariates are also considered effects.
Default: NEF = size(NVEF,1).
INIT — Initialization option. (Input)
If INIT = 1, then the NCOEF elements of column 1 of COEF contain the initial estimates on input to PHGLM. For INIT = 0, all initial estimates are taken to be 0.
Default: INIT = 0.
ITIE — Option parameter containing the method to be used for handling ties. (Input)
Default: ITIE = 0.
ITIE
Method
0
Breslow’s approximate method
1
Failures are assumed to occur in the same order as the observations input in X. The observations in X must be sorted from largest to smallest failure time within each stratum, and grouped by stratum. All observations are treated as if their failure/censoring times were distinct when computing the log‑likelihood.
IPRINT — Printing option. (Input)
Default: IPRINT = 0.
IPRINT
Action
0
No printing is performed.
1
Printing is performed, but observational statistics are not printed.
2
All output statistics are printed.
NCLVAL — Vector of length NCLVAR containing the number of values taken by each classification variable. (Output, if NCLVAR is positive, not used otherwise)
NCLVAL(i) is the number of distinct values for the i‑th classification variable. If NCLVAR is zero, NCLVAL is not used and can be dimensioned of length 1 in the calling program.
CLVAL — Vector of length NCLVAL(1) + NCLVAL(2) + … + NCLVAL(NCLVAR) containing the distinct values of the classification variables. (Output, if NCLVAR is positive, not used otherwise)
The first NCLVAL(1) elements of CLVAL contain the values for the first classification variable, the next NCLVAL(2) elements contain the values for the second classification variable, etc. If NCLVAR is zero, then NCLVAL is not referenced and can be dimensioned of length 1 in the calling program.
LDCOEF — Leading dimension of COEF exactly as specified in the dimension statement in the calling program. (Input)
Default: LDCOEF = size (COEF,1).
LDCOV — Leading dimension of COV exactly as specified in the dimension statement in the calling program. (Input)
Default: LDCOV = size (COV,1).
LDCASE — Leading dimension of CASE exactly as specified in the dimension statement in the calling program. (Input)
Default: LDCASE = size (CASE,1).
NRMISS — Number of rows of data in X that contain missing values in one or more columns IRT, IFRQ, IFIX, ICEN, ISTRAT, INDCL, or INDEF of X. (Output)
FORTRAN 90 Interface
Generic: CALL PHGLM (X, IRT, NVEF, INDEF, MAXCL, NCOEF, COEF, ALGL, COV, XMEAN, CASE, GR, IGRP [])
Specific: The specific interface names are S_PHGLM and D_PHGLM.
FORTRAN 77 Interface
Single: CALL PHGLM (NOBS, NCOL, X, LDX, IRT, IFRQ, IFIX, ICEN, ISTRAT, MAXIT, EPS, RATIO, NCLVAR, INDCL, NEF, NVEF, INDEF, INIT, ITIE, IPRINT, MAXCL, NCLVAL, CLVAL, NCOEF, COEF, LDCOEF, ALGL, COV, LDCOV, XMEAN, CASE, LDCASE, GR, IGRP, NRMISS)
Double: The double precision name is DPHGLM.
Description
Routine PHGLM computes parameter estimates and other statistics in Proportional Hazards Generalized Linear Models. These models were first proposed by Cox (1972). Two methods for handling ties are allowed in PHGLM. Time‑dependent covariates are not allowed. The user is referred to Cox and Oakes (1984), Kalbfleisch and Prentice (1980), Elandt‑Johnson and Johnson (1980), Lee (1980), or Lawless (1982), among other texts, for a thorough discussion of the Cox proportional hazards model.
Let λ(t, zi) represent the hazard rate at time t for observation number i with covariables contained as elements of row vector zi. The basic assumption in the proportional hazards model (the proportionality assumption) is that the hazard rate can be written as a product of a time varying function λ0(t), which depends only on time, and a function ƒ(zi), which depends only on the covariable values. The function ƒ(zi) used in PHGLM is given as ƒ(zi) = exp(wi + βzi) where wi is a fixed constant assigned to the observation, and β is a vector of coefficients to be estimated. With this function one obtains a hazard rate λ(tzi) = λ0(t) exp(wi + βzi). The form of λ0(t) is not important in proportional hazards models.
The constants wi may be known theoretically. For example, the hazard rate may be proportional to a known length or area, and the wi can then be determined from this known length or area. Alternatively, the wi may be used to fix a subset of the coefficients β (say, β1) at specified values. When wi is used in this way, constants wi = β1z1i are used, while the remaining coefficients in β are free to vary in the optimization algorithm. If user‑specified constants are not desired, the user should set IFIX to 0 so that wi = 0 will be used.
With this definition of λ(t, zi), the usual partial (or marginal, see Kalbfleisch and Prentice (1980)) likelihood becomes
where R(ti) denotes the set of indices of observations that have not yet failed at time ti (the risk set), ti denotes the time of failure for the i‑th observation, nd is the total number of observations that fail. Right‑censored observations (i.e., observations that are known to have survived to time ti, but for which no time of failure is known) are incorporated into the likelihood through the risk set R(ti). Such observations never appear in the numerator of the likelihood. When ITIE = 0, all observations that are censored at time ti are not included in R(ti), while all observations that fail at time ti are included in R(ti).
If it can be assumed that the dependence of the hazard rate upon the covariate values remains the same from stratum to stratum, while the time‑dependent term, λ0(t), may be different in different strata, then PHGLM allows the incorporation of strata into the likelihood as follows. Let k index the m = NSTRAT strata. Then, the likelihood is given by
In PHGLM, the log of the likelihood is maximized with respect to the coefficients β. A quasi‑Newton algorithm approximating the Hessian via the matrix of sums of squares and cross products of the first partial derivatives is used in the initial iterations (the “Q‑N” method in the output). When the change in the log‑likelihood from one iteration to the next is less than 100*EPS, Newton‑Raphson iteration is used (the “N‑R” method). If, during any iteration, the initial step does not lead to an increase in the log‑likelihood, then step halving is employed to find a step that will increase the log‑likelihood.
Once the maximum likelihood estimates have been computed, PHGLM computes estimates of a probability associated with each failure. Within stratum k, an estimate of the probability that the
i‑th observation fails at time ti given the risk set R(tki) is given by
A diagnostic “influence” or “leverage” statistic is computed for each noncensored observation as:
where Hs is the matrix of second partial derivatives of the log‑likelihood, and
is computed as:
Influence statistics are not computed for censored observations.
A “residual” is computed for each of the input observations according to methods given in Cox and Oakes (1984, page 108). Residuals are computed as
where dkj is the number of tied failures in group k at time tkj. Assuming that the proportional hazards assumption holds, the residuals should approximate a random sample (with censoring) from the unit exponential distribution. By subtracting the expected values, centered residuals can be obtained. (The j‑th expected order statistic from the unit exponential with censoring is given as
where h is the sample size, and censored observations are not included in the summation.)
An estimate of the cumulative baseline hazard within group k is given as
The observation proportionality constant is computed as
Comments
1. Workspace may be explicitly provided, if desired, by use of P2GLM/DP2GLM. The reference is:
CALL P2GLM (NOBS, NCOL, X, LDX, IRT, IFRQ, IFIX, ICEN, ISTRAT, MAXIT, EPS, RATIO, NCLVAR, INDCL, NEF, NVEF, INDEF, INIT, ITIE, IPRINT, MAXCL, NCLVAL, CLVAL, NCOEF, COEF, LDCOEF, ALGL, COV, LDCOV, XMEAN, CASE, LDCASE, GR, IGRP, NRMISS, OBS, SMG, SMH, IPTR, IDT, IWK)
The additional arguments are as follows:
OBS — Work vector of length NCOEF + 1.
SMG — Work vector of length NCOEF.
SMH — Work vector of length max(NCOEF * NCOEF, 2).
IPTR — Work vector of length NOBS + NCOEF.
IDT — Work vector of length NOBS.
IWK — Work vector of length 3 * max(NOBSNCOL)
2. Informational errors
Type
Code
Description
3
1
Too many iterations required. Convergence assumed.
3
2
Too many step halvings. Convergence assumed.
3
3
Additional strata were formed as required because of the detection of infinite parameter estimates.
4
4
The number of distinct values of the classification variables exceeds MAXCL.
4
5
The model specified by NEF, NVEF, and INDEF yields no covariates.
4
6
After eliminating observations with missing values, no valid observations remain.
4
7
After eliminating observations with missing values, only one covariate vector remains.
4
8
The number of distinct values for each classification variable must be greater than one.
4
9
LDCOEF or LDCOV must be greater or equal to NCOEF.
3. Dummy variables are generated for the classification variables as follows: An ascending list of all distinct values of the classification variable is obtained and stored in CLVAL. Dummy variables are then generated for each but the last of these distinct values. Each dummy variable is zero unless the classification variable equals the list value corresponding to the dummy variable, in which case, the dummy variable is one. See argument IDUMMY for IDUMMY = 2 in routine GRGLM in Chapter 2, “Regression”.
4. The “product” of a classification variable with a covariate yields dummy variables equal to the product of the covariate with each of the dummy variables associated with the classification variable.
5. The “product” of two classification variables yields dummy variables in the usual manner. Each dummy variable associated with the first classification variable multiplies each dummy variable associated with the second classification variable. The resulting dummy variables are such that the index of the second classification variable varies fastest.
Programming Notes
1. The covariate vectors zki are computed from each row of the input matrix X via routine GRGLM in Chapter 2, “Regression”.). Thus, class variables are easily incorporated into the zki. The reader is referred to the document for GRGLM in the regression chapter for a more detailed discussion. Note that PHGLM calls GRGLM with the option IDUMMY = 2.
2. The average of each of the explanatory variables is subtracted from the variable prior to computing the product zkiβ. Subtraction of the mean values has no effect on the computed log‑likelihood or the estimates since the constant term occurs in both the numerator and denominator of the likelihood. Subtracting the mean values does help to avoid invalid exponentiation in the algorithm and may also speed convergence.
3. Routine PHGLM allows for two methods of handling ties. In the first method (ITIE = 1), the user is allowed to break ties in any manner desired. When this method is used, it is assumed that the user has sorted the rows in X from largest to smallest with respect to the failure/censoring times X(iIRT) within each stratum (and across strata), with tied observations (failures or censored) broken in the manner desired. The same effect can be obtained with ITIE = 0 by adding (or subtracting) a small amount from each of the tied observations failure/censoring times ti = X(iIRT) so as to break the ties in the desired manner.
The second method for handling ties (ITIE = 0) uses an approximation for the tied likelihood proposed by Breslow (1974). The likelihood in Breslow’s method is as specified above, with the risk set at time ti, including all observations that fail at time ti, while all observations that are censored at time ti are not included. (Tied censored observations are assumed to be censored immediately prior to the time ti).
4. If INIT = 1, then it is assumed that the user has provided initial estimates for the model coefficients β in the first column of the matrix COEF. When initial estimates are provided by the user, care should be taken to ensure that the estimates correspond to the generated covariate vector zki. If INIT = 0, then initial estimates of zero are used for all of the coefficients. This corresponds to no effect from any of the covariate values.
5. If a linear combination of covariates is monotonically increasing or decreasing with increasing failure times, then one or more of the estimated coefficients is infinite and extended maximum likelihood estimates must be computed. Such estimates may be written as
where ρ =  at the supremum of the likelihood so that
is the finite part of the solution. In PHGLM, it is assumed that extended maximum likelihood estimates must be computed if, within any group k, for any time t,
where ρ = RATIO is specified by the user. Thus, for example, if ρ = 10000, then PHGLM does not compute extended maximum likelihood estimates until the estimated proportionality constant
is 10000 times larger for all observations prior to t than for all observations after t. When this occurs, PHGLM computes estimates for
by splitting the failures in stratum k into two strata at t (see Bryson and Johnson 1981). Censored observations in stratum k are placed into a stratum based upon the associated value for
The results of the splitting are returned in IGRP.
The estimates
based upon the stratified likelihood represent the finite part of the extended maximum likelihood solution. Routine PHGLM does not compute explicitly, but an estimate for may be obtained in some circumstances by setting RATIO = 1 and optimizing the log‑likelihood without forming additional strata. The solution
obtained will be such that
for some finite value of ρ > 0. At this solution, the Newton‑Raphson algorithm will not have “converged” because the Newton‑Raphson step sizes returned in GR will be large, at least for some variables. Convergence will be declared, however, because the relative change in the log‑likelihood during the final iterations will be small.
Examples
Example 1
The following data are taken from Lawless (1982, page 287) and involve the survival of lung cancer patients based upon their initial tumor types and treatment type. In the first example, the likelihood is maximized with no strata present in the data. This corresponds to Example 7.2.3 in Lawless (1982, page 367). The input data is printed in the output. The model is given as:
where αi and γj correspond to dummy variables generated from columns 6 and 7 of X, respectively, x1 corresponds to column 3 of X, x2 corresponds to column 4 of X, and x3 corresponds to column 5 of X.
 
USE PHGLM_INT
USE WRRRL_INT
 
IMPLICIT NONE
INTEGER ICEN, IPRINT, IRT, LDCASE, LDCOEF, LDCOV, &
LDX, MAXCL, NCLVAR, NCOL, NEF, NOBS
 
REAL RATIO, LABEL
PARAMETER (ICEN=2, IPRINT=2, IRT=1, LDCOEF=7, LDX=40, &
MAXCL=10, NCLVAR=2, NCOL=7, NEF=5, RATIO=10000.0, &
LDCASE=LDX, LDCOV=LDCOEF, NOBS=LDX)
!
INTEGER IGRP(NOBS), INDCL(NCLVAR), INDEF(5), NCLVAL(NCLVAR), &
NCOEF, NRMISS, NVEF(NEF)
REAL ALGL, CASE(LDCASE,5), CLVAL(6), COEF(LDCOEF,4), &
COV(LDCOV,LDCOV), GR(LDCOV), X(LDX,NCOL), XMEAN(LDCOV)
CHARACTER NUMBER(1)*6
DATA NUMBER(1)/'NUMBER'/
 
!
DATA X/411, 126, 118, 92, 8, 25, 11, 54, 153, 16, 56, 21, 287, &
10, 8, 12, 177, 12, 200, 250, 100, 999, 231, 991, 1, 201, &
44, 15, 103, 2, 20, 51, 18, 90, 84, 164, 19, 43, 340, 231, &
5*0, 1, 16*0, 1, 5*0, 1, 11*0, 7, 6, 7, 4, 4, 7, 7, 8, 6, &
3, 8, 4, 6, 4, 2, 5, 5, 4, 8, 7, 6, 9, 5, 7, 2, 8, 6, 5, 7, &
4, 3, 3, 4, 6, 8, 7, 3, 6, 8, 7, 64, 63, 65, 69, 63, 48, &
48, 63, 63, 53, 43, 55, 66, 67, 61, 63, 66, 68, 41, 53, 37, &
54, 52, 50, 65, 52, 70, 40, 36, 44, 54, 59, 69, 50, 62, 68, &
39, 49, 64, 67, 5, 9, 11, 10, 58, 9, 11, 4, 14, 4, 12, 2, &
25, 23, 19, 4, 16, 12, 12, 8, 13, 12, 8, 7, 21, 28, 13, 13, &
22, 36, 9, 87, 5, 22, 4, 15, 4, 11, 10, 18, 7*1, 7*2, 2*3, &
5*4, 7*1, 4*2, 3*3, 5*4, 21*0, 19*1/
DATA NVEF/1, 1, 1, 1, 1/, INDEF/3, 4, 5, 6, 7/, INDCL/6, 7/
!
LABEL = 'NUMBER'
CALL WRRRL ('The First 10 Rows of the Input Data', &
X, NUMBER, NUMBER, 10, NCOL, LDX, FMT='(I7)')
!
CALL PHGLM (X, IRT, NVEF, INDEF, MAXCL, NCOEF, COEF, ALGL, &
COV, XMEAN, CASE, GR, IGRP, ICEN=ICEN, RATIO=RATIO,&
NCLVAR=NCLVAR, INDCL=INDCL, NEF=NEF, IPRINT=IPRINT, &
NClVAL=NClVAL, CLVAL=CLVAL, NRMISS=NRMISS)
!
END
Output
 
The First 10 Rows of the Input Data
1 2 3 4 5 6 7
1 411 0 7 64 5 1 0
2 126 0 6 63 9 1 0
3 118 0 7 65 11 1 0
4 92 0 4 69 10 1 0
5 8 0 4 63 58 1 0
6 25 1 7 48 9 1 0
7 11 0 7 48 11 1 0
8 54 0 8 63 4 2 0
9 153 0 6 63 14 2 0
10 16 0 3 53 4 2 0
 
Initial Estimates
1 2 3 4 5 6 7
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
 
Method Iteration Step size Maximum scaled Log
coef. update likelihood
Q-N 0 -102.4
Q-N 1 1.0000 0.5034 -91.04
Q-N 2 1.0000 0.5782 -88.07
N-R 3 1.0000 0.1131 -87.92
N-R 4 1.0000 0.6958E-01 -87.89
N-R 5 1.0000 0.8144E-03 -87.89
Log-likelihood -87.88779
 
Coefficient Statistics
Standard Asymptotic Asymptotic
Coefficient error z-statistic p-value
1 -0.585 0.137 -4.272 0.000
2 -0.013 0.021 -0.634 0.526
3 0.001 0.012 0.064 0.949
4 -0.367 0.485 -0.757 0.449
5 -0.008 0.507 -0.015 0.988
6 1.113 0.633 1.758 0.079
7 0.380 0.406 0.936 0.349
Asymptotic Coefficient Covariance
1 2 3 4 5
1 0.1873E-01 0.2530E-03 0.3345E-03 0.5745E-02 0.9750E-02
2 0.4235E-03 -0.4120E-04 -0.1663E-02 -0.7954E-03
3 0.1397E-03 0.8111E-03 -0.1831E-02
4 0.2350 0.9799E-01
5 0.2568
 
 
6 7
1 0.4264E-02 0.2082E-02
2 -0.3079E-02 -0.2898E-02
3 0.5995E-03 0.1684E-02
4 0.1184 0.3735E-01
5 0.1253 -0.1944E-01
6 0.4008 0.6289E-01
7 0.1647
 
Case Analysis
Survival Cumulative Proportionality
Probability Influence Residual hazard constant
1 0.00 0.04 2.05 6.10 0.3
2 0.30 0.11 0.74 1.21 0.61
3 0.34 0.12 0.36 1.07 0.33
4 0.43 0.16 1.53 0.84 1.83
5 0.96 0.56 0.09 0.05 2.05
6 0.74 NaN 0.13 0.31 0.42
7 0.92 0.37 0.03 0.08 0.42
8 0.59 0.26 0.14 0.53 0.27
9 0.26 0.12 1.20 1.36 0.88
10 0.85 0.15 0.97 0.17 5.76
11 0.55 0.31 0.21 0.60 0.36
12 0.74 0.21 0.96 0.31 3.12
13 0.03 0.06 3.02 3.53 0.86
14 0.94 0.09 0.17 0.06 2.71
15 0.96 0.16 1.31 0.05 28.89
16 0.89 0.23 0.59 0.12 4.82
17 0.18 0.09 2.62 1.71 1.54
18 0.89 0.19 0.33 0.12 2.68
19 0.14 0.23 0.72 1.96 0.37
20 0.05 0.09 1.66 2.95 0.56
21 0.39 0.22 1.17 0.94 1.25
22 0.00 0.00 1.73 21.11 0.08
23 0.08 NaN 2.19 2.52 0.87
24 0.00 0.00 2.46 8.89 0.28
25 0.99 0.31 0.05 0.01 4.28
26 0.11 0.17 0.34 2.23 0.15
27 0.66 0.25 0.16 0.41 0.38
28 0.87 0.22 0.15 0.14 1.02
29 0.39 NaN 0.45 0.94 0.48
30 0.98 0.25 0.06 0.02 2.53
31 0.77 0.26 1.03 0.26 3.90
32 0.63 0.35 1.80 0.46 3.88
33 0.82 0.26 1.06 0.19 5.47
34 0.47 0.26 1.65 0.75 2.21
35 0.51 0.32 0.39 0.67 0.58
36 0.22 0.18 0.49 1.53 0.32
37 0.80 0.26 1.08 0.23 4.77
38 0.70 0.16 0.26 0.36 0.73
39 0.01 0.23 0.87 4.66 0.19
40 0.08 0.20 0.81 2.52 0.32
 
Last Coefficient Update
1 2 3 4 5 6
-1.016E-07 1.918E-09 -1.305E-08 -7.190E-07 -2.854E-07 2.108E-08
 
 
7
-6.947E-08
 
Covariate Means
1 2 3 4 5 6 7
5.65 56.58 15.65 0.35 0.28 0.12 0.53
 
Distinct Values For Each Class Variable
Variable 1: 1.0 2.0 3.0 4.0
Variable 2: 0. 1.0
 
Stratum Numbers For Each Observation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 
Number of Missing Values 0
Example 2
This example illustrates the use of PHGLM when there are strata present in the data. The observations from Example 1 are arbitrarily grouped into four strata (the first ten observations form stratum 1, the next 10 for stratum 2, etc.). Otherwise, the problem is unchanged. The resulting coefficients are very similar to those obtained when there is no stratification variable. The model is the same as in Example 1.
 
USE PHGLM_INT
 
IMPLICIT NONE
INTEGER LDCASE, LDCOEF, LDCOV, LDX, MAXCL, NCLVAR, NCOL, NEF, &
NOBS
REAL RATIO
PARAMETER (LDCOEF=7, LDX=40, MAXCL=10, NCLVAR=2, NCOL=8, NEF=5, &
LDCASE=LDX, LDCOV=LDCOEF, NOBS=LDX, RATIO=10000.0)
! SPECIFICATIONS FOR PARAMETERS
INTEGER ICEn, IPRINT, IRT, ISTRAT
PARAMETER (ICEN=2, IPRINT=2, IRT=1, ISTRAT=8)
! SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER IGRP(NOBS), NCLVAL(NCLVAR), NCOEF, NRMISS
REAL ALGL, CASE(LDCASE,5), CLVAL(6), COEF(LDCOEF,4), &
COV(LDCOV,LDCOV), GR(LDCOV), XMEAN(LDCOV)
! SPECIFICATIONS FOR SAVE VARIABLES
INTEGER INDCL(NCLVAR), INDEF(NEF), NVEF(NEF)
REAL X(LDX,NCOL)
SAVE INDCL, INDEF, NVEF, X
! SPECIFICATIONS FOR SUBROUTINES
!
DATA X/411, 126, 118, 92, 8, 25, 11, 54, 153, 16, 56, 21, 287, &
10, 8, 12, 177, 12, 200, 250, 100, 999, 231, 991, 1, 201, &
44, 15, 103, 2, 20, 51, 18, 90, 84, 164, 19, 43, 340, 231, &
5*0, 1, 16*0, 1, 5*0, 1, 11*0, 7, 6, 7, 4, 4, 7, 7, 8, 6, &
3, 8, 4, 6, 4, 2, 5, 5, 4, 8, 7, 6, 9, 5, 7, 2, 8, 6, 5, 7, &
4, 3, 3, 4, 6, 8, 7, 3, 6, 8, 7, 64, 63, 65, 69, 63, 48, &
48, 63, 63, 53, 43, 55, 66, 67, 61, 63, 66, 68, 41, 53, 37, &
54, 52, 50, 65, 52, 70, 40, 36, 44, 54, 59, 69, 50, 62, 68, &
39, 49, 64, 67, 5, 9, 11, 10, 58, 9, 11, 4, 14, 4, 12, 2, &
25, 23, 19, 4, 16, 12, 12, 8, 13, 12, 8, 7, 21, 28, 13, 13, &
22, 36, 9, 87, 5, 22, 4, 15, 4, 11, 10, 18, 7*1, 7*2, 2*3, &
5*4, 7*1, 4*2, 3*3, 5*4, 21*0, 19*1, 10*1, 10*2, 10*3, 10*4/
DATA NVEF/1, 1, 1, 1, 1/, INDEF/3, 4, 5, 6, 7/, INDCL/6, 7/
!
CALL PHGLM (X, IRT, NVEF, INDEF, MAXCL, NCOEF,COEF, ALGL, COV, XMEAN,&
CASE, GR, IGRP, ICEN=ICEN, ISTRAT=ISTRAT, RATIO=RATIO, &
NCLVAR=NCLVAR, INDCL=INDCL, IPRINT=IPRINT, NCLVAL=NCLVAL, &
CLVAL=CLVAL, NRMISS=NRMISS)
!
END
Output
 
Initial Estimates
1 2 3 4 5 6 7
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
 
Method Iteration Step size Maximum scaled Log
coef. update likelihood
Q-N 0 -55.90
Q-N 1 1.0000 0.6748 -45.79
Q-N 2 1.0000 0.7105 -42.85
N-R 3 1.0000 0.2315 -42.59
N-R 4 1.0000 0.1674 -42.55
N-R 5 1.0000 0.3372E-02 -42.55
 
Log-likelihood -42.54570
 
Coefficient Statistics
Standard Asymptotic Asymptotic
Coefficient error z-statistic p-value
1 -0.716 0.170 -4.222 0.000
2 -0.033 0.030 -1.122 0.262
3 0.001 0.015 0.048 0.961
4 -0.100 0.999 -0.100 0.921
5 -0.405 0.729 -0.555 0.579
6 1.136 0.769 1.478 0.139
7 -0.087 1.454 -0.060 0.952
 
Asymptotic Coefficient Covariance
1 2 3 4 5
1 0.2877E-01 0.8662E-03 0.3119E-03 0.5057E-02 0.2480E-01
2 0.8842E-03 -0.8137E-04 -0.7623E-02 -0.6925E-03
3 0.2158E-03 -0.2567E-02 -0.3738E-02
4 0.9975 0.5109
5 0.5319
 
6 7
1 -0.7669E-02 0.6405E-02
2 -0.8800E-03 0.4120E-02
3 0.1170E-02 -0.3699E-02
4 0.1944 0.8056
5 0.1802 0.4905
6 0.5909 0.1858
7 2.114
 
Case Analysis
Survival Cumulative Proportionality
Probability Influence Residual hazard constant
1 0.00 0.00 2.01 7.83 0.26
2 0.09 0.06 1.32 2.42 0.55
3 0.20 0.04 0.40 1.59 0.25
4 0.40 0.04 1.69 0.91 1.87
5 0.92 0.47 0.21 0.09 2.36
6 0.73 NaN 0.14 0.31 0.44
7 0.82 0.47 0.09 0.20 0.44
8 0.55 0.67 0.06 0.61 0.10
9 0.02 0.07 1.59 3.94 0.40
10 0.73 0.10 1.50 0.31 4.79
11 0.39 0.68 0.17 0.93 0.19
12 0.60 0.14 1.12 0.51 2.19
13 0.00 0.00 2.32 6.32 0.37
14 0.90 0.16 0.15 0.10 1.49
15 0.98 0.04 0.75 0.02 35.42
16 0.75 0.21 1.12 0.29 3.83
17 0.25 0.07 1.55 1.39 1.12
18 0.75 0.21 0.63 0.29 2.14
19 0.10 0.18 0.69 2.31 0.30
20 0.03 0.11 1.48 3.60 0.41
21 0.50 0.61 1.00 0.70 1.44
22 0.00 0.00 1.28 13.59 0.09
23 0.33 NaN 1.92 1.09 1.76
24 0.05 0.00 1.32 2.94 0.45
25 0.95 0.15 0.47 0.05 9.84
26 0.33 0.24 0.23 1.09 0.21
27 0.62 0.40 0.22 0.47 0.47
28 0.76 0.13 0.71 0.27 2.63
29 0.50 NaN 0.37 0.70 0.53
30 0.87 0.23 0.49 0.14 3.53
31 0.88 0.35 0.67 0.13 5.07
32 0.71 0.22 1.56 0.34 4.54
33 0.97 0.52 0.20 0.03 7.00
34 0.44 0.03 2.64 0.83 3.19
35 0.56 0.20 0.29 0.57 0.50
36 0.11 0.00 0.61 2.24 0.27
37 0.94 0.19 0.82 0.07 12.50
38 0.79 0.43 0.24 0.23 1.05
39 0.00 0.00 1.69 11.13 0.15
40 0.01 0.00 1.28 4.54 0.28
Last Coefficient Update
1 2 3 4 5 6
-7.363E-07 8.762E-09 1.252E-08 -1.697E-06 -1.642E-06 1.075E-06
 
7
-1.772E-06
 
Covariate Means
1 2 3 4 5 6 7
5.65 56.58 15.65 0.35 0.28 0.12 0.53
 
Distinct Values For Each Class Variable
Variable 1: 1.0 2.0 3.0 4.0
Variable 2: 0. 1.0
 
Stratum Numbers For Each Observation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2
 
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4
 
Number of Missing Values 0