Klein Ch.8 Overview — Semiparametric Cox Proportional Hazards Regression with Fixed Covariates

§ 8.1 Cox 모형 식 8.1.2 h(t|Z) = h_0(t) exp(β’Z) — semiparametric (h_0 비모수 + 효과 모수) · 식 8.1.3 hazard ratio = exp(β’(Z-Z*)) 시간 불변 / § 8.2 Coding — dummy variable + interaction + continuous / § 8.3 Partial Likelihood (no ties) — 식 8.3.1 곱 형태 + 식 8.3.2 LL + 식 8.3.3·4 score·info + Wald 8.3.5 / LR 8.3.6 / Score 8.3.7 = log-rank (PH 의 자연 연결) / Klein Example 8.1 breast cancer immunoperoxidase β=0.9802, RR=2.67 / § 8.4 Ties — Breslow 식 8.4.1 + Efron + Exact + Discrete / § 8.5 Local Tests — 식 8.5.1·2·3 Wald/LR/Score subset + 식 8.5.7 linear combination C·β / Klein Example 8.2 larynx 4 stage + age (β=0.0189), Stage IV RR=5.44 / § 8.6 Discretizing Continuous — Aytay LR 식 / § 8.7 Model Building — forward/backward/stepwise + AIC / § 8.8 Survival Estimation — 식 8.8.2 Breslow H_0(t) + 식 8.8.4 S(t|Z_0) = S_0^exp(β’Z) + 식 8.8.5 분산 (Q_1 + Q_2)

