Exercise 17.1

Part a. With \(n=10\) uncensored observations, the empirical survival function drops by \(1/10 = 0.1\) at each ordered event time.

\(t\) (months) \(\hat{S}(t)\)
\([0, 2)\) 1.000
\([2, 10)\) 0.900
\([10, 14)\) 0.800
\([14, 27)\) 0.700
\([27, 37)\) 0.500
\([37, 44)\) 0.400
\([44, 46)\) 0.300
\([46, 54)\) 0.200
\([54, 60)\) 0.100
\([60, \infty)\) 0.000

(Two events at \(t=27\) cause \(\hat{S}\) to drop by \(2/10 = 0.2\).)

The estimated median (where \(\hat{S}\) first reaches or falls below 0.5) lies between the two event times 27 and 37. Using the standard convention: median \(= (27+37)/2 = 32\) months.

Part b. With \(t=44\) treated as right-censored, the observed data pairs are: \((2,1),\ (10,1),\ (14,1),\ (27,1),\ (27,1),\ (37,1),\ (44,0),\ (46,1),\ (54,1),\ (60,1)\).

KM table:

\(t_{(j)}\) \(n_j\) \(d_j\) \(c_j\) KM factor \(\hat{S}(t_{(j)})\)
2 10 1 0 9/10 0.900
10 9 1 0 8/9 0.800
14 8 1 0 7/8 0.700
27 7 2 0 5/7 0.500
37 5 1 0 4/5 0.400
(44 censored) 4 0 1 — 0.400
46 3 1 0 2/3 0.267
54 2 1 0 1/2 0.133
60 1 1 0 0/1 0.000

The censoring at 44 reduces the risk set at \(t=46\) from 4 to 3, so \(\hat{S}(46) = 0.400 \times 2/3 \approx 0.267\) (vs 0.200 in part a) and \(\hat{S}(54) = 0.267 \times 1/2 \approx 0.133\) (vs 0.100 in part a). The median remains 32 months since the KM estimate before \(t=44\) is unchanged.

Exercise 17.2

Part a. R code:

library(survival)

t <- c(2, 10, 14, 27, 27, 37, 44, 46, 54, 60)
d <- c(1,  1,  1,  1,  1,  1,  0,  1,  1,  1)

km_fit <- survfit(Surv(t, d) ~ 1)
summary(km_fit)
## Call: survfit(formula = Surv(t, d) ~ 1)
## 
##  time n.risk n.event survival std.err lower 95% CI upper 95% CI
##     2     10       1    0.900  0.0949       0.7320        1.000
##    10      9       1    0.800  0.1265       0.5868        1.000
##    14      8       1    0.700  0.1449       0.4665        1.000
##    27      7       2    0.500  0.1581       0.2690        0.929
##    37      5       1    0.400  0.1549       0.1872        0.855
##    46      3       1    0.267  0.1501       0.0885        0.803
##    54      2       1    0.133  0.1205       0.0227        0.784
##    60      1       1    0.000     NaN           NA           NA
plot(km_fit,
     xlab = "Time (months)",
     ylab = "Survival probability",
     main = "KM estimate: colorectal cancer",
     conf.int = TRUE)

Part b. At \(t = 11\), the KM estimate uses all event times \(\leq 11\), i.e., \(t = 2\) and \(t = 10\).

\(\hat{S}(11) = \frac{9}{10} \times \frac{8}{9} = 0.800\) = 0.800.

Greenwood’s variance: \[\widehat{\mathrm{Var}}(\hat{S}(11)) = [\hat{S}(11)]^2 \sum_{t_{(j)} \leq 11} \frac{d_j}{n_j(n_j - d_j)} = (0.800)^2 \left(\frac{1}{10 \times 9} + \frac{1}{9 \times 8}\right).\]

Computing the sum: \(1/90 + 1/72 = 0.01111 + 0.01389 = 0.02500\).

\(\widehat{\mathrm{Var}}(\hat{S}(11)) = 0.64 \times 0.02500 = 0.0160\).

Standard deviation \(= \sqrt{0.0160} \approx\) 0.1265.

Approximate 95% CI (linear scale): \[0.800 \pm 1.96 \times 0.1265 = 0.800 \pm 0.248 = (0.552,\ 1.048).\]

Truncating to \([0,1]\): 95% CI for \(S(11)\) is \([0.552,\ 1.000]\).

Exercise 17.3

Part a. Let \(g(x) = \log(x/(1-x)) = \log x - \log(1-x)\).

