Exercise 18.1

Part a. Since \(\hat{S}(t)\) is a step function, \(t(P)\) is simply the smallest observed event time at which \(\hat{S}(t)\) first drops to or below \(1-P/100\) – no interpolation needed. For example, for \(P=50\) we need \(S \le 0.500\): Group I’s \(\hat{S}\) drops from \(0.545\) at \(t=54\) to \(0.455 \le 0.500\) at \(t=59\), so \(t_I(50) = 59\).

\(P\) Required \(S\) Group I \(t(P)\) Group II \(t(P)\)
10 0.90 30 54
20 0.80 31 86
30 0.70 44 111
40 0.60 54 152
50 0.50 59 195
60 0.40 88 212
70 0.30 111 212
80 0.20 139 301
90 0.10 149 357

(At \(P=60\) and \(P=70\), Group II gives the same value, \(212\): the single event there is large enough to drop \(\hat{S}\) past both thresholds at once.)

Part b. R code:

library(survival)

# Group I: 1 censored observation, at t=70
t1 <- c(25, 30, 31, 44, 54, 59, 70, 88, 111, 139, 149)
d1 <- c(1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1)
km1 <- survfit(Surv(t1, d1) ~ 1)

# Group II: 2 censored observations, at t=25 and t=187
t2 <- c(25, 54, 86, 111, 152, 187, 195, 212, 301, 357)
d2 <- c(0, 1, 1, 1, 1, 0, 1, 1, 1, 1)
km2 <- survfit(Surv(t2, d2) ~ 1)

H1 <- -log(km1$surv)
H2 <- -log(km2$surv)
ok1 <- is.finite(log(H1))
ok2 <- is.finite(log(H2))

par(mfrow = c(1, 2))
plot(log(km1$time)[ok1], log(H1)[ok1], xlab = "log(t)", ylab = "log(H(t))",
     main = "Group I", pch = 16)
abline(lm(log(H1)[ok1] ~ log(km1$time)[ok1]), col = "red", lty = 2)

plot(log(km2$time)[ok2], log(H2)[ok2], xlab = "log(t)", ylab = "log(H(t))",
     main = "Group II", pch = 16)
abline(lm(log(H2)[ok2] ~ log(km2$time)[ok2]), col = "blue", lty = 2)

(\(\log\hat H(t)\) is undefined (\(-\infty\) or \(\infty\)) at \(\hat S(t)=1\) or \(\hat S(t)=0\) – e.g. Group II’s first point, \(t=25\), is censored so \(\hat S=1\) there – so these points are dropped via is.finite(), exactly as in the worked Weibull-check example earlier in this chapter.)

Both plots show a reasonably straight-line trend, supporting a Weibull model for each group’s survival times.

Part c. Fitting a line by eye (or by least squares) to each plot gives approximate slope/intercept pairs:

The two groups have very similar graphical estimates of \(\gamma\) (around 1.6), suggesting a common shape, but Group I’s much larger \(\hat\lambda\) indicates a substantially higher hazard than Group II – consistent with Group I’s shorter survival times seen in the percentile table in part (a).

Exercise 18.2

Part a. R code:

library(survival)

fit1 <- survreg(Surv(t1, d1) ~ 1, dist = "weibull")
fit2 <- survreg(Surv(t2, d2) ~ 1, dist = "weibull")

gamma1_hat <- 1 / fit1$scale
lambda1_hat <- exp(-gamma1_hat * coef(fit1))

gamma2_hat <- 1 / fit2$scale
lambda2_hat <- exp(-gamma2_hat * coef(fit2))

cat("Group I:  gamma =", gamma1_hat, " lambda =", lambda1_hat, "\n")
## Group I:  gamma = 1.839091  lambda = 0.0002738701
cat("Group II: gamma =", gamma2_hat, " lambda =", lambda2_hat, "\n")
## Group II: gamma = 2.070751  lambda = 1.415195e-05

This gives \(\hat\gamma_{\text I} \approx 1.84\), \(\hat\lambda_{\text I} \approx 2.74\times10^{-4}\), and \(\hat\gamma_{\text{II}} \approx 2.07\), \(\hat\lambda_{\text{II}} \approx 1.42\times10^{-5}\). These are reasonably close to the graphical estimates from 18.1(c) (which used only the KM jump points visually fitted by eye, so some discrepancy is expected) – both methods agree that \(\hat\gamma\) is similar across the two groups (roughly 1.6–2.1) and that \(\hat\lambda_{\text I} \gg \hat\lambda_{\text{II}}\).

Part b. Since \(\hat\gamma_{\text I} \approx 1.84\) and \(\hat\gamma_{\text{II}} \approx 2.07\) are fairly close, we can approximate the hazard ratio using the fitted \(\hat\lambda\)’s: \[ \frac{\hat\lambda_{\text I}}{\hat\lambda_{\text{II}}} = \frac{2.74\times10^{-4}}{1.42\times10^{-5}} \approx 19. \] Group I has a hazard roughly 19 times higher than Group II, i.e. Group I patients experience the event much sooner – consistent with parts (a) and (c) of Exercise 18.1, where Group I’s percentiles were consistently far smaller (shorter survival times) than Group II’s.

End of Solutions to Exercises 18