Description Usage Arguments Details Value Note Source References Examples
goodness of fit test for a coxph
object
1 2 3 4 
x 
An object of class 
... 
Additional arguments (not implemented) 
G 
Number of groups into which to divide risk score.
If G = max(2, min(10, ne/40)) where ne is the number of events overall. 
In order to verify the overall goodness of fit, the risk score r[i] for each observation i is given by
r[i] = B.X[i]
where B is the vector of fitted coefficients
and X[i] is the vector of predictor variables for
observation i.
This risk score is then sorted and 'lumped' into
a grouping variable with G groups,
(containing approximately equal numbers of observations).
The number of observed (e) and expected (exp) events in
each group are used to generate a Z statistic for each group,
which is assumed to follow a normal distribution with
Z \sim N(0,1).
The indicator variable indicG
is added to the
original model and the two models are compared to determine the
improvement in fit via the likelihood ratio test.
A list
with elements:
groups 
A

lrTest 
Likelihoodratio test.
Tests the improvement in loglikelihood with addition
of an indicator variable with G1 groups.
This is done with 
The choice of G is somewhat arbitrary but rarely should
be > 10.
As illustrated in the example, a larger value for
G makes the Z test for each group more likely to be significant.
This does not affect the significance of adding the
indicator variable indicG
to the original model.
The Z score is chosen for simplicity, as for large sample sizes
the Poisson distribution approaches the normal. Strictly speaking,
the Poisson would be more appropriate for e and exp as
per Counting Theory.
The Z score may be somewhat conservative as the expected events
are calculated using the martingale residuals from the overall model,
rather than by group. This is likely to bring the expected events
closer to the observed events.
This test is similar to the HosmerLemeshow test for logistic regression.
Method and example are from:
May S, Hosmer DW 1998.
A simplified method of calculating an overall goodnessoffit test
for the Cox proportional hazards model.
Lifetime Data Analysis 4(2):109–20.
Springer (paywall)
Default value for G as per:
May S, Hosmer DW 2004.
A cautionary note on the use of the Gronnesby and Borgan
goodnessoffit test for the Cox proportional hazards model.
Lifetime Data Analysis 10(3):283–91.
Springer (paywall)
Changes to the pbc
dataset in the example are as detailed in:
Fleming T, Harrington D 2005.
Counting Processes and Survival Analysis.
New Jersey: Wiley and Sons. Chapter 4, section 4.6, pp 188.
Wiley (paywall)
1 2 3 4 5 6 7 8 9 10 11  data("pbc", package="survival")
pbc < pbc[!is.na(pbc$trt), ]
## make corrections as per Fleming
pbc[pbc$id==253, "age"] < 54.4
pbc[pbc$id==107, "protime"] < 10.7
### misspecified; should be log(bili) and log(protime) instead
c1 < coxph(Surv(time, status==2) ~
age + log(albumin) + bili + edema + protime,
data=pbc)
gof(c1, G=10)
gof(c1)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.