Differentiating: \(g'(x) = 1/x + 1/(1-x) = 1/(x(1-x))\).

By the delta method: \[\mathrm{Var}\!\left(g(\hat{S}(t))\right) \approx \left[g'(S(t))\right]^2 \mathrm{Var}\!\left(\hat{S}(t)\right) = \frac{1}{[S(t)(1-S(t))]^2}\,\mathrm{Var}\!\left(\hat{S}(t)\right).\]

Substituting Greenwood’s formula \(\widehat{\mathrm{Var}}(\hat{S}(t)) = [\hat{S}(t)]^2 \sum_{t_{(j)}\leq t} d_j/(n_j(n_j - d_j))\):

\[\widehat{\mathrm{Var}}\!\left(\hat{S}_{\text{logit}}(t)\right) = \frac{[\hat{S}(t)]^2}{[\hat{S}(t)(1-\hat{S}(t))]^2} \sum_{t_{(j)}\leq t} \frac{d_j}{n_j(n_j-d_j)} = \frac{1}{[1-\hat{S}(t)]^2} \sum_{t_{(j)}\leq t} \frac{d_j}{n_j(n_j-d_j)}.\]

Equivalently, \(\hat\sigma_L = \hat\sigma_{\mathrm{GW}}/[\hat{S}(t)(1-\hat{S}(t))]\), where \(\hat\sigma_{\mathrm{GW}} = \hat{S}(t)\sqrt{\sum_{t_{(j)}\leq t} d_j/(n_j(n_j-d_j))}\) is the Greenwood standard deviation.

Part b. A \(95\%\) confidence interval on the logit scale is: \[\tilde{s}^{\pm} = \hat{S}_{\text{logit}}(t) \pm z_{0.975}\,\hat\sigma_L.\]

Back-transforming via the inverse logit \(g^{-1}(u) = 1/(1 + e^{-u})\): \[\text{CI for }S(t): \quad \left[\frac{1}{1+e^{-\tilde{s}^-}},\ \frac{1}{1+e^{-\tilde{s}^+}}\right].\]

This CI is guaranteed to lie in \((0,1)\) because the inverse logit maps \(\mathbb{R}\) into \((0,1)\). By contrast, the plain Greenwood interval can exceed 1 (as in Exercise 17.2, where the upper bound was 1.048).

Exercise 17.4

Part a. The Kaplan–Meier estimator strictly requires exact event times. Since the ulcer times here are only known to have occurred within the interval since the previous daily check (i.e. they are interval-censored), applying KM requires the simplifying assumption that the day an ulcer is detected can be treated as if it were the exact day it occurred. This is a reasonable approximation when the checking interval (one day) is short relative to the overall timescale of the study (12 days).

Part b. Treating the withdrawn patients as censored at day 6 and the completers as censored at day 12:

\(t_{(j)}\) \(n_j\) \(d_j\) KM factor \(\hat{S}(t_{(j)})\)
1 20 1 \(19/20\) 0.950
2 19 3 \(16/19\) 0.800
5 16 2 \(14/16\) 0.700
(6, censored) 14 0 — 0.700 (risk set drops to 9)
8 9 4 \(5/9\) 0.389
(12, censored) 5 0 — 0.389

Working: \(\hat{S}(1) = 19/20 = 0.950\); \(\hat{S}(2) = 0.950 \times 16/19 = 0.800\); \(\hat{S}(5) = 0.800 \times 14/16 = 0.700\); the 5 withdrawals at day 6 reduce the risk set from 14 to 9 before day 8 but contribute no factor; \(\hat{S}(8) = 0.700 \times 5/9 \approx 0.389\); the final 5 completers are censored at day 12 with no further events, so \(\hat{S}\) stays at 0.389.

Part c. The Kaplan–Meier estimate of the probability of remaining ulcer-free for the full 12-day study is \(\hat{S}(12) \approx\) 0.389.

Comparing with Exercise 15.2: \(\hat p_a = 0.500\), \(\hat p_b = 0.250\), \(\hat p_c \approx 0.333\). The KM estimate (0.389) falls between the exclude-censored estimate (c) and the ignore-censoring estimate (a), and above the treat-as-events estimate (b). This makes sense: KM correctly credits the 5 withdrawn patients with surviving ulcer-free through day 6 (more than approach (b), which wrongly counts them as ulcer cases, and more than approach (c), which discards them entirely), but — unlike approach (a) — it does not assume they would have remained ulcer-free for the rest of the study, so it comes in below that fully optimistic figure.

End of Solutions to Exercises 17