Klein & Moeschberger Ch.8 의 8 개 절을 한 편으로 조망한다. Ch.7 의 비모수 검정이 군 차이를 검출하지만 covariate effect 정량화 + 다중 covariate 처리 못 함. Ch.8 의 Cox proportional hazards model 이 그 답. § 8.1 Introduction — Cox 모형 식 8.1.1: \(h(t|Z) = h_0(t) c(\beta'Z)\), 표준 형 식 8.1.2: \(h(t|Z) = h_0(t) \exp(\beta'Z)\) — semi-parametric (baseline \(h_0(t)\) 비모수 + covariate effect \(\beta\) 모수). 식 8.1.3 hazard ratio = \(\exp(\beta'(Z - Z^*))\)시간 불변 (PH 가정). \(\log[h(t|Z)/h_0(t)] = \beta'Z\) 의 linear model 형태. PH = Lehmann alternative \(S(t|Z) = S_0(t)^{\exp(\beta'Z)}\). § 8.2 Coding Covariates — 양적 vs 질적 covariate. 질적 (\(K\) level) → \(K-1\) dummy variables. Interaction → product term. Continuous 의 단위 변경 (year vs decade) 영향. § 8.3 Partial Likelihood (no ties) — 핵심 식 8.3.1: \(L(\beta) = \prod_{i=1}^D \exp(\beta'Z_{(i)}) / \sum_{j \in R(t_i)} \exp(\beta'Z_j)\). 분자 = 사건 발생 개체의 covariate, 분모 = 위험집합의 covariate exp 합. 식 8.3.2 LL, 식 8.3.3 score \(U_b\), 식 8.3.4 information \(I_{gh}\). 3 표준 검정: Wald (식 8.3.5), LR (식 8.3.6), Score (식 8.3.7). Score test at β=0 = log-rank 검정 (Klein § 8.3 Practical Note 3) — Ch.7 와 Ch.8 의 자연 연결. Klein Example 8.1 breast cancer immunoperoxidase (Klein § 1.5): IH+ vs IH-, single covariate. Score \(U(0)=4.19\), \(I(0)=3.19\), \(\chi^2_{Sc}=5.49\) (p=0.019) — Ch.7 의 log-rank 와 정확히 일치. Newton-Raphson 3 회 반복 수렴 → \(b=0.9802\), \(\text{SE}=0.4349\), \(\text{RR}=e^{0.9802}=2.67\), 95% CI (1.14, 6.25). LR \(\chi^2=4.44\) (p=0.035), Wald \(\chi^2=5.08\) (p=0.024). § 8.4 Ties — Breslow 식 8.4.1 (most software default), Efron 더 정확, Exact (continuous time), Discrete (binary). Tie 적으면 Breslow 충분. § 8.5 Local Tests — subset \(\beta_1 = \beta_{10}\) 검정. Wald 식 8.5.1: \((\mathbf{b}_1 - \beta_{10})' [\mathbf{I}^{11}(\mathbf{b})]^{-1} (\mathbf{b}_1 - \beta_{10})\). LR 식 8.5.2: \(2[LL(\mathbf{b}) - LL(\beta_{10}, \mathbf{b}_2)]\). Score 식 8.5.3. Linear combination 식 8.5.7: \(\mathbf{C}\beta = \mathbf{C}\beta_0\) — 임의 \(q\) 개 contrasts. Klein Example 8.2 larynx 4 stage + age (Klein § 1.8): 3 dummy (\(Z_1, Z_2, Z_3\) for stage II/III/IV) + age \(Z_4\). \(\mathbf{b} = (0.1386, 0.6383, 1.6931, 0.0189)\). Stage IV vs Stage I: \(\text{RR} = e^{1.6931} = 5.44\) (95% CI 2.38~12.44). Age 1 년: \(\text{RR} = e^{0.0189} = 1.02\)/year. Stage 효과 \(H_0: \beta_1=\beta_2=\beta_3=0\) — Score \(\chi^2=18.95\) (p=0.0001), LR \(\chi^2=15.45\) (p=0.0015), Wald \(\chi^2=17.63\) (p=0.0005). Stage III vs II: \(\text{RR} = e^{0.6383-0.1386} = 1.65\), 95% CI (0.68, 3.99) — 비유의. § 8.6 Discretizing Continuous — 연속 covariate 의 binary 변환. 모든 cut-point 에서 LR statistic 계산 → max 의 분포 (multiple comparison 조정). § 8.7 Model Building — forward/backward/stepwise selection + AIC = \(-2 LL + 2p\). § 8.8 Survival Estimation — 식 8.8.2 \(\widehat{H}_0(t) = \sum d_i/W(t_i; b)\) where \(W(t; b) = \sum_{j \in R(t)} \exp(b'Z_j)\) — Breslow 추정량 (NA 의 일반화). 식 8.8.4 \(\widehat{S}(t|Z_0) = \widehat{S}_0(t)^{\exp(b'Z_0)}\) — Lehmann alternative 의 직접. 분산 식 8.8.5 두 항 (\(Q_1\) baseline 불확실 + \(Q_2\) \(\beta\) 추정 불확실). Klein Example 8.2 60세 남성: Stage I 5-yr 0.703, Stage II 0.667, Stage III 0.513, Stage IV 0.147. § 8.9 Exercises — 다음 deep-dive.

Statistics
Survival Analysis
Klein-Moeschberger
Cox-Proportional-Hazards
Partial-Likelihood
Hazard-Ratio
Survival-Regression
저자

Kwangmin Kim

공개

2026년 04월 28일

1 들어가며 — 검정에서 회귀로

Klein 시리즈 사다리:

주제
Ch.4 시리즈 KM·NA 추정
Ch.5 시리즈 Other Sampling Schemes
Ch.6 시리즈 Smoothing · Excess · Bayesian
Ch.7 시리즈 Hypothesis Testing (log-rank 등)
Ch.8 (본 편) Cox Proportional Hazards Regression
Ch.9 (예정) Cox refinements (time-varying coefficients · stratified)
Ch.10 (예정) Aalen Additive
… (Ch.11~13) 진단 · AFT · Multivariate
Ch.8 의 한 줄 요약

“Cox proportional hazards model \(h(t|Z) = h_0(t) \exp(\beta'Z)\) — 비모수 baseline hazard \(h_0\) + 모수 covariate effect \(\beta\) 의 semiparametric 모형. Hazard ratio \(\exp(\beta'(Z - Z^*))\)시간 불변 (PH 가정). Partial likelihood (식 8.3.1) 가 baseline 의존 없이 \(\beta\) 추정 — 분자 = 사건자 covariate, 분모 = 위험집합의 covariate exp 합. Score test at \(\beta = 0\) = log-rank 검정 — Ch.7 의 자연 연결. Klein 8.1 breast cancer IH+ → RR=2.67 (95% CI 1.14~6.25), Klein 8.2 larynx Stage IV → RR=5.44 (95% CI 2.38~12.44, age 보정). Survival estimation (식 8.8.4) = \(\widehat{S}_0^{\exp(b'Z_0)}\) — Lehmann alternative 의 직접.”

직관 — Ch.7 → Ch.8 의 자연 확장

Ch.7 의 한계 (검정만):

  • 군 간 차이 “있다/없다” 만 답 (효과 크기 모름).
  • Continuous covariate 처리 안 됨 (예: 연속 연령).
  • 다중 covariate (sex + age + treatment) 동시 보정 어려움 (stratification 만 가능, interaction 표현 부족).

Ch.8 의 해결:

\[ h(t \mid Z) = h_0(t) \exp(\beta'Z) \]

  • \(\beta\): 효과 크기 점추정 + CI (정량화).
  • Continuous + categorical 모두 처리.
  • 다중 covariate 동시 모형 + interaction.

Ch.7 와 Ch.8 의 핵심 연결:

Cox PH 의 partial likelihood score test at \(\beta = 0\) = Ch.7 의 log-rank 검정.

→ Ch.7 의 log-rank 가 Cox PH 의 특수 경우. Cox PH 가 Ch.7 의 검정 framework 의 자연 일반화.

1.1 Ch.8 의 9 절 조망

주제 핵심
§ 8.1 Introduction Cox 모형 식 8.1.2
§ 8.2 Coding Covariates Dummy + interaction + continuous
§ 8.3 Partial Likelihood (no ties) 식 8.3.1 + Wald/LR/Score
§ 8.4 Ties Breslow · Efron · Exact · Discrete
§ 8.5 Local Tests Subset + linear combination
§ 8.6 Discretizing Continuous → binary cut-point
§ 8.7 Model Building Forward/backward/stepwise + AIC
§ 8.8 Survival Estimation 식 8.8.2·4 Breslow + Lehmann
§ 8.9 Exercises 16 문제

2 § 8.1 — Cox Proportional Hazards Model

정의: Cox PH 모형 (식 8.1.1·8.1.2)

표본 \(n\) 명, 각 개체 \(j\) 의 데이터: \((T_j, \delta_j, Z_j)\).

일반 형태 (식 8.1.1):

\[ h(t \mid Z) = h_0(t) \cdot c(\beta'Z) \]

표준 형태 (식 8.1.2):

\[ h(t \mid Z) = h_0(t) \cdot \exp(\beta'Z) = h_0(t) \exp\left(\sum_{k=1}^p \beta_k Z_k\right) \]

  • \(h_0(t)\): baseline hazard (비모수, 임의 함수).
  • \(\beta = (\beta_1, \ldots, \beta_p)'\): regression coefficient (모수).
  • \(\exp(\beta'Z)\): multiplicative covariate effect.

Semiparametric: baseline 비모수 + 효과 모수.

직관 — 왜 exp(β’Z) 인가
  • \(h(t|Z) > 0\) 강제 → exp 자연 (음수 없음).
  • \(\log h(t|Z) - \log h_0(t) = \beta'Z\)linear model 형태.
  • OLS, logistic regression 의 공식과 일관.

Coding 일관성:

  • 양적 covariate: \(Z_k\) 그대로.
  • \(K\) level 질적 covariate: \(K-1\) dummy variables.
  • Interaction: \(Z_j \cdot Z_k\) 의 product.

→ 일반 회귀 framework 와 동일한 coding 규칙.

정의: Hazard Ratio (식 8.1.3)

두 개체 \(Z\)\(Z^*\):

\[ \frac{h(t \mid Z)}{h(t \mid Z^*)} = \frac{h_0(t) \exp(\beta'Z)}{h_0(t) \exp(\beta'Z^*)} = \exp[\beta'(Z - Z^*)] \]

상수\(h_0(t)\) cancel + 시간 무관.

이것이 “Proportional Hazards” 의 의미: 두 개체의 hazard 비가 시간에 따라 일정.

직관 — PH 가정의 시각화

KM curves:

\[ S(t \mid Z) = S_0(t)^{\exp(\beta'Z)} \]

(Lehmann alternative).

  • Baseline \(S_0(t)\) 의 모양은 임의.
  • 다른 covariate 의 곡선은 baseline 의 거듭제곱.
  • \(\exp(\beta'Z) > 1\) 면 곡선 더 빨리 떨어짐 (위험 큼).

검정 방법:

  • Log-log plot: \(\log[-\log \widehat{S}(t|Z)]\) vs \(\log t\) — 평행하면 PH OK.
  • Schoenfeld residuals (Ch.11).

PH 위반 시 대안:

  • Time-varying coefficient (Ch.9).
  • Stratified Cox (Ch.9).
  • Aalen additive (Ch.10).
  • AFT model (Ch.12).

2.1 Hazard Ratio 의 임상적 의미

직관 — 임상 예시

Treatment effect (\(Z_1 = 0\) placebo, \(Z_1 = 1\) treatment):

\[ \frac{h(t \mid Z_1 = 1)}{h(t \mid Z_1 = 0)} = \exp(\beta_1) \]

  • \(\beta_1 > 0\): \(\exp(\beta_1) > 1\) → 처치가 위험 증가.
  • \(\beta_1 < 0\): \(\exp(\beta_1) < 1\) → 처치가 위험 감소 (효과적).
  • \(\beta_1 = 0\): 차이 없음.

(Klein Example 8.1 breast cancer):

  • \(Z = 1\) (IH+) vs \(Z = 0\) (IH-).
  • \(\beta = 0.9802\)\(\text{RR} = e^{0.9802} = 2.67\).
  • “IH+ 환자가 IH- 보다 2.67 배 빠른 사망 hazard”.

Continuous covariate (예: age):

  • \(\beta\) = age 1 unit 당 효과.
  • \(\text{RR} = e^\beta\) = 1 unit 증가 시 위험 ratio.

Hazard ratio 가 임상 보고의 표준 척도.

3 § 8.2 — Coding Covariates

핵심 — 일반 회귀 coding 규칙 적용

Quantitative: \(Z_k\) 그대로 (단위 주의).

Qualitative (\(K\) levels): \(K-1\) dummy variables.

  • Stage I, II, III, IV → \(Z_1 = I[\text{Stage II}]\), \(Z_2 = I[\text{Stage III}]\), \(Z_3 = I[\text{Stage IV}]\).
  • Stage I = reference (baseline).
  • \(\beta_1\): Stage II vs Stage I 의 log-RR.
  • \(\beta_2\): Stage III vs Stage I.
  • \(\beta_3\): Stage IV vs Stage I.

Interaction: 두 covariate 의 product:

  • \(Z_5 = Z_1 \cdot Z_4\) (e.g., stage × age).
  • \(\beta_5\): interaction effect.

해석 주의: dummy 의 reference 군이 무엇인지 명시.

4 § 8.3 — Partial Likelihood (No Ties)

4.1 핵심 식 8.3.1

정의: Partial Likelihood (식 8.3.1)

\(D\) 개 distinct 사건 시점 \(t_1 < t_2 < \cdots < t_D\). \(Z_{(i)}\) = 사건 \(i\) 의 개체 covariate.

\[ L(\beta) = \prod_{i=1}^D \frac{\exp(\beta'Z_{(i)})}{\sum_{j \in R(t_i)} \exp(\beta'Z_j)} \]

  • 분자: 사건 시점 \(t_i\) 에서 사건이 일어난 개체 \((i)\) 의 covariate exp.
  • 분모: \(t_i\) 직전 위험집합 \(R(t_i)\) 의 모든 개체의 covariate exp 합.
  • : 모든 \(D\) 사건에 대해.

→ “각 사건 시점에서 누가 사망할지의 조건부 확률” 의 곱.

직관 — 식 8.3.1 의 의미

Theoretical Note 1 의 도출:

\[ P(\text{개체 } i \text{ 사망} \mid t_i \text{ 한 명 사망}) = \frac{h(t_i \mid Z_{(i)})}{\sum_{j \in R(t_i)} h(t_i \mid Z_j)} = \frac{\exp(\beta'Z_{(i)})}{\sum_{j \in R(t_i)} \exp(\beta'Z_j)} \]

→ Baseline \(h_0(t_i)\) 가 분자·분모 cancel — \(\beta\) 추정에 baseline 불필요.

각 사건 시점의 conditional 확률을 곱한 것이 partial likelihood.

왜 “partial”:

  • 각 사건 시점의 정보만 사용 (사건 시점 자체 무시 — 순서만).
  • Censoring 정보 (위험집합 정의) + 사건 발생 정보만 활용.
  • 따라서 full likelihood 가 아닌 partial.

왜 작동하는가:

  • Cox (1972) 가 partial likelihood 도입.
  • Andersen-Gill (1982) 가 counting process martingale 로 정당화.
  • Wellner-Zhan (1997) 의 profile likelihood 로도 도출 가능 (Theoretical Note 2).

4.2 Score · Information · 3 가지 검정

정의: Score Equation 과 Information (식 8.3.3·8.3.4)

\(LL(\beta) = \log L(\beta)\). Score:

\[ U_b(\beta) = \frac{\partial LL}{\partial \beta_b} = \sum_{i=1}^D Z_{(i)b} - \sum_{i=1}^D \frac{\sum_{j \in R(t_i)} Z_{jb} \exp(\beta'Z_j)}{\sum_{j \in R(t_i)} \exp(\beta'Z_j)} \]

→ “관측 covariate 합 - 기대 covariate 가중 평균”.

Information matrix 식 8.3.4 — second derivative.

MLE: \(U_b(\beta) = 0\) 풀이 (Newton-Raphson).

정의: 3 가지 표준 검정 (식 8.3.5·6·7)

\(H_0\): \(\beta = \beta_0\) 검정.

Wald 식 8.3.5 — MLE 기반:

\[ \chi^2_W = (\mathbf{b} - \beta_0)' \mathbf{I}(\mathbf{b}) (\mathbf{b} - \beta_0) \]

Likelihood Ratio 식 8.3.6:

\[ \chi^2_{LR} = 2[LL(\mathbf{b}) - LL(\beta_0)] \]

Score 식 8.3.7:

\[ \chi^2_{Sc} = U(\beta_0)' \mathbf{I}^{-1}(\beta_0) U(\beta_0) \]

세 통계량 모두 점근적 \(\chi^2_p\) (\(p\) = 모수 차원).

직관 — 3 검정의 비교 + Ch.7 와의 연결
검정 강점 약점
Wald 직관적 (MLE 기반) extreme \(\mathbf{b}\) 에서 부정확
LR 정확 (likelihood 비교) 두 모형 fitting 필요
Score 빠름 (귀무 모형만 fit) 수렴 느림

Score test at β = 0 + no ties = log-rank test (Klein § 8.3 Practical Note 3):

\[ U(0) = d_1 - \sum_{i=1}^D \frac{Y_{1i}}{Y_{0i} + Y_{1i}}, \quad I(0) = \sum \frac{Y_{1i} Y_{0i}}{(Y_{0i} + Y_{1i})^2} \]

→ Ch.7 의 두 군 log-rank 식 7.3.7 의 분자·분모와 정확히 일치.

Ch.7 의 log-rank 가 Cox PH 의 score test 특수 경우. 두 framework 의 통일성.

4.3 Klein Example 8.1 — Breast Cancer Immunoperoxidase

단변량 Cox 회귀 손풀이 (Klein § 1.5)

데이터: 45 명 breast cancer, \(Z = 1\) (IH+ 9명) vs \(Z = 0\) (IH- 36명).

Newton-Raphson 3 회 반복 (Klein):

\(m\) \(b_{m-1}\) \(LL\) \(U\) \(I\) \(b_m\)
1 0 -83.74 4.187 3.191 1.312
2 1.312 -81.82 -1.838 5.749 0.992
3 0.992 -81.52 -0.065 5.308 0.980

→ 수렴: \(b = 0.9802\).

SE: \(1/\sqrt{I(b)} = 1/\sqrt{5.287} = 0.4349\).

3 검정:

  • Score at \(\beta = 0\): \(U(0) = 4.19\), \(I(0) = 3.19\), \(\chi^2_{Sc} = 4.19^2/3.19 = 5.49\), \(p = 0.019\). → 이것이 정확히 Ch.7 의 log-rank 검정.
  • LR: \(\chi^2_{LR} = 2[LL(0.98) - LL(0)] = 2[-81.52 - (-83.74)] = 4.44\), \(p = 0.035\).
  • Wald: \(\chi^2_W = (0.98)^2 / (0.4349)^2 = 5.08\), \(p = 0.024\).

Hazard Ratio:

\[ \text{RR} = e^{0.9802} = 2.67 \]

95% CI for RR:

\[ \exp(0.9802 \pm 1.96 \cdot 0.4349) = (e^{0.128}, e^{1.833}) = (1.14, 6.25) \]

임상 해석: IH+ 환자가 IH- 환자보다 2.67 배 빠른 사망. 95% CI (1.14, 6.25) → 1 을 포함 안 함 → 통계적 유의.

Cox PH 가 효과 크기 + CI + p-value 모두 제공 (Ch.7 의 log-rank 는 p-value 만).

5 § 8.4 — Ties

정의: Tied event times 의 처리

같은 시점에 여러 사건 발생 시 \(L(\beta)\) 의 분모 처리.

  • Breslow (식 8.4.1, default): \(\prod \exp(\beta's_i) / [\sum_{j \in R_i} \exp(\beta'Z_j)]^{d_i}\) — 분모 거듭제곱.
  • Efron: 정확한 conditional 확률 — Breslow 보다 정확, tie 많을 때 권장.
  • Exact (continuous time): 모든 가능한 순서의 평균.
  • Exact (discrete): 각 시점에 binary 사건만 가능 가정 (logistic-like).

관행:

  • Tie 적음 (\(\leq 5\%\)): Breslow 충분.
  • Tie 많음 (\(\geq 20\%\)): Efron 권장.
  • Discrete time: Exact discrete.

R coxph(..., ties = "efron") (default), SAS PHREG 의 TIES = EFRON.

6 § 8.5 — Local Tests (Subset of β)

정의: Subset Test (식 8.5.1·2·3)

\(\beta = (\beta_1', \beta_2')'\) 분할. \(H_0\): \(\beta_1 = \beta_{10}\) (\(q\)-차원 subset).

Wald 식 8.5.1:

\[ \chi^2_W = (\mathbf{b}_1 - \beta_{10})' [\mathbf{I}^{11}(\mathbf{b})]^{-1} (\mathbf{b}_1 - \beta_{10}) \]

where \(\mathbf{I}^{11}\) = \(\mathbf{I}^{-1}\) 의 upper \(q \times q\) block.

LR 식 8.5.2: full vs reduced 모형 LL 차이.

Score 식 8.5.3: restricted MLE 의 score 기반.

세 검정 모두 \(\chi^2_q\) 분포.

Linear Combination 식 8.5.7 (general \(\mathbf{C}\beta = \mathbf{C}\beta_0\)):

\[ \chi^2 = (\mathbf{C}\mathbf{b} - \mathbf{C}\beta_0)' [\mathbf{C}\mathbf{I}^{-1}(\mathbf{b})\mathbf{C}']^{-1} (\mathbf{C}\mathbf{b} - \mathbf{C}\beta_0) \]

→ 임의 contrasts (예: \(\beta_1 = \beta_2 = \beta_3\)) 검정.

6.1 Klein Example 8.2 — Larynx 4 Stage + Age

데이터 (Klein § 1.8)

90 명 larynx cancer. Covariate:

  • \(Z_1 = I[\text{Stage II}]\), \(Z_2 = I[\text{Stage III}]\), \(Z_3 = I[\text{Stage IV}]\) (Stage I = reference).
  • \(Z_4\) = age at diagnosis.
Klein Table 8.1 — 풀이 결과

Full model fit:

\[ \mathbf{b} = (0.1386, 0.6383, 1.6931, 0.0189) \]

\(LL = -188.18\).

Covariate \(b\) \(\text{SE}\) \(\chi^2_W\) \(p\) \(\text{RR}\)
Stage II 0.1386 0.4623 0.09 0.76 1.15
Stage III 0.6383 0.3561 3.21 0.07 1.89
Stage IV 1.6931 0.4222 16.08 <0.0001 5.44
Age (1 yr) 0.0189 0.0143 1.76 0.18 1.02

임상 해석:

  • Stage IV: \(\text{RR} = e^{1.6931} = 5.44\) vs Stage I — 5.44 배 빠른 사망. 95% CI \((\exp(1.6931 \pm 1.96 \cdot 0.4222)) = (2.38, 12.44)\).
  • Stage II, III: 비유의 또는 marginal.
  • Age: 1 년당 RR = 1.02 — 매우 작지만 long-term 누적 (10 년 → \(1.02^{10} = 1.22\)).
Stage 효과 검정 (\(H_0: \beta_1 = \beta_2 = \beta_3 = 0\))

3-차원 subset 검정.

  • Score (age 만으로 fit 후): \(\chi^2_{Sc} = 18.95\), \(p = 0.0001\).
  • LR (full vs age-only): \(\chi^2_{LR} = 2[-188.18 - (-195.91)] = 15.45\), \(p = 0.0015\).
  • Wald (식 8.5.1): \(\chi^2_W = 17.63\), \(p = 0.0005\).

Stage 가 사망 hazard 에 유의한 영향 (age 보정 후).

Linear Combination — Stage III vs Stage II

\(H_0\): \(\beta_1 = \beta_2\) (Stage II 와 Stage III 의 RR 동일).

\(\mathbf{C} = (1, -1, 0, 0)\), \(\mathbf{C}\beta = \beta_1 - \beta_2 = -0.4997\).

\(\text{Var}(b_2 - b_1) = \text{Var}(b_2) + \text{Var}(b_1) - 2\text{Cov}(b_2, b_1) = 0.1268 + 0.2137 - 2(0.0683) = 0.2039\).

\(\text{SE}(b_2 - b_1) = 0.4515\).

95% CI for \(\beta_2 - \beta_1\):

\[ 0.4997 \pm 1.96 \cdot 0.4515 = (-0.385, 1.385) \]

\(\text{RR}_{III/II} = e^{0.4997} = 1.65\), 95% CI \((e^{-0.385}, e^{1.385}) = (0.68, 3.99)\)1 포함 → 비유의.

→ Stage III vs Stage II 차이 통계적으로 검출 안 됨 (작은 표본 효과).

7 § 8.6·8.7 — Discretizing + Model Building

§ 8.6 Discretizing Continuous Covariate

연속 covariate 를 binary 변환 (예: BP < 140 vs ≥ 140).

문제: 어디서 cut-point?

  • Aytay LR statistic: 모든 cut-point 에서 LR \(\chi^2\) 계산 → max 값.
  • Multiple comparison 보정: max LR 의 분포 (Brownian motion sup).

한계: cut-point 는 정보 손실 — 가능하면 continuous 그대로 사용.

§ 8.7 Model Building — Variable Selection

Forward: 빈 모형 → 하나씩 추가 (가장 유의한 변수).

Backward: full → 하나씩 제거.

Stepwise: Forward + 매 단계 backward 점검.

Information criterion:

\[ \text{AIC} = -2 LL + 2p \]

\[ \text{BIC} = -2 LL + p \log n \]

→ 작을수록 좋음. 모형 비교 표준.

임상 가이드:

  • 사전 임상 지식 + statistical 의 균형.
  • 작은 sample 시 stepwise 부적합 (overfit).

8 § 8.8 — Survival Function Estimation

정의: Breslow Baseline Hazard (식 8.8.2)

\[ \widehat{H}_0(t) = \sum_{t_i \leq t} \frac{d_i}{W(t_i; b)}, \quad W(t_i; b) = \sum_{j \in R(t_i)} \exp(b'Z_j) \]

→ NA 식 4.2.3 의 일반화 (\(Z = 0\) 일 때 NA 와 동일).

Baseline survival:

\[ \widehat{S}_0(t) = \exp(-\widehat{H}_0(t)) \]

정의: 개체별 Survival (식 8.8.4)

Covariate \(Z_0\) 인 개체의 survival:

\[ \widehat{S}(t \mid Z_0) = \widehat{S}_0(t)^{\exp(b'Z_0)} \]

→ Lehmann alternative 의 직접 적용.

분산 (식 8.8.5):

\[ \widehat{V}[\widehat{S}(t|Z_0)] = [\widehat{S}(t|Z_0)]^2 [Q_1(t) + Q_2(t; Z_0)] \]

  • \(Q_1(t)\) (식 8.8.6): baseline hazard 추정 불확실.
  • \(Q_2(t; Z_0)\) (식 8.8.7·8): \(\beta\) 추정 불확실.

→ 두 source of uncertainty 가 합산.

Klein Example 8.2 — 60세 남성의 4 Stage 생존곡선

식 8.8.4 적용. Stage I 의 60세 baseline:

\[ \widehat{S}(t \mid \text{Stage I, age=60}) = \widehat{S}_0(t)^{\exp(0.0189 \times 60)} = \widehat{S}_0(t)^{e^{1.134}} = \widehat{S}_0(t)^{3.108} \]

5 년 시점 결과:

Stage \(\widehat{S}(5\text{yr})\) \(\text{SE}\) 95% CI (log-trans)
I 0.7031 0.0737 (0.532, 0.821)
II 0.6672 0.1059 (0.418, 0.829)
III 0.5132 0.0949 (0.317, 0.679)
IV 0.1473 0.0996 (0.022, 0.383)

임상 해석:

  • Stage I 60세: 5 년 생존률 70%.
  • Stage IV 60세: 15% (매우 낮음).
  • Stage III·IV CI 가 매우 넓음 (작은 표본 + 큰 효과).

Klein Figure 8.3: 4 stage 의 생존곡선 비교.

9 Ch.8 의 7 가지 교훈

Ch.8 핵심 교훈
  1. Cox PH 의 semiparametric 구조 — Baseline \(h_0\) 비모수 + covariate \(\beta\) 모수. \(h(t|Z) = h_0(t) \exp(\beta'Z)\). Lehmann alternative \(S(t|Z) = S_0(t)^{\exp(\beta'Z)}\).

  2. Hazard ratio 의 시간 불변성\(\exp(\beta'(Z - Z^*))\). \(h_0\) cancel 로 baseline 무관. PH 가정의 핵심.

  3. Partial likelihood 의 baseline 무관 추정 — 식 8.3.1 의 분자·분모에서 \(h_0\) cancel. \(\beta\) 의 효율적 추정.

  4. Score test = log-rank — Cox PH 의 partial likelihood 의 score at \(\beta = 0\) = Ch.7 의 log-rank. 두 framework 의 자연 연결.

  5. 3 검정의 동치 (점근) — Wald · LR · Score 가 큰 표본에서 동등. Local tests (식 8.5.1·2·3·7) 도 동일 framework.

  6. Klein 8.1·8.2 손풀이 — Breast cancer IH+ RR=2.67 (95% CI 1.14~6.25), Larynx Stage IV RR=5.44 (CI 2.38~12.44, age 보정). Cox PH 의 효과 정량화 + CI + p-value 모두 제공.

  7. Survival estimation (식 8.8.4)\(\widehat{S}_0^{\exp(b'Z_0)}\) 로 개체별 곡선. Breslow baseline (식 8.8.2) + Lehmann 변환. 분산은 \(Q_1\) (baseline 불확실) + \(Q_2\) (\(\beta\) 불확실) 두 항.

10 응용 분야

분야 Cox PH 사용 주요 covariate
임상시험 처치 효과 정량 treatment + age + sex + stage
종양학 위험 인자 식별 tumor size + grade + nodes + biomarkers
심혈관 epidemiology 인구 위험 분석 BP + cholesterol + smoking + age
신뢰성 공학 부품 수명 회귀 stress + temperature + material
보험 보험금 청구 policy holder demographics + claim history
인구통계 사망 위험 age + sex + education + income

11 코드 예시

11.1 Step 1 — R survival::coxph

library(survival)
library(KMsurv)
data(larynx)

# Klein Example 8.2 — full model
fit <- coxph(Surv(time, delta) ~ as.factor(stage) + age,
             data = larynx,
             ties = "breslow")  # 또는 "efron" (default)

summary(fit)
# coefficients, SE, exp(coef) = HR, 95% CI, p-values
# concordance + LR/Wald/Score 검정

# Stage 효과 검정 (subset test)
fit_age_only <- coxph(Surv(time, delta) ~ age, data = larynx)
anova(fit_age_only, fit, test = "LRT")

11.2 Step 2 — Survival Estimation (R)

# Klein Example 8.2 — 60 yr male, Stage I~IV 의 생존곡선
new_patient <- data.frame(
  stage = factor(1:4),
  age = rep(60, 4)
)

surv_fit <- survfit(fit, newdata = new_patient)
plot(surv_fit, col = c("blue", "green", "orange", "red"),
     xlab = "Years", ylab = "Survival",
     main = "Klein Figure 8.3 reproduce")
legend("topright", c("Stage I", "Stage II", "Stage III", "Stage IV"),
       col = c("blue", "green", "orange", "red"), lty = 1)

# 5 년 시점 추정 + CI
summary(surv_fit, times = 5)

11.3 Step 3 — Python lifelines

from lifelines import CoxPHFitter
import pandas as pd

df = pd.DataFrame({
    'time': larynx_times,
    'event': larynx_events,
    'stage_II': (stage == 2).astype(int),
    'stage_III': (stage == 3).astype(int),
    'stage_IV': (stage == 4).astype(int),
    'age': age,
})

cph = CoxPHFitter(baseline_estimation_method="breslow")
cph.fit(df, duration_col='time', event_col='event')

# 결과
print(cph.summary)  # coef, exp(coef), SE, p, CI
print(cph.log_likelihood_ratio_test())  # LR test

# Survival prediction
new_patient = pd.DataFrame({
    'stage_II': [0, 1, 0, 0],
    'stage_III': [0, 0, 1, 0],
    'stage_IV': [0, 0, 0, 1],
    'age': [60, 60, 60, 60],
})
surv_curves = cph.predict_survival_function(new_patient)

# 5 년 생존률
print(surv_curves.loc[5])  # Stage I~IV 5 yr survival

11.4 Step 4 — Newton-Raphson 직접 구현

import numpy as np

def cox_partial_likelihood(beta, X, T, delta):
    """식 8.3.1 — log partial likelihood"""
    n = len(T)
    sorted_idx = np.argsort(T)
    T_sorted, X_sorted, d_sorted = T[sorted_idx], X[sorted_idx], delta[sorted_idx]
    LL = 0
    for i in range(n):
        if d_sorted[i] == 1:
            # Risk set: T_sorted[i:] (i 시점 직전 위험)
            risk_set_X = X_sorted[i:]
            score = X_sorted[i] @ beta
            log_denom = np.log(np.sum(np.exp(risk_set_X @ beta)))
            LL += score - log_denom
    return LL

# Newton-Raphson 으로 β MLE
# (실제 구현은 lifelines 또는 R 의 더 효율적 알고리즘 권장)

12 관련 주제

선행 지식

후속 주제

  • Ch.8 deep-dive (§ 8.1~8.5 partial likelihood + § 8.6~8.8 model building)
  • Ch.9 — Cox Refinements (time-varying coefficients · stratified · multistate · left truncation in Cox)
  • Ch.10 — Aalen Additive Hazards (additive 회귀 대안)
  • Ch.11 — Regression Diagnostics (Schoenfeld · martingale · deviance residuals)
  • Ch.12 — Parametric Regression (AFT · Weibull · log-logistic)

관련 개념

  • Lehmann alternative — Cox PH 의 분포 함의
  • Counting process martingale (Aalen 1975) — partial likelihood 정당화
  • Profile likelihood (Johansen 1983) — partial likelihood 의 또 다른 도출
  • Ch.7 log-rank ↔︎ Ch.8 score test — 검정과 회귀의 통일 framework

Subscribe

Enjoy this blog? Get notified of new posts by email: