For replacements for R code that no longer works due to changes in the R system or R packages, see this
Further errata compiled by Nick Cox, Durham University, July 2022 are here.
Abbreviation | Meaning |
---|---|
Pg | Page |
L | Line |
Pr | Paragraph |
b | From Bottom (ignoring equations) |
Eq | Equation |
✅ | Corrected in master file |
Location | Change | Status |
---|---|---|
Pg i | Feinberg should be Fienberg | |
Pg 150 | Changes in ggplot2 require code changes (4) below |
✅ |
Pg 174 | Dotted blue line is missing in Figure 8.5. It should be at y=3958 | ✅ |
Pg 179 | Spline model in first large box - see (2) | ✅* |
Pg 184 Fig. 9.2 | Caption should have log L not just L | ✅ |
Pg 240 | Table 10.4 114.51 should be 114.41 | ✅ |
Pg 256 R code | x=TRUE, y=TRUE should be x=TRUE, y=TRUE, data=sex.age.response | ✅ |
Pg 256 R code | which.influence(f, .4) should be round(resid(f, ‘dfbetas’), 1) | ✅ |
Pg 306 | five completed datasets should be twenty completed datasets plus 2 other places | ✅ |
Pg 313 last Pr | proportional hazards should be proportional odds | ✅ |
Pg 317 top | linearity if should be linearity of | ✅ |
Pg 360 2 lines under Eq 15.1 | X should be X subscript i | |
Pg 362 Eq. 15.7 | n should be k | ✅ |
Pg 373 Fig. 15.4 | Was run with default family (logistic) instead of intended family=‘loglog’; agreement increases | ✅ |
Pg 378 | family=“loglog” can be family=loglog | ✅ |
Pg 474 | g 0.033 gr 1.959 should be g=1.959 gr=7.095 | ✅ |
Pg 508 Fig. 20.8 | Omitted text (1) and index under figure | ✅ |
Pg 516 top | Code for Fig. 20.7: see this | |
Pg 516 bottom | Code for Fig. 20.10: see this | |
Pg 526 | 3 paragraphs (3) omitted before rcspline.plot(lvef, d.time, event=cdeath, nk=3) due to omission of @ in previous chunk | ✅ |
*
Denotes places in the master text where changes are indicated with TODO and lines need to be uncommented.
You can see that the ratio is not stable from 160 to 190 days, but is mostly flat thereafter. Interval-specific estimates of the group 2 : group 1 log hazard ratios are shown in Table~ with intervals specified to yield equal numbers of deaths. The Efron likelihood was used. [had omitted @ to close knitr
chunk above]
To make the model converge, and to actually show a dotted blue line, the model had to have some splines reduced from 5 knots to 4 knots:
f <- cph(S ~ rcs(sz,4) + rcs(sg,4) + rcs(log(ap),5) +
rcs(sbp,4) + rcs(dbp,4) + rcs(age,3) + rcs(wt,4) +
rcs(hg,4) + ekg + pf + bm + hx,
tol=1e-14, data=imputed)
New text interpreting the results: The model allowing all continuous predictors to be nonlinear is better than the linear full model but not b etter than the 5 component model.
The standard errors of log survival probabilities computed by cph
and the confidence intervals derived by the associated functions survest
and survplot
are only proper when the model contains only stratification factors or when predictions are made at the means of all covariables, unless you store in the fit object the data used in fitting the model using the options x=TRUE, y=TRUE
. The survfit.cph
and survest
functions are modifications of Therneau’s survfit.coxph
function that can obtain predicted survival probabilities and confidence intervals for any setting of predictors. survfit.cph
and survest
are called as needed when you request plots.
The survest
function is used to obtain predicted survival curves or survival at a given vector of times, for a desired set of predictor values and a fit produced by cph
. Confidence limits may be obtained also, as can the standard error of the log–log survival.
The survplot
function is similar in some ways to the Predict
and plot
, but it plots follow-up time on the \(x\)-axis. It plots step-function survival curves with confidence bands or confidence bars for Cox models.
Figure~ was produced using …
require(data.table)
cdystonia <- data.table(cdystonia)
cdys <- cdystonia[, j=as.list(quantile(twstrs, (1 : 3)/4)),
by = list(treat, week)]
cdys <- upData(cdys, rename=c('25%'='Q1', '50%'='Q2', '75%'='Q3'))
ggplot(cdys, aes(x=week, y=Q2)) + xl + yl + ylim(0, 70) +
geom_line() + facet_wrap(~ treat, nrow=2) +
geom_ribbon(aes(ymin=Q1, ymax=Q3), alpha=0.2)