1 들어가며 — 본 편의 자리
Klein 시리즈 사다리:
| 편 | 주제 |
|---|---|
| Ch.1 Overview (01) | 19 예제 catalog |
| § 1.1~1.2 (01-1) | Introduction + 6-MP Leukemia |
| § 1.3~1.4 (01-2) | BMT + Dialysis |
| § 1.5~1.6 (본 편) | Breast Cancer + Burn Patient |
| § 1.7~1.10 (예정) | Kidney Transplant·Laryngeal·Auto-Allo·Lymphoma |
- Breast cancer 의 standard light microscopy 음성 환자 16% 가 재발하는 이유는? Immunohistochemistry 가 어떤 정밀도를 더하는가?
- 작은 sample (9 vs 36) 에서 likelihood 기반 통계 가 왜 중요한가?
- Additive hazards model 이 Cox PH model 과 무엇이 다른가? § 1.5 가 왜 그 표준 예제인가?
- Burn patient infection 의 다양한 covariates (gender·race·burn site·burn type·excision·antibiotic) 를 어떻게 통합 분석하는가?
- Time-dependent covariate (excision·antibiotic 투여 시점) 가 baseline covariate 와 본질적으로 다른 점은?
2 § 1.5 Times to Death for a Breast-Cancer Trial (Sedmak 1989)
2.1 의학적 배경 — Lymph Node Negative Breast Cancer 의 역설
2.1.1 Axillary Lymph Node Status
유방암의 표준 예후 인자:
- Lymph node positive: 겨드랑이 림프절에 암 전이 — 나쁜 예후.
- Lymph node negative: 림프절 전이 없음 — 좋은 예후.
치료 결정의 핵심:
- Positive → 보조 항암화학요법 (adjuvant chemotherapy).
- Negative → 일반적으로 chemo 면제 (수술만).
2.1.2 역설
“Negative axillary lymph nodes 환자의 16% 가 10 년 안에 재발.”
→ Standard light microscopy (SLM) 만으로는 일부 잠재 전이 (occult metastasis) 를 놓침.
문제:
- 림프절을 SLM 으로 검사 → 큰 종양 세포만 발견.
- 작은 종양 cluster (수십 개 세포) 는 놓침.
- 그러나 그 cluster 가 결국 재발의 원인.
해결 — Immunohistochemistry (IH):
- Anti-cytokeratin antibody 로 keratin (epithelial cell marker) 검출.
- 종양 세포가 keratin 을 발현 → IH 가 작은 cluster 도 검출.
- SLM 음성 + IH 양성 = 숨은 전이.
가설 (Sedmak 1989):
“SLM 음성 + IH 양성 환자가 SLM 음성 + IH 음성 환자보다 재발률 높을 것.”
만약 입증되면:
- IH 가 정밀 예후 도구.
- SLM 음성 + IH 양성 환자에게 chemo 권장 가능.
- 재발률 16% 감소 가능.
→ 임상적 의의가 큰 가설.
2.2 데이터
- n: 45 명 (모두 SLM 음성).
- IH 양성 (9 명): occult metastasis 발견.
- IH 음성 (36 명): 진짜 negative.
- Period: Ohio State University Hospitals Cancer Registry, 최소 10 년 follow-up.
- 사건: 사망.
2.2.1 Table 1.3 데이터 (개월 단위)
Immunoperoxidase Negative (n = 36):
- 사건 (16 명): 19, 25, 30, 34, 37, 46, 47, 51, 56, 57, 61, 66, 67, 74, 78, 86.
- Censored (20 명): 122+, 123+, 130+ (×2), 133+, 134+, 136+, 141+, 143+, 148+, 151+, 152+, 153+, 154+, 156+, 162+, 164+, 165+, 182+, 189+.
Immunoperoxidase Positive (n = 9):
- 사건 (8 명): 22, 23, 38, 42, 73, 77, 89, 115.
- Censored (1 명): 144+.
IH 음성:
- 사건 비율 16/36 = 44%.
- Censored 모두 122 개월 이상 (10 년 +).
IH 양성:
- 사건 비율 8/9 = 89% (매우 높음).
- 1 명만 censored (144 개월).
원시 비교:
- IH 양성 = 거의 모두 사망 (89%).
- IH 음성 = 절반 미만 (44%).
- 사망 시점도 IH 양성 이 더 짧음 (median ≈ 42 vs 86 개월).
→ IH 가 명확한 예후 신호. 가설 입증.
그러나 통계적 도전:
- IH 양성 그룹 n = 9 만.
- 작은 sample → asymptotic 검정 (chi-square) 의 정확도 낮음.
- Exact likelihood-based 분석 또는 permutation test 권장.
2.3 Klein 책의 사용 매핑
| Chapter | 본 데이터 사용 |
|---|---|
| Ch.8 | Likelihood 함수 구성, 2-sample Cox PH (no ties, right-censored) |
| Ch.10 | Additive hazards model — least-squares estimation |
| Ch.10 | Constant excess risk (additive) over time |
2.4 Additive Hazards Model — § 1.5 의 핵심 시연
2.4.1 Cox PH (multiplicative)
\[ h(t \mid Z) = h_0(t) \exp(\beta Z) \]
- Hazard ratio = \(\exp(\beta)\) — 시간 무관 multiplicative.
- 해석: “\(Z\) 가 1 단위 증가 → hazard 가 \(\exp(\beta)\) 배”.
2.4.2 Aalen Additive Hazards
\[ h(t \mid Z) = \alpha_0(t) + \alpha_1(t) Z \]
- Hazard 의 차이 = \(\alpha_1(t) Z\) — 시간 함수 additive.
- 해석: “\(Z\) 가 1 단위 증가 → hazard 가 \(\alpha_1(t)\) 만큼 더해진다”.
Multiplicative (Cox):
- “IH 양성이 IH 음성의 hazard 의 X 배” (X = exp(β)).
- Baseline hazard 가 변하면 absolute risk 도 변함.
Additive (Aalen):
- “IH 양성이 IH 음성보다 hazard 가 X 만큼 더 크다”.
- Baseline 무관 absolute risk 차이.
언제 어느 것?
- Multiplicative 자연: 흡연이 모든 연령에서 같은 비율 위험 증가.
- Additive 자연: 단순 환경 노출 (asbestos) 이 baseline 에 일정량 위험 추가.
검증:
- PH 가정 만족 → Cox 적절.
- Cox PH 위반 + additive 가 자연 → Aalen.
§ 1.5 데이터: 둘 다 시도. 두 모델의 결과 비교 가 Ch.10 의 학습 목적.
장점 (Aalen):
- Time-varying effect 자동 (각 시점에 \(\alpha_1(t)\)).
- Coefficient interpretation 직접 (rate difference).
단점:
- Negative hazard 가능 (제약 어려움).
- 비효율 (specifically multiplicative effect 면 Cox 가 더 정확).
2.5 Constant Excess Risk Model
§ 1.5 의 추가 시연: \(\alpha_1(t) = \alpha_1\) (시간 무관).
\[ h(t \mid Z) = \alpha_0(t) + \alpha_1 Z \]
→ “IH 가 IH 음성보다 hazard 가 일정량 더 큼”.
이 단순 모델로 IH 효과의 quantification.
3 § 1.6 Times to Infection for Burn Patients (Ichida 1993)
3.1 의학적 배경 — Burn Wound Infection
화상 환자의 주요 합병증:
- Burn wound infection (화상 부위 감염): 입원 연장 + 사망 위험.
- 원인 균: Staphylococcus aureus 등.
- 예방: 표면 소독 + 항생제 + excision (괴사 조직 제거).
3.1.1 Disinfection Protocol Change
- Historical control (과거): povidone-iodine 10% 표면 + Dial 비누 일반 목욕.
- New protocol (시험): chlorhexidine gluconate 4% body-cleansing.
연구 질문: 새로운 chlorhexidine 프로토콜이 povidone-iodine 보다 감염을 줄이는가?
Randomized trial:
- 동시기 환자를 randomly 두 그룹 배정.
- Best 디자인 (gold standard).
Historical control:
- 과거 환자 = control, 현재 환자 = treatment.
- 더 빠르고 윤리적 (모든 현재 환자가 새 프로토콜 받음).
- 단점: 시간 경과 confounding (의학 발전, 환자 특성 변화).
본 연구는 historical control. 18 개월 study period.
해결:
- Multivariate adjustment (gender, race, severity 등 통제).
- Time trend 인지.
- Cox model 이 historical control 분석의 표준.
3.2 데이터
- n: 154 명.
- Treatment: chlorhexidine 84 vs povidone-iodine 70 (historical).
- 사건: Staphylococcus 감염.
3.2.1 Fixed Covariates (12 개)
| 공변량 | 분포 |
|---|---|
| Gender | 22% female |
| Race | 88% white |
| Burn severity | mean 24.7% (range 2-95% surface) |
| Site: head | 45% |
| Site: buttocks | 23% |
| Site: trunk | 84% |
| Site: upper legs | 41% |
| Site: lower legs | 31% |
| Site: respiratory | 29% |
| Type: chemical | 6% |
| Type: scald | 12% |
| Type: electric | 7% |
| Type: flame | 75% |
3.2.2 Time-Dependent Covariates (2 개)
| 공변량 | 분포 |
|---|---|
| Time to excision (괴사 조직 제거) | 64% 환자 발생 |
| Time to antibiotic (예방 항생제) | 41% 환자 발생 |
이 두 공변량은 시간 t 에 따라 변경 — baseline 0 → 발생 시점에 1.
Univariate 분석:
- 한 변수씩 KM 또는 univariate Cox.
- Confounding 통제 안 됨.
Multivariate Cox PH:
\[ h(t \mid Z) = h_0(t) \exp(\beta_1 \text{gender} + \beta_2 \text{race} + \beta_3 \text{severity} + \cdots) \]
- 모든 변수 동시 통제.
- 각 \(\beta_j\) = 다른 변수 통제 후 partial effect.
도전:
- 14 개 공변량 (12 fixed + 2 time-dep) → 154 명.
- Events per variable = 154/14 ≈ 11 — 적절 (10 EPV rule).
Burn site 의 multi-collinearity:
- 6 개 site indicator → 환자가 여러 site 에 화상 가능.
- 정확한 부호 + 해석.
Burn type (4 종):
- One-hot encoding 후 reference level 설정.
→ Klein Ch.8 (multivariate Cox) 의 표준 시연.
3.3 Time-Dependent Covariate 처리
3.3.1 데이터 구조
각 환자의 record 를 counting process format (시작·끝 형식) 으로 분할:
Patient A:
- Day 0~10: excision = 0, antibiotic = 0
- Day 10~25: excision = 1, antibiotic = 0 (excision at day 10)
- Day 25~∞: excision = 1, antibiotic = 1 (antibiotic at day 25)
(infection at day 30 → status = 1 in last interval)
3.3.2 Cox Model
\[ h(t \mid Z(t)) = h_0(t) \exp\bigl(\beta_1 \text{group} + \beta_2 \text{gender} + \cdots + \beta_{13} \text{excision}(t) + \beta_{14} \text{antibiotic}(t)\bigr) \]
잘못된 해석 (“excision 환자가 nonexcision 보다 위험 낮음”):
- Naive 비교 이지만 “excision = 1” 그룹은 excision 후의 시간만 포함.
- 그 사이 사건 발생자는 “excision = 0” 그룹.
- → 선택 편향 (immortal time bias).
올바른 해석 (time-dep Cox):
- 매 시점 t 마다 “excision 했는지 여부” 가 그 시점의 hazard 변경.
- \(\exp(\beta_{13}) =\) excision 후의 hazard ratio (excision 전 대비).
- Immortal time 문제 자동 해결.
Klein Ch.9.1 에서 정확히 다룸.
3.4 Klein 책의 사용 매핑
| Chapter | 본 데이터 사용 |
|---|---|
| Ch.8 | Multivariate Cox PH (12 fixed covariates) |
| Ch.9 | Time-dependent covariate (excision, antibiotic) |
| Exercises | Burn site multi-collinearity |
4 R + Python EDA — Breast Cancer 데이터
4.1 R — survival 패키지
library(survival)
library(survminer)
# Klein Table 1.3
breast <- data.frame(
time = c(
# IH negative (n=36)
19, 25, 30, 34, 37, 46, 47, 51, 56, 57, 61, 66, 67, 74, 78, 86,
122, 123, 130, 130, 133, 134, 136, 141, 143, 148, 151, 152, 153,
154, 156, 162, 164, 165, 182, 189,
# IH positive (n=9)
22, 23, 38, 42, 73, 77, 89, 115, 144
),
status = c(
rep(1, 16), rep(0, 20), # IH negative: 16 events + 20 censored
rep(1, 8), rep(0, 1) # IH positive: 8 events + 1 censored
),
ih = c(rep("Negative", 36), rep("Positive", 9))
)
# 그룹별 요약
table(breast$ih, breast$status)
# 0 1
# Negative 20 16
# Positive 1 8
# KM 추정
fit <- survfit(Surv(time, status) ~ ih, data = breast)
ggsurvplot(
fit, data = breast, pval = TRUE, conf.int = TRUE,
palette = c("blue", "red"),
xlab = "Months", ylab = "Survival probability",
legend.title = "IH status"
)
# Log-rank test
survdiff(Surv(time, status) ~ ih, data = breast)
# Chisq= 9.8 on 1 df, p = 0.002
# Cox PH (2-sample)
cox_fit <- coxph(Surv(time, status) ~ ih, data = breast)
summary(cox_fit)
# IH positive vs negative: HR = 4.7, p = 0.001
# Aalen Additive Hazards (Ch.10 시연)
library(timereg) # Aalen 모델
aalen_fit <- aalen(Surv(time, status) ~ const(ih), data = breast)
summary(aalen_fit)4.2 Python — lifelines
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from lifelines import KaplanMeierFitter, CoxPHFitter, AalenAdditiveFitter
from lifelines.statistics import logrank_test
# Breast cancer 데이터
breast = pd.DataFrame({
"time": [
19, 25, 30, 34, 37, 46, 47, 51, 56, 57, 61, 66, 67, 74, 78, 86,
122, 123, 130, 130, 133, 134, 136, 141, 143, 148, 151, 152, 153,
154, 156, 162, 164, 165, 182, 189,
22, 23, 38, 42, 73, 77, 89, 115, 144
],
"status": [1]*16 + [0]*20 + [1]*8 + [0]*1,
"ih_pos": [0]*36 + [1]*9
})
# KM
fig, ax = plt.subplots(figsize=(9, 6))
for ih, color in [(0, "blue"), (1, "red")]:
sub = breast[breast["ih_pos"] == ih]
kmf = KaplanMeierFitter()
kmf.fit(sub["time"], sub["status"],
label="IH negative" if ih == 0 else "IH positive")
kmf.plot_survival_function(ax=ax, color=color)
ax.set_xlabel("Months")
ax.set_ylabel("Survival probability")
ax.set_title("Breast Cancer: IH+ vs IH- (Sedmak 1989)")
plt.tight_layout()
# Log-rank
result = logrank_test(
breast[breast["ih_pos"] == 0]["time"],
breast[breast["ih_pos"] == 1]["time"],
breast[breast["ih_pos"] == 0]["status"],
breast[breast["ih_pos"] == 1]["status"]
)
print(f"Log-rank: chi^2 = {result.test_statistic:.3f}, p = {result.p_value:.4f}")
# Cox PH
cph = CoxPHFitter()
cph.fit(breast, duration_col="time", event_col="status")
print(cph.summary)
# Aalen Additive
aaf = AalenAdditiveFitter()
aaf.fit(breast, duration_col="time", event_col="status")
print(aaf.summary)5 R + Python EDA — Burn Patient 데이터
5.1 R 시뮬레이션 (실제 Klein Appendix D.x 또는 web)
library(survival)
# Burn 데이터 구조 (실제 Ichida 1993 web 데이터)
# 여기서는 simulated structure 시연
set.seed(42)
n <- 154
burn <- data.frame(
id = 1:n,
group = c(rep("chlorhex", 84), rep("povidone", 70)),
gender = sample(c("M", "F"), n, prob = c(0.78, 0.22), replace = TRUE),
race = sample(c("white", "other"), n, prob = c(0.88, 0.12), replace = TRUE),
severity = pmin(95, pmax(2, rnorm(n, 24.7, 15))),
burn_type = sample(c("flame", "scald", "electric", "chemical"),
n, prob = c(0.75, 0.12, 0.07, 0.06), replace = TRUE),
time_excision = ifelse(runif(n) < 0.64, runif(n, 0, 30), NA),
time_antibiotic = ifelse(runif(n) < 0.41, runif(n, 0, 30), NA),
time = rexp(n, rate = 0.05),
status = rbinom(n, 1, 0.4)
)
# Multivariate Cox (fixed covariates only)
cox_fit <- coxph(Surv(time, status) ~ group + gender + race + severity + burn_type,
data = burn)
summary(cox_fit)
# Time-dependent setup (counting process format)
burn_long <- tmerge(burn, burn,
id = id,
endpoint = event(time, status))
burn_long <- tmerge(burn_long, burn,
id = id,
excision = tdc(time_excision))
burn_long <- tmerge(burn_long, burn,
id = id,
antibiotic = tdc(time_antibiotic))
# Time-dep Cox
cox_td <- coxph(Surv(tstart, tstop, endpoint) ~ group + gender + severity
+ excision + antibiotic, data = burn_long)
summary(cox_td)5.2 Python — lifelines Time-Dependent Setup
import pandas as pd
from lifelines import CoxTimeVaryingFitter
from lifelines.utils import to_long_format, add_covariate_to_timeline
# Long-format 변환 (counting process)
# 각 환자의 record 를 시간 구간별 분할
# 자세한 setup 은 lifelines documentation 참조
# 예시 long-format:
# id start stop event excision antibiotic
# 1 0 10 0 0 0
# 1 10 25 0 1 0 (excision at 10)
# 1 25 30 1 1 1 (antibiotic at 25, infection at 30)
# CoxTimeVaryingFitter
ctv = CoxTimeVaryingFitter()
ctv.fit(burn_long, id_col="id", event_col="event",
start_col="start", stop_col="stop")
print(ctv.summary)6 두 데이터의 대비
| 측면 | § 1.5 Breast | § 1.6 Burn |
|---|---|---|
| n | 45 | 154 |
| 그룹 수 | 2 (IH+ vs IH-) | 2 (chlorhex vs povidone) |
| 사건 | 사망 | Staphylococcus 감염 |
| 공변량 | 1 (IH status) | 14 (12 fixed + 2 time-dep) |
| Sample 도전 | 작은 그룹 (9) | 충분 |
| 통계적 도전 | Likelihood 정확성 | Multivariate + time-dep |
| Klein 사용 | Ch.8·10 | Ch.8·9 |
§ 1.5 Breast:
- “작은 sample 에서 likelihood 기반 정확한 분석”.
- “Cox vs Aalen — 어느 것이 적절한가?”
- → Ch.10 의 additive hazards 동기.
§ 1.6 Burn:
- “다변량 Cox 의 표준 적용”.
- “Time-dependent covariate 의 정확한 처리”.
- → Ch.9.1 의 time-dep Cox 동기.
상보성:
- 작은 + 단순 (Breast) vs 큰 + 복잡 (Burn).
- 학생이 두 극단을 모두 학습.
7 핵심 직관 통합
- Lymph node negative 의 16% 재발 = SLM 한계 → IH 가 정밀도 향상.
- 작은 sample (9 vs 36) = likelihood 기반 분석의 가치.
- Additive vs Multiplicative hazards = 모델 선택의 trade-off.
- Burn historical control = multivariate adjustment 필수.
- Time-dependent covariate = immortal time bias 회피.
- 두 데이터의 상보성 = 작은-단순 vs 큰-복잡.
8 실전 체크리스트 — § 1.5~1.6
§ 1.5 Breast Cancer
- 임상 배경 이해 (axillary lymph node, IH staining).
- 데이터 구조 정확히 입력 (45 명, IH+ 9 vs IH- 36).
- 작은 그룹 (n=9) 의 통계적 도전 인지.
- KM curve 비교.
- Log-rank test + Cox PH HR.
- Aalen additive hazards 비교 시연.
- Constant excess risk vs time-varying excess risk.
§ 1.6 Burn Patient
- Historical control 디자인 인지 + confounding 점검.
- Multi-covariate Cox PH 적합.
- Time-dependent covariate counting-process 형식 변환.
- Excision·antibiotic 의 immortal time bias 회피.
- Burn site multi-collinearity 점검.
EDA
- 각 데이터의 events·censored·n·median 요약.
- KM curve + 신뢰구간.
- PH 가정 시각 점검 (Schoenfeld).
- Multi-covariate model 의 effect size + 신뢰구간.
다음 단계
- § 1.7 (Kidney Transplant 863 명) — 큰 데이터의 kernel smoothing.
- § 1.8 (Laryngeal Cancer) — ordinal stage trend test.
9 관련 주제
Klein 시리즈
- Ch.1 Overview
- § 1.1~1.2 — Introduction · Leukemia
- § 1.3~1.4 — BMT · Dialysis
- (다음) § 1.7~1.10 (예정) — Kidney Transplant·Laryngeal·Auto-Allo·Lymphoma
관련 개념 (cross-category)
10 참고문헌
- Klein, J. P., & Moeschberger, M. L. (2003). Survival Analysis: Techniques for Censored and Truncated Data (2nd ed.), Ch.1 § 1.5~1.6. Springer.
- Sedmak, D. D., Meineke, T. A., Knechtges, D. S., & Anderson, J. (1989). Prognostic Significance of Cytokeratin-Positive Breast Cancer Metastases. Modern Pathology, 2, 516-520.
- Ichida, J. M., Wassell, J. T., Keller, M. D., & Ayers, L. W. (1993). Evaluation of Protocol Change in Burn-Care Management Using the Cox Proportional Hazards Model with Time-Dependent Covariates. Statistics in Medicine, 12(3-4), 301-310.
- Aalen, O. O. (1989). A Linear Regression Model for the Analysis of Life Times. Statistics in Medicine, 8(8), 907-925.
- Aalen, O. O., Borgan, Ø., & Gjessing, H. K. (2008). Survival and Event History Analysis: A Process Point of View. Springer.
- Cox, D. R. (1972). Regression Models and Life-Tables. JRSS B, 34(2), 187-220.
- Suissa, S. (2008). Immortal Time Bias in Pharmacoepidemiology. American Journal of Epidemiology, 167(4), 492-499.
- Therneau, T. M., & Grambsch, P. M. (2000). Modeling Survival Data: Extending the Cox Model. Springer.
- Davidson-Pilon, C. (2019). lifelines: Survival Analysis in Python. JOSS, 4(40), 1317.
- Scheike, T. H., & Zhang, M. J. (2011). Analyzing Competing Risk Data Using the R timereg Package. Journal of Statistical Software, 38(2). (R
timereg패키지)