1 들어가며 — 점추정에서 구간추정으로
04-1 편이 KM·NA 의 점추정 을 다뤘다면, 본 편은 그 위에 불확실성 을 측정한다.
| 편 | 주제 |
|---|---|
| Ch.4 Overview | 7 개 절 조망 |
| § 4.1~4.2 | KM·NA 점추정 + 분산 |
| § 4.3~4.4 (본 편) | 고정 시점 신뢰구간 + 전체 곡선 신뢰대 |
| § 4.5 (예정) | Mean · Median |
| § 4.6 (예정) | Left-Truncation |
| § 4.7 (예정) | Competing Risks |
“\(\widehat{S}(t_o)\) 의 점별 신뢰구간 (§ 4.3) 은 한 시점에 대한 95% 보장이고, 전체 \(S(t)\) 의 신뢰대 (§ 4.4) 는 시간 구간 전체에 대한 95% 보장이다. 두 개념을 혼동하면 — pointwise CI 를 모든 \(t\) 에 그어 confidence band 라 부르는 — 흔한 함정에 빠진다. 두 경우 모두 변환 (linear/log/arcsine) 과 critical value 의 구성에서 Brownian bridge 의 weak convergence 가 작동한다.”
비유: 사격장에서 100 발 쏠 때
- Pointwise 95%: 1 발마다 95% 확률로 표적에 맞음. 100 발 중 5 발 정도는 빗나감.
- Band 95%: 100 발 모두가 표적에 맞을 확률이 95%. 한 발이라도 빗나가면 실패.
같은 95% 라도 두 번째가 훨씬 강한 보장. 사격장의 표적이 더 커야 (= band 가 더 넓어야) 한다.
생존곡선 비유:
- Pointwise CI: “1 년 시점에서 \(S(365)\) 가 95% 확률로 (0.39, 0.71)”.
- Confidence band: “100~600 일 모든 시점에서 \(S(t)\) 가 95% 확률로 band 안”.
→ confidence band 가 pointwise CI 보다 언제나 더 넓다. 이것이 § 4.4 가 § 4.3 다음에 별도 절로 등장하는 이유.
2 § 4.3 — Pointwise Confidence Intervals for \(S(t)\)
2.1 Linear CI (식 4.3.1)
100(1-α)% 신뢰구간:
\[ \widehat{S}(t_o) \pm Z_{1-\alpha/2} \cdot \sigma_S(t_o) \cdot \widehat{S}(t_o) \]
여기서 \(\sigma_S^2(t) = \widehat{V}[\widehat{S}(t)]/\widehat{S}^2(t)\) (Greenwood 의 누적합 부분).
Theoretical Note 9 (Ch.4 § 4.2) 의 Gaussian process weak convergence: \(\sqrt{n}(\widehat{S}(t) - S(t))\) 는 점근적으로 평균 0 의 정규분포.
→ 자연스러운 신뢰구간:
\[ \widehat{S}(t_o) \pm Z_{1-\alpha/2} \cdot \text{SE}[\widehat{S}(t_o)] \]
표준오차 \(\text{SE} = \sqrt{\widehat{V}[\widehat{S}]} = \sigma_S \cdot \widehat{S}\) (Greenwood 의 표준 형태) 를 대입하면 식 4.3.1.
대부분 통계 패키지의 default — R survival::survfit(..., conf.type="plain") 등.
문제 1 — \([0, 1]\) 을 벗어날 수 있음:
\(\widehat{S}\) 가 0 또는 1 에 가깝거나 SE 가 크면 CI 가 도메인을 벗어남.
예: \(\widehat{S}(t_o) = 0.05\), \(\text{SE} = 0.04\) → 95% CI = \(0.05 \pm 1.96 \cdot 0.04 = (-0.028, 0.128)\). 음의 생존확률은 무의미.
실무 처방: clip to \([0, 1]\), 즉 \(\max(0, L)\) 와 \(\min(1, U)\). 그러나 이는 ad-hoc 처리.
문제 2 — 소표본 coverage 미달:
\(\widehat{S}\) 의 표집분포는 finite sample 에서 비대칭 (skewed). 대칭 ± 형태의 CI 는 nominal level (예: 95%) 보다 낮은 실제 coverage 를 갖는다 (Borgan-Liestøl 1990 의 시뮬레이션).
→ 변환된 CI 가 필요.
2.2 Log-transformed CI (식 4.3.2)
\[ \left[\widehat{S}(t_o)^{1/\theta}, \, \widehat{S}(t_o)^{\theta}\right], \quad \theta = \exp\left\{\frac{Z_{1-\alpha/2} \, \sigma_S(t_o)}{\ln \widehat{S}(t_o)}\right\} \]
(주의: \(\widehat{S} < 1\) 이므로 \(\ln \widehat{S} < 0\), \(\theta\) 는 양수. \(\theta > 1\) 이면 \(S^{\theta} < S < S^{1/\theta}\)).
이 CI 는 “log-log transformation” 으로도 불린다. 두 단계 변환의 결과.
Step 1 — survival 을 cumulative hazard 로:
\(H(t) = -\ln S(t)\). \(S \in (0, 1)\) → \(H \in (0, \infty)\). 도메인이 한쪽으로만 열림.
Step 2 — cumulative hazard 의 log:
\(\ln H \in (-\infty, \infty)\) — 정규분포의 자연 도메인.
Step 3 — \(\ln H\) 의 정규성 가정:
\[ \ln \widehat{H}(t_o) \approx N\left(\ln H(t_o), \, \text{Var}[\ln \widehat{H}]\right) \]
delta method: \(\text{Var}[\ln \widehat{H}] = \text{Var}[\widehat{H}]/H^2\). \(\widehat{H} = -\ln \widehat{S}\), \(\text{Var}[\widehat{H}] = \text{Var}[\widehat{S}]/\widehat{S}^2 = \sigma_S^2\). 따라서
\[ \text{Var}[\ln \widehat{H}(t_o)] \approx \frac{\sigma_S^2(t_o)}{[\ln \widehat{S}(t_o)]^2} \]
Step 4 — \(\ln H\) 의 신뢰구간:
\[ \ln \widehat{H} \pm Z_{1-\alpha/2} \cdot \frac{\sigma_S}{\ln \widehat{S}} \]
Step 5 — 역변환:
\(\ln \widehat{H} = \ln(-\ln \widehat{S})\). 양변 exp:
\[ \widehat{H} \cdot \exp(\pm Z \sigma_S / \ln \widehat{S}) = -\ln \widehat{S} \cdot \theta^{\pm 1} \]
\(\theta = \exp(Z \sigma_S / \ln \widehat{S})\) 로 정의. 다시 \(S = \exp(-H)\) 로 변환:
\[ \widehat{S}^{\theta} \leq S \leq \widehat{S}^{1/\theta} \]
→ 식 4.3.2.
핵심: 두 번의 단조 변환 (\(S \to H \to \ln H\)) + 정규근사 + 역변환. 결과: CI 가 자연스럽게 \([0, 1]\) 안에 머묾, 비대칭 (위쪽으로 더 넓음 — 점추정이 작을수록).
2.3 Arcsine-Square-Root CI (식 4.3.3)
\[ \sin^2\left\{\arcsin\sqrt{\widehat{S}(t_o)} \pm \frac{1}{2} Z_{1-\alpha/2} \cdot \sigma_S(t_o) \cdot \sqrt{\frac{\widehat{S}(t_o)}{1 - \widehat{S}(t_o)}}\right\} \]
상한: \(\min(\pi/2, \cdot)\), 하한: \(\max(0, \cdot)\) 로 clip (sin² 이 \([0, 1]\) 을 벗어나지 않도록).
이항분포 \(X \sim \text{Binomial}(n, p)\) 에서 비율 \(\widehat{p} = X/n\) 의 분산:
\[ \text{Var}(\widehat{p}) = \frac{p(1-p)}{n} \]
→ 분산이 \(p\) 에 따라 변동 (\(p = 0.5\) 에서 최대, 양 끝에서 0).
\(\arcsin\sqrt{p}\) 변환:
\(g(p) = \arcsin\sqrt{p}\), \(g'(p) = \frac{1}{2\sqrt{p(1-p)}}\). delta method:
\[ \text{Var}[\arcsin\sqrt{\widehat{p}}] \approx [g'(p)]^2 \cdot \frac{p(1-p)}{n} = \frac{1}{4n} \]
→ \(p\) 에 의존하지 않는 고정 분산 (\(1/(4n)\)). “variance stabilizing”.
KM 에 적용: \(\widehat{S}\) 를 비율로 보고 같은 변환. 신뢰구간을 변환된 공간에서 만든 후 역변환.
- 변환된 공간 \(\arcsin\sqrt{\widehat{S}}\) 의 분산: delta method 로 도출 → \(\sigma_S^2 \cdot \widehat{S}/[4(1-\widehat{S})]\).
- CI: \(\arcsin\sqrt{\widehat{S}} \pm Z \sqrt{\sigma_S^2 \widehat{S}/[4(1-\widehat{S})]} = \arcsin\sqrt{\widehat{S}} \pm 0.5 Z \sigma_S \sqrt{\widehat{S}/(1-\widehat{S})}\).
- 역변환: \(\sin^2(\cdot)\).
효과:
- \(\widehat{S}\) 가 0 또는 1 에 가까울 때 (작은 분산 영역) 도 일관된 coverage.
- \([0, 1]\) 자동 보장 (\(\sin^2 \in [0, 1]\)).
- Linear/log 보다 양 끝에서 더 안정.
2.4 누적위험 (cumulative hazard) 에 대한 CI 3 종
Linear (식 4.3.4): \[ \widetilde{H}(t_o) \pm Z_{1-\alpha/2} \cdot \sigma_H(t_o) \]
Log-transformed (식 4.3.5): \[ \left[\widetilde{H}(t_o)/\phi, \, \phi \cdot \widetilde{H}(t_o)\right], \quad \phi = \exp\left[\frac{Z_{1-\alpha/2} \, \sigma_H(t_o)}{\widetilde{H}(t_o)}\right] \]
Arcsine-sqrt transformed (식 4.3.6): \(S = \exp(-H)\) 의 arcsine 변환을 \(H\) 로 역변환. 자세한 식은 Klein 식 4.3.6 참조.
\(\ln \widetilde{H}\) 가 점근 정규.
- delta method: \(\text{Var}[\ln \widetilde{H}] = \text{Var}[\widetilde{H}]/\widetilde{H}^2 = \sigma_H^2/\widetilde{H}^2\).
- CI for \(\ln H\): \(\ln \widetilde{H} \pm Z \sigma_H/\widetilde{H}\).
- 역변환: \(\widetilde{H} \cdot \phi^{\pm 1}\) where \(\phi = \exp(Z \sigma_H/\widetilde{H})\).
→ 이 형태가 식 4.3.5. \(H > 0\) 의 자연 도메인을 보존하고, \(\widetilde{H}\) 가 작을 때 (이른 시점) CI 가 비대칭으로 위쪽으로 길어진다.
2.5 Practical Note 5 — pointwise CI 를 단순 연결하지 말 것
매 시점 \(t\) 의 95% pointwise CI 를 그어 곡선으로 연결하고 “이 band 안에 \(S(t)\) 가 95% 확률로 있다” 라고 말하는 것은 잘못.
- 각 점에서 95%: \(P[L(t_o) \leq S(t_o) \leq U(t_o)] = 0.95\).
- 모든 점 동시: \(P[L(t) \leq S(t) \leq U(t), \forall t \in [t_L, t_U]] < 0.95\) — multiple comparison 의 본질로, 실제로는 더 작음.
→ “곡선 전체가 band 에 들어갈 확률” 의 보장은 § 4.4 의 진짜 confidence band 에서.
2.6 Klein Example 4.2 — BMT ALL 1 년 시점 95% CI 비교
ALL 38 명의 1 년 (365 일) 무병 생존 (Klein Table 4.3):
- \(\widehat{S}(365) = 0.5492\).
- \(\widehat{V}[\widehat{S}(365)] = 0.0812^2 = 0.00659\).
- \(\sigma_S(365) = \sqrt{\widehat{V}}/\widehat{S} = 0.0812/0.5492 = 0.1479\).
- \(Z_{0.975} = 1.96\).
Linear (식 4.3.1):
\[ 0.5492 \pm 1.96 \cdot 0.1479 \cdot 0.5492 = 0.5492 \pm 0.1592 = (0.3900, 0.7084) \]
Log-transformed (식 4.3.2):
\[ \theta = \exp\left[\frac{1.96 \cdot 0.1479}{\ln 0.5492}\right] = \exp\left[\frac{0.2899}{-0.5994}\right] = \exp(-0.4836) = 0.6165 \]
CI: * 하한: \(\widehat{S}^{1/\theta} = 0.5492^{1/0.6165} = 0.5492^{1.622} = 0.3783\). * 상한: \(\widehat{S}^{\theta} = 0.5492^{0.6165} = 0.6911\).
→ \((0.3783, 0.6911)\).
Arcsine-sqrt (식 4.3.3):
- \(\arcsin\sqrt{0.5492} = \arcsin(0.7411) = 0.8350\) (radian).
- \(\sqrt{0.5492/(1-0.5492)} = \sqrt{0.5492/0.4508} = \sqrt{1.2185} = 1.1039\).
- 반폭: \(0.5 \cdot 1.96 \cdot 0.1479 \cdot 1.1039 = 0.1600\).
- 변환된 공간 CI: \(0.8350 \pm 0.1600 = (0.6750, 0.9950)\).
- 역변환: \(\sin^2(0.6750) = 0.3903\), \(\sin^2(0.9950) = 0.7032\).
→ \((0.3903, 0.7032)\).
비교:
| 방법 | 95% CI for \(S(365)\) | 폭 | 중심 vs \(\widehat{S}=0.5492\) |
|---|---|---|---|
| Linear | (0.3900, 0.7084) | 0.3184 | 대칭 |
| Log-transformed | (0.3783, 0.6911) | 0.3128 | 위쪽 약간 길다 |
| Arcsine-sqrt | (0.3903, 0.7032) | 0.3129 | 위쪽 약간 길다 |
세 CI 의 중심값과 폭이 거의 같다. 차이는 양 끝의 비대칭성. 변환된 두 CI 가 sampling distribution 의 skewness 를 반영.
2.7 3 그룹 1 년 시점 비교 (Klein Table 4.4)
| ALL | AML low | AML high | |
|---|---|---|---|
| \(\widehat{S}(365)\) | 0.5492 | 0.7778 | 0.3778 |
| \(\sqrt{\widehat{V}}\) | 0.0812 | 0.0566 | 0.0723 |
| \(\sigma_S\) | 0.1479 | 0.0728 | 0.1914 |
| Linear CI | (0.39, 0.71) | (0.67, 0.89) | (0.24, 0.52) |
| Log-transformed | (0.38, 0.69) | (0.64, 0.87) | (0.24, 0.52) |
| Arcsine-sqrt | (0.39, 0.70) | (0.66, 0.88) | (0.24, 0.52) |
해석: AML low 와 AML high 의 CI 가 명확히 분리 (0.66 ≤ AML low vs AML high ≤ 0.52). ALL 은 두 AML 군 사이.
2.8 Borgan-Liestøl (1990) — 변환의 우월성
Borgan & Liestøl (1990) 의 광범위한 시뮬레이션 (다양한 표본 크기, censoring 비율) 결과:
| CI | 형태 | \([0, 1]\) 보장 | 소표본 coverage | 권장 |
|---|---|---|---|---|
| Linear | 대칭 \(\widehat{S} \pm Z\sigma_S\widehat{S}\) | X | nominal 보다 낮음 | 큰 표본만 (\(n > 200\)) |
| Log-transformed | 비대칭 | O | 약간 낮음 | 표준 권장 |
| Arcsine-sqrt | 비대칭 | O | 약간 높음 (보수적) | 매우 작은 표본 |
적용 임계값:
- \(n \geq 25\) + censoring \(\leq 50\%\): log 또는 arcsine 모두 적정 coverage.
- 매우 작은 표본 또는 극단 tail: arcsine 약간 더 안정.
- 매우 큰 표본 (\(n > 1000\)): 세 방법 점근적으로 동치.
R 사용법:
survfit(Surv(time, status) ~ 1, conf.type = "plain") # linear (default)
survfit(Surv(time, status) ~ 1, conf.type = "log-log") # log-transformed (식 4.3.2)
# arcsine-sqrt 는 직접 구현 필요 (R survival 미지원)Python lifelines 의 default 도 log-log 변환.
3 § 4.4 — Confidence Bands for the Survival Function
3.1 동기 — pointwise 의 한계
§ 4.3 의 pointwise CI: 한 시점 \(t_o\) 에 대한 보장.
- “\(P[L(t_o) \leq S(t_o) \leq U(t_o)] = 0.95\)”.
Confidence band: 시간 구간 전체에 대한 보장.
- “\(P[L(t) \leq S(t) \leq U(t), \forall t \in [t_L, t_U]] = 0.95\)”.
두 번째가 훨씬 강한 진술. 같은 95% 라도 confidence band 가 언제나 더 넓음.
연구 보고서에서 “이 band 는 95% 확률로 곡선을 포함한다” 는 진술이 의도된다면, 반드시 § 4.4 의 진짜 band 사용. pointwise CI 를 그대로 그어 해석하면 잘못.
3.2 Brownian Bridge 의 등장
KM 추정량의 점근 행동 (Aalen 1975, Andersen et al. 1993):
\[ \sqrt{n}\left(\frac{\widehat{S}(t) - S(t)}{S(t)}\right) \xrightarrow{d} W^*(\sigma^2(t)) \]
where \(W^*\) is a Brownian bridge — Brownian motion 이 양 끝 (0, 1) 에서 0 으로 묶인 process.
왜 Brownian bridge 인가:
- 시작 시점 \(t = 0\): \(\widehat{S}(0) = S(0) = 1\) → 차이 = 0.
- 끝 시점 (모든 사람이 죽음): \(\widehat{S} = S = 0\) → 차이 = 0.
- 중간: random fluctuation.
→ 시작과 끝이 0 으로 고정된 random process = Brownian bridge.
Confidence band 의 도출:
\[ 1 - \alpha = P\left[|W^*(x)| < c \text{ for all } x \in [a_L, a_U]\right] \]
\(\sup_{x \in [a_L, a_U]} |W^*(x)|\) 의 분포는 알려진 표 (Appendix C.4). 이 sup 의 critical value \(k_\alpha\) 가 band 폭을 결정.
3.3 EP (Equal Precision) Band — Nair (1984)
먼저 표본 크기 보정 \(a_L, a_U\) 계산:
\[ a_L = \frac{n \sigma_S^2(t_L)}{1 + n \sigma_S^2(t_L)}, \quad a_U = \frac{n \sigma_S^2(t_U)}{1 + n \sigma_S^2(t_U)} \]
조건: \(0 < a_L < a_U < 1\) — 즉 \(t_L > t_1\) (첫 사건 시점) 이고 위험집합이 충분히 작아져 있어야 함.
Klein Appendix C.3 표에서 \(c_\alpha(a_L, a_U)\) 조회.
Linear band (식 4.4.2): \[ \widehat{S}(t) \pm c_\alpha(a_L, a_U) \cdot \sigma_S(t) \cdot \widehat{S}(t) \]
Log-transformed (식 4.4.3) + Arcsine-sqrt (식 4.4.4): pointwise CI 의 \(Z_{1-\alpha/2}\) 만 \(c_\alpha\) 로 교체. 형태는 식 4.3.2·4.3.3 과 동일.
표준화된 KM process 의 분산:
\[ \text{Var}\left[\frac{\widehat{S}(t) - S(t)}{S(t)}\right] \approx \frac{\sigma^2(t)}{n} \]
여기서 \(\sigma^2(t) = \int_0^t dF/[(1-F)^2 G^{-1}] \to \infty\) as \(t \to t_{\max}\).
→ 분산이 시간에 따라 변동 (이른 시점은 작고, 늦은 시점은 큼).
EP 의 핵심: 표준화 process 를 \(q(x) = [x(1-x)]^{-1/2}\) 로 한 번 더 변환하여 모든 \(x\) 에서 같은 분산을 갖게 만든다 (equal precision).
- \(a_L < x < a_U\) 영역에서 변환된 process 의 분산이 일정.
- 이를 sup 한 결과의 critical value \(c_\alpha\) 가 Appendix C.3.
왜 이름이 “equal precision”: 모든 \(t\) 에서 같은 정밀도로 신뢰대를 만든다는 의미. pointwise CI 와 동일한 형태 (\(\sigma_S \cdot \widehat{S}\) 곱) 를 유지하되 \(Z\) 만 \(c_\alpha\) 로 키운다.
3.4 Hall-Wellner Band — Hall & Wellner (1980)
Klein Appendix C.4 표에서 \(k_\alpha(a_L, a_U)\) 조회.
Linear (식 4.4.5): \[ \widehat{S}(t) \pm \frac{k_\alpha(a_L, a_U) \, [1 + n \sigma_S^2(t)]}{n^{1/2}} \cdot \widehat{S}(t) \]
Log-transformed (식 4.4.6): \[ \left[\widehat{S}(t)^{1/\theta}, \, \widehat{S}(t)^{\theta}\right], \quad \theta = \exp\left\{\frac{k_\alpha(a_L, a_U)\,[1 + n\sigma_S^2(t)]}{n^{1/2} \ln \widehat{S}(t)}\right\} \]
Arcsine-sqrt (식 4.4.7): pointwise 의 \(Z \sigma_S\) 를 \(k_\alpha[1 + n\sigma_S^2]/n^{1/2}\) 로 교체.
EP 와의 차이: \(t_L = 0\) 허용 — 시작 시점부터 band 가능. 단 \(a_L = 0\) 이 되는 영역에서는 분산이 0 이라 band 가 좁아짐.
EP band 의 폭: \(c_\alpha \cdot \sigma_S \cdot \widehat{S}\) — pointwise CI 와 정확히 동일 형태에 \(c_\alpha/Z\) 비율로 확대.
HW band 의 폭: \(k_\alpha [1 + n\sigma_S^2]/n^{1/2} \cdot \widehat{S}\).
- \(\sigma_S\) 가 작은 이른 시점 (\(\sigma_S^2 \approx 0\)): 폭 \(\approx k_\alpha/\sqrt{n} \cdot \widehat{S}\). 분산이 0 에 가까워도 band 가 0 이 되지 않고 \(k_\alpha/\sqrt{n}\) 만큼 유지. → 이른 시점에서 EP 보다 넓음.
- \(\sigma_S\) 가 큰 늦은 시점: 폭 \(\approx k_\alpha \sigma_S^2 \sqrt{n} \cdot \widehat{S}\) → EP 의 \(c_\alpha \sigma_S \widehat{S}\) 보다 비례적으로 작을 수 있음. → 늦은 시점에서 EP 보다 좁을 수 있음.
비교 그림:
S
1 +-------- HW upper, wider at early
| ---
| EP upper, narrower at early
| \
| \------\ EP/HW cross
| \---
| EP lower \
| \--- HW lower, narrower at late
0 +-----------------------> t
t_L t_U
→ 분석 목적에 따라 선택: * 이른 시점 강조 (예: 0~30 일 사망): HW (band 가 0 으로 좁아지지 않음). * 중간~늦은 시점 강조 (예: 1~5 년): EP (이 영역에서 더 좁음).
3.5 EP vs HW 비교
| 측면 | EP (Nair) | Hall-Wellner |
|---|---|---|
| 근거 process | \(W^*(x)/\sqrt{x(1-x)}\) 의 sup | \(W^*(x)\) 의 sup 직접 |
| Critical value 표 | Appendix C.3 (\(c_\alpha\)) | Appendix C.4 (\(k_\alpha\)) |
| \(t_L = 0\) | 허용 안 함 (\(a_L > 0\) 필요) | 허용 |
| 이른 시점 폭 | 좁음 | 넓음 |
| 늦은 시점 폭 | 넓음 | 좁음 |
| pointwise CI 와 일관성 | 같은 형태 (\(Z \to c_\alpha\)) | 다른 형태 |
3.6 누적위험 confidence band
Survival 의 EP/HW band 와 동일한 절차로 \(H(t)\) 의 band 도출:
- \(a_L, a_U\) 를 식 4.4.8 로 계산 (분산 \(\sigma_H^2\) 사용).
- EP: pointwise CI 의 \(Z\) 를 \(c_\alpha\) 로 교체 (식 4.3.4~4.3.6).
- HW: \(Z \sigma_H\) 를 \(k_\alpha[1 + n\sigma_H^2]^{1/2}\) 로 교체.
→ 식 4.3.4~4.3.6 의 linear/log/arcsine 형태에 critical value 만 다름.
3.7 Klein Example 4.2 — BMT ALL 100~600 일 95% EP band 손계산
ALL 38 명의 EP band (Klein Table 4.5):
Step 1 — \(a_L, a_U\) 계산:
- \(t_L = 100\) 일 (위 시점에서의 \(\widehat{S}\) 와 \(\sigma_S^2\) 는 Table 4.3의 86 일 값 사용 since 100 일에는 사건 없음).
- \(\widehat{S}(100) = \widehat{S}(86) = 0.8947\).
- \(\sqrt{\widehat{V}[\widehat{S}(86)]} = 0.0498\).
- \(\sigma_S^2(100) = 0.0498^2/0.8947^2 = 0.0031\).
- \(t_U = 600\) 일 (526 일 이후 사건 없음).
- \(\widehat{S}(600) = \widehat{S}(526) = 0.4119\).
- \(\sigma_S^2(600) = 0.0809^2/0.4119^2 = 0.0386\).
\[ a_L = \frac{38 \cdot 0.0031}{1 + 38 \cdot 0.0031} = \frac{0.1178}{1.1178} = 0.1054 \approx 0.1 \]
\[ a_U = \frac{38 \cdot 0.0386}{1 + 38 \cdot 0.0386} = \frac{1.4668}{2.4668} = 0.5946 \approx 0.6 \]
Step 2 — Critical value 조회:
Klein Appendix C.3 (95% EP):
\[ c_{0.05}(0.1, 0.6) = 2.8826 \]
(pointwise 의 \(Z_{0.975} = 1.96\) 보다 약 47% 큰 critical value — band 가 그만큼 넓어짐).
Step 3 — 각 시점에서 band 계산:
365 일 (가장 가까운 사건 시점 332 일 사용):
- \(\widehat{S}(365) = 0.5492\).
- \(\sigma_S = 0.1479\).
Linear EP band: \[ 0.5492 \pm 2.8826 \cdot 0.1479 \cdot 0.5492 = 0.5492 \pm 0.2342 = (0.3150, 0.7834) \]
(pointwise linear CI (0.3900, 0.7084) 보다 양쪽으로 더 넓음).
Log-transformed EP band:
\(\theta = \exp(2.8826 \cdot 0.1479 / \ln 0.5492) = \exp(0.4264 / (-0.5994)) = \exp(-0.7115) = 0.4908\).
- 하한: \(0.5492^{1/0.4908} = 0.5492^{2.038} = 0.2950\).
- 상한: \(0.5492^{0.4908} = 0.7452\).
→ \((0.2950, 0.7452)\).
Arcsine-sqrt EP band:
- \(\arcsin\sqrt{0.5492} = 0.8350\).
- 반폭: \(0.5 \cdot 2.8826 \cdot 0.1479 \cdot \sqrt{0.5492/0.4508} = 0.5 \cdot 2.8826 \cdot 0.1479 \cdot 1.1039 = 0.2353\).
- 변환된 CI: \(0.8350 \pm 0.2353 = (0.5997, 1.0703)\). → \(\min(\pi/2, 1.0703) = 1.0703\).
- 역변환: \(\sin^2(0.5997) = 0.3183\), \(\sin^2(1.0703) = 0.7694\).
→ \((0.3183, 0.7694)\) (Klein Table 4.5 의 332 일 행 값과 일치).
| 형태 | Linear | Log | Arcsine |
|---|---|---|---|
| Pointwise CI | (0.39, 0.71) | (0.38, 0.69) | (0.39, 0.70) |
| EP band | (0.32, 0.78) | (0.30, 0.75) | (0.32, 0.77) |
Band 가 약 47% 더 넓다 (critical value 비율 \(c_\alpha/Z = 2.88/1.96 = 1.47\)). 이것이 “전체 시간 구간에 걸친 보장” 의 비용.
3.8 Hall-Wellner critical value (Klein Table 4.6)
ALL 100~600 일 95% HW band 의 critical value:
\[ k_{0.05}(0.1, 0.6) = 1.3211 \]
365 일에서 HW linear band 폭:
\[ \widehat{S} \pm \frac{1.3211 \cdot (1 + 38 \cdot 0.0219) \cdot \widehat{S}}{\sqrt{38}} = 0.5492 \pm \frac{1.3211 \cdot 1.832 \cdot 0.5492}{6.164} = 0.5492 \pm 0.2156 = (0.3336, 0.7648) \]
(EP linear (0.3150, 0.7834) 와 비슷한 폭 — 같은 365 일 시점에서).
이른 시점 비교 (100 일):
- EP linear: \(0.8947 \pm 2.8826 \cdot \sqrt{0.0031} \cdot 0.8947 = 0.8947 \pm 0.1437 = (0.7510, 1.0000)\).
- HW linear: \(0.8947 \pm 1.3211 \cdot (1 + 0.118)/6.164 \cdot 0.8947 = 0.8947 \pm 0.2148 = (0.6799, 1.0000)\).
→ HW 가 100 일에서 EP 보다 넓다 (직관 일치: HW 는 이른 시점에 band 가 0 으로 좁아지지 않음).
4 Practical Notes (4 개)
식 4.4.8 로 \(a_L, a_U\) 계산 후 식 4.3.4~4.3.6 의 pointwise H CI 에 critical value \(c_\alpha\) 또는 \(k_\alpha\) 대입.
ALL 100~600 일 cumulative hazard 95% arcsine HW band: \(k_{0.05}(a_L', a_U') = 1.4080\) → 365 일 H 의 95% band 약 (0.21, 0.96) (Figure 4.9).
| Band × 변환 | 소표본 coverage (\(n < 200\)) | 권장 |
|---|---|---|
| EP linear | 매우 낮음 | X (linear EP 절대 금지) |
| EP log | 적정 | O (n ≥ 20 사건) |
| EP arcsine-sqrt | 적정 (약간 보수적) | 표준 |
| HW linear | 적정 | O |
| HW log | 적정 | O |
| HW arcsine-sqrt | 적정 | O |
결론 권장:
- 시작 시점 0 포함 → HW arcsine-sqrt.
- 시작 시점 첫 사건 이후 → EP arcsine-sqrt.
- H 의 band 도 동일 권장.
cumulative hazard band 의 경우 (Practical Note 4): EP linear 는 upper bound 가 너무 낮음, EP log 는 lower bound 너무 높음 (이른 t) + upper 너무 낮음 (늦은 t), EP arcsine 은 upper boundary 의 error 가 대부분.
각 변환의 error 가 어디에서 발생하는지 (Borgan-Liestøl 1990):
- EP linear: upper band 가 자주 진짜 \(S\) 보다 낮음.
- EP log: 이른 \(t\) 에서 lower 너무 높음 + 늦은 \(t\) 에서 upper 너무 낮음.
- EP arcsine: error 의 대부분이 upper band 가 너무 낮은 경우.
- HW: 중간 시점 (\(t \approx (t_L + t_U)/2\)) 에서 error 집중.
→ EP/HW + 변환 조합별로 약점이 다름. 다중 분석 (예: EP arcsine + HW arcsine 둘 다) 으로 robustness 점검 가능.
km.ci
R 의 km.ci 패키지가 6 종 band (3 변환 × EP/HW) 를 지원:
library(km.ci)
fit <- survfit(Surv(time, status) ~ 1, data = df)
ci <- km.ci(fit, conf.level = 0.95, method = "epband") # EP linear
ci <- km.ci(fit, conf.level = 0.95, method = "loghall") # HW log
ci <- km.ci(fit, conf.level = 0.95, method = "linear") # pointwise linear (참고)
plot(ci)Python lifelines 는 confidence band 를 직접 지원하지 않음 — Klein Appendix C.3·C.4 의 critical value 표를 사용해 직접 구현 필요.
5 Theoretical Notes (3 개)
KM 추정량의 점근 분포 (Aalen 1975, Andersen et al. 1993):
\[ \sqrt{n}\left(\frac{\widehat{S}(t)}{S(t)} - 1\right) \xrightarrow{d} W^*(\sigma^2(t)) \]
where \(W^*\) 는 평균 0 의 Brownian bridge.
Variance scaling:
\[ \sigma^2(t) = \int_0^t \frac{dF(u)}{(1-F(u))^2 \cdot G(u)^{-1}} \]
여기서 \(F\) 는 사건 시점 분포, \(G\) 는 censoring 시점 분포. 위험집합이 작을수록 (큰 \(t\)) \(\sigma^2\) 폭증.
EP 의 도출: 추가 변환 \(q(x) = [x(1-x)]^{-1/2}\) → 변환된 process 가 \([a_L, a_U]\) 에서 정상 (stationary). \(\sup |q \cdot W^*|\) 의 분포가 critical value \(c_\alpha\) 의 source.
HW 의 도출: \(\sup |W^*|\) 의 분포 직접 사용. Brownian bridge 의 sup 분포 (Chung 1986) → critical value \(k_\alpha\).
Klein Appendix C.3 의 표 외에, 큰 표본에서의 근사 공식:
\[ P[U \geq d] \approx \frac{4 \phi(d)}{d} + \phi(d)\left(d - \frac{1}{d}\right) \log\left[\frac{a_U(1 - a_L)}{a_L(1 - a_U)}\right] \]
여기서 \(U = \sup |W^*(x)/\sqrt{x(1-x)}|\) for \(x \in [a_L, a_U]\), \(\phi\) 는 표준정규 밀도.
의미: 표를 직접 참조하지 않아도 큰 표본에서 critical value 를 근사 계산 가능. 단 소표본에서는 표가 정확.
Klein Appendix C.4 의 표는 Brownian bridge 의 sup 분포의 fractile:
\[ k_\alpha(a_L, a_U) = \alpha\text{-percentile of } \sup_{x \in [a_L, a_U]} |W^*(x)| \]
Chung (1986) 의 결과로 계산. EP 의 \(c_\alpha\) 와 마찬가지로 \(a_L, a_U\) 에 의존하며, 일반적으로 \(c_\alpha < k_\alpha\) (EP 가 약간 작은 critical value).
6 응용 분야
| 분야 | 활용 | 구체적 예시 |
|---|---|---|
| 임상시험 | 생존곡선 보고 | 1·3·5 년 시점 pointwise CI 표 + 전체 곡선 95% HW band |
| 종양학 | 5 년 OS 비교 | 두 군의 EP arcsine band 가 분리 → 통계적 차이 시각화 |
| 신뢰성 공학 | MTTF band | 부품 수명 분포의 confidence band |
| HIV 역학 | 잠복기 분포 | Brownian bridge band 로 곡선 전체의 불확실성 |
| 인구 통계 | Cohort 사망률 | 좌절단 보정 KM 의 HW band (§ 4.6) |
| 재발 모형 | TTR (time-to-recurrence) | 시간 경과별 CI 의 비대칭성 (log-log 변환) |
7 코드 예시
7.1 Step 1 — 순수 NumPy 로 3 종 pointwise CI 직접 구현
import numpy as np
from scipy.stats import norm
def pointwise_ci_3types(S, var_S, alpha=0.05):
"""KM 의 3 종 pointwise CI — linear, log-transformed, arcsine-sqrt"""
z = norm.ppf(1 - alpha/2)
sigma_S = np.sqrt(var_S) / S # σ_S = √V/S
# 1. Linear (식 4.3.1)
half = z * sigma_S * S
linear_lo = np.maximum(0, S - half)
linear_hi = np.minimum(1, S + half)
# 2. Log-transformed (식 4.3.2)
theta = np.exp(z * sigma_S / np.log(S))
log_lo = S ** (1/theta)
log_hi = S ** theta
# 3. Arcsine-sqrt (식 4.3.3)
arcsin_S = np.arcsin(np.sqrt(S))
half_a = 0.5 * z * sigma_S * np.sqrt(S / (1 - S))
arc_lo = np.sin(np.maximum(0, arcsin_S - half_a)) ** 2
arc_hi = np.sin(np.minimum(np.pi/2, arcsin_S + half_a)) ** 2
return {
"linear": (linear_lo, linear_hi),
"log": (log_lo, log_hi),
"arcsine": (arc_lo, arc_hi),
}
# Klein Example 4.2 ALL 1 년 시점
S = 0.5492
var_S = 0.0812**2
ci = pointwise_ci_3types(S, var_S)
for name, (lo, hi) in ci.items():
print(f"{name:10s}: ({lo:.4f}, {hi:.4f})")출력 (Klein Table 4.4 ALL 행과 일치):
linear : (0.3900, 0.7084)
log : (0.3783, 0.6911)
arcsine : (0.3903, 0.7032)
7.2 Step 2 — EP / HW confidence band
def confidence_band_ep(t, S, var_S, n, c_alpha):
"""EP linear band (식 4.4.2)"""
sigma_S = np.sqrt(var_S) / S
half = c_alpha * sigma_S * S
return np.maximum(0, S - half), np.minimum(1, S + half)
def confidence_band_hw(t, S, var_S, n, k_alpha):
"""HW linear band (식 4.4.5)"""
sigma_S = np.sqrt(var_S) / S
sigma_S2 = sigma_S ** 2
half = k_alpha * (1 + n * sigma_S2) / np.sqrt(n) * S
return np.maximum(0, S - half), np.minimum(1, S + half)
# BMT ALL 100~600 일 EP linear band
n = 38
c_05 = 2.8826 # Klein Appendix C.3 for (a_L=0.1, a_U=0.6)
S_arr = np.array([0.8947, 0.8421, 0.7368, 0.6579, 0.5492, 0.4943, 0.4119])
varS_arr = np.array([0.0498, 0.0592, 0.0714, 0.0770, 0.0812, 0.0819, 0.0809]) ** 2
ep_lo, ep_hi = confidence_band_ep(None, S_arr, varS_arr, n, c_05)
print("EP linear band (Klein Table 4.5):")
for s, lo, hi in zip(S_arr, ep_lo, ep_hi):
print(f" S={s:.4f}: ({lo:.4f}, {hi:.4f})")7.3 Step 3 — R km.ci 패키지 사용
library(survival)
library(km.ci)
library(KMsurv)
data(bmt) # 137 명 BMT 데이터
# ALL 군만
all_data <- subset(bmt, group == 1)
fit <- survfit(Surv(t2, d3) ~ 1, data = all_data, conf.type = "log-log")
# pointwise CI (log-log)
summary(fit, times = c(100, 365, 600))
# EP band (linear)
ci_ep <- km.ci(fit, conf.level = 0.95, tl = 100, tu = 600,
method = "epband")
plot(ci_ep, main = "EP 95% Linear Band — ALL")
# HW band (log-transformed)
ci_hw <- km.ci(fit, conf.level = 0.95, tl = 100, tu = 600,
method = "loghall")
plot(ci_hw, main = "HW 95% Log Band — ALL")
# 비교 plot — pointwise + EP + HW
plot(fit, conf.int = TRUE, xlim = c(100, 600), col = "black")
lines(ci_ep, col = "blue", lty = 2)
lines(ci_hw, col = "red", lty = 3)
legend("bottomleft",
c("KM + pointwise", "EP band", "HW band"),
col = c("black", "blue", "red"), lty = c(1, 2, 3))7.4 Step 4 — 3 그룹 비교 plot (Figure 4.8 재현)
import matplotlib.pyplot as plt
from lifelines import KaplanMeierFitter
from lifelines.datasets import load_bmt
df = load_bmt()
fig, ax = plt.subplots(figsize=(10, 6))
c_05 = 2.8826 # 가정: 모든 군에서 (a_L, a_U) ≈ (0.1, 0.6)
for group, label, color in zip([1, 2, 3],
["ALL", "AML low", "AML high"],
["blue", "green", "red"]):
mask = df["group"] == group
kmf = KaplanMeierFitter().fit(df.loc[mask, "T"],
df.loc[mask, "event"],
label=label)
kmf.plot_survival_function(ax=ax, ci_show=False, color=color)
# 직접 EP arcsine band 계산
S = kmf.survival_function_.iloc[:, 0].values
# (생략 — 위 함수 활용)
ax.set_xlim(100, 600)
ax.set_xlabel("Days Post Transplant")
ax.set_ylabel("DFS")
ax.set_title("BMT — KM + 95% EP Arcsine Band (3 Disease Groups)")
ax.legend()8 핵심 takeaway
Pointwise CI 와 confidence band 는 다른 보장 — pointwise 는 “한 시점 95%”, band 는 “전 구간 동시 95%”. 절대 혼동 말 것. 같은 95% 라도 band 가 더 넓다.
변환된 CI 가 표준 — Linear CI 는 \([0,1]\) 를 벗어나고 소표본 coverage 미달. Log-transformed (변환 도메인 \(\ln H\)) 가 자연 도메인 + 정규성 + 비대칭성. Arcsine-sqrt 는 variance stabilizing — 양 끝에서 가장 안정.
Borgan-Liestøl 1990 의 권장 — n < 200 에서 linear CI 는 사용 금지. Log 또는 arcsine. 특히 매우 작은 표본 또는 극단 tail 에서 arcsine.
Brownian bridge 가 모든 신뢰대의 토대 — KM 의 표준화가 양 끝에서 0 인 process → Brownian bridge. EP 는 q(x) 변환으로 정상화 후 sup, HW 는 직접 sup. 두 critical value 표 (Appendix C.3·C.4) 가 6 형태 band 를 모두 결정.
EP vs HW 의 trade-off — EP 는 t_L > 0 만 허용하지만 늦은 시점에서 좁다. HW 는 t_L = 0 허용 + 이른 시점에서 넓음. 분석 목적 (이른 vs 늦은 사건 강조) 에 따라 선택.
다중 변환 분석으로 robustness 점검 — Borgan-Liestøl 의 변환별 error 패턴이 다름 (EP arcsine 은 upper, EP log 는 lower 와 upper). 결정적 보고에는 두 변환 결과 모두 제시.
9 관련 주제
선행 지식
- § 4.1~4.2 — KM·NA 점추정 + Greenwood/Aalen 분산
- Ch.4 Overview
- § 3.6 — Counting Process + Martingale CLT — Brownian bridge weak convergence 의 토대
후속 주제
- § 4.5 — Mean (RMST) · Median CI (Brookmeyer-Crowley)
- § 4.6 — Left-Truncation 의 KM · CI 적용
- § 4.7 — Competing Risks 의 CIF CI
관련 개념
- § 1.3 — BMT 137 명 (Example 4.2 출처)
- Variance stabilizing 변환 (수리통계 일반): \(\arcsin\sqrt{p}\) for Binomial, \(\sqrt{X}\) for Poisson, \(\log\) for Exponential
- Multiple comparison + simultaneous inference (band 의 본질)