Ch.9 Overview — Mixed-Effects Logistic Regression for Binary Outcomes

이항 GLMM · Threshold concept · 잠재 변수 · Subject-specific vs Marginal · Gauss-Hermite quadrature

Hedeker & Gibbons (2006) Ch.9 의 종합 overview. 이항 (0/1) 종단 데이터에 GLMM (Generalized Linear Mixed Model) 을 적용하는 첫 chapter. 로지스틱 회귀 복습 (§9.2), Probit 와의 차이 (§9.3, \(\beta_L \approx 1.81 \beta_P\)), Threshold concept 으로서의 잠재 변수 표현 (§9.4, 식 9.11), 랜덤 절편 추가로 Mixed-effects logistic 도입 (§9.5, 식 9.13-9.14), 잠재 변수 + 랜덤 효과 모형 (식 9.15) 에서 발생하는 Subject-specific vs Population-averaged scale 차이 (식 9.16) 의 도출, Marginal MLE 추정의 Gauss-Hermite quadrature, \(\hat\upsilon_i\) 의 Empirical Bayes 추정, 정신과 데이터 예시까지 정리한다. mm-06 의 AI Agent 비즈니스 예시 직관과 평행하는 Hedeker framework 의 systematic 정리.

Statistics
저자

Kwangmin Kim

공개

2026년 04월 30일

1 들어가며 — Ch.9 의 자리와 GLMM 이항의 동기

Ch.4-7 의 정규 종단Ch.8 의 GEE 가 이항 반응까지 확장됐다. Ch.9 는 이항 반응 + 랜덤 효과 의 결합 — Generalized Linear Mixed Model (GLMM) 의 첫 chapter.

Chapter 모형 분포 의존성 표현
Ch.4-5 MRM 정규 랜덤 효과
Ch.6 CPM 정규 직접
Ch.7 MRM-AC 정규 랜덤 + AC
Ch.8 GEE 정규/이항/카운트 작동 상관 (marginal)
Ch.9 GLMM (이항) 이항 랜덤 효과
Ch.10 GLMM (순서형) 순서형 랜덤 효과
Ch.11 GLMM (명목) 명목 랜덤 효과
Ch.12 GLMM (카운트) Poisson, NB 랜덤 효과
한 줄 요약

“Ch.9 = 로지스틱 회귀 + 랜덤 효과. 핵심은 (1) Threshold concept 으로 이항을 잠재 정규/로지스틱으로 표현, (2) 랜덤 효과 추가로 subject-specific 효과 모형화, (3) 비선형 link 때문에 GEE 와 회귀 계수가 다름 (식 9.16 의 비축소성).”

본 overview 의 절 구성 (Hedeker §9 의 11 절 → 7 주제로 정리):

  • § 9.1 GLMM 이항의 자리.
  • § 9.2-9.3 로지스틱·Probit 회귀 복습.
  • § 9.4 Threshold concept (잠재 변수).
  • § 9.5 Mixed-effects logistic 도입.
  • § 9.6-9.10 추정 — Gauss-Hermite quadrature + Fisher scoring.
  • § 9.11 Subject-specific vs Population-averaged.
  • § 9.12 정신과 데이터 예시.

2 § 9.1 — GLMM 이항의 자리

2.1 발전사 + 동기

GLMM 이항의 발전 (1980s)

종단 이항 데이터 분석은 1980 년대 활발한 연구 주제:

  • Gibbons (1981): GLMM 초기 연구.
  • Stiratelli, Laird & Ware (1984): random-effects probit.
  • Anderson & Aitkin (1985): random-effects logistic.
  • Wong & Mason (1985): 다수준 logistic.
  • Gibbons & Bock (1987): longitudinal probit.
  • Liang & Zeger (1986): GEE 출발.
  • Goldstein (1991): 다수준 logistic 의 IGLS 추정.

→ MRM (정규) 과 거의 같은 시기에 비정규 반응 확장. 두 가지 길:

  1. GEE (Ch.8): marginal, quasi-likelihood, 작동 상관.
  2. GLMM (Ch.9~12): subject-specific, full likelihood, 랜덤 효과.

두 패러다임은 같은 데이터에 다른 답을 줄 수 있다 — § 9.5 에서 자세히.

2.2 Hedeker §9 의 범위

본 chapter 의 범위
  • 반응: 이항 (0/1) — 이후 chapter 에서 순서형, 명목, 카운트로 확장.
  • 수준: 2-level — 시점 (level-1) 안에 환자 (level-2). 3-level 은 Ch.13.
  • 링크: logit (주) + probit (보조).
  • 추정: Marginal MLE — Gauss-Hermite quadrature + Fisher scoring.

다른 GLMM (이후 chapter) 도 같은 framework 의 자연 확장.

3 § 9.2 — 로지스틱 회귀 복습 (단일 수준)

3.1 모형 형태

표준 로지스틱 (식 9.1-9.3)

\(Y_i\) = 0/1, \(p_i = P(Y_i = 1)\), \(x_i\) = 공변량.

\[ p_i = \frac{\exp(x_i^\top \beta)}{1 + \exp(x_i^\top \beta)} = \Psi(x_i^\top \beta) \tag{9.1, 9.2} \]

여기서 \(\Psi(z) = 1 / [1 + \exp(-z)]\) — 로지스틱 cdf.

Logit 형태:

\[ \log\left[\frac{p_i}{1-p_i}\right] = x_i^\top \beta \tag{9.3} \]

Logit 의 의미 정리

\[ \text{logit} = \log(\text{odds}) = \log\frac{p}{1-p} \]

  • \(p = 0.5\)\(\text{logit} = 0\) (대등 odds).
  • \(p > 0.5\)\(\text{logit} > 0\) (성공 odds 우세).
  • \(p < 0.5\)\(\text{logit} < 0\) (실패 odds 우세).

Logit 의 핵심 성질: \((0, 1)\)\(p\)\((-\infty, \infty)\) 의 logit 으로 확장 → 선형 관계 모형화 가능.

로지스틱 회귀는 logit 에서 선형, \(p\) 에서 S 자 곡선 (Figure 9.1, 9.2).

3.2 회귀 계수 해석

OR 해석

회귀 계수 \(\beta_p\):

  • Logit scale: \(\beta_p\) = \(x_p\) 1 단위 증가 시 logit 의 변화.
  • Odds Ratio: \(\exp(\beta_p)\) = \(x_p\) 1 단위 증가 시 odds 의 비율.

예: \(\hat\beta_p = 0.693\)\(\text{OR} = \exp(0.693) = 2.0\)\(x_p\) 1 단위 증가 시 odds 가 2 배.

3.3 ML 추정 (Newton-Raphson)

Score + Fisher information (식 9.7-9.9)

Bernoulli likelihood (식 9.4-9.6) 로부터:

Score function (식 9.7):

\[ U(\beta) = \frac{\partial \log L}{\partial \beta} = \sum_i (Y_i - \Psi_i) x_i = 0 \]

Fisher information (식 9.8):

\[ \mathcal{I}(\beta) = -\frac{\partial^2 \log L}{\partial \beta \partial \beta^\top} = \sum_i \Psi_i (1-\Psi_i) x_i x_i^\top \]

Newton-Raphson 갱신 (식 9.9):

\[ \beta^{(t+1)} = \beta^{(t)} + \mathcal{I}(\beta^{(t)})^{-1} U(\beta^{(t)}) \]

수렴까지 반복. 점근 분산-공분산은 \(\mathcal{I}^{-1}\).

4 § 9.3 — Probit 회귀: 대안

4.1 정의

Probit 모형 (식 9.10)

\[ p_i = P(Y_i = 1) = \Phi(x_i^\top \beta) \tag{9.10} \]

여기서 \(\Phi\) = 표준 정규 cdf.

Logit 의 대안 — 잠재 변수가 정규 분포라 가정 시 자연 (§ 9.4 에서).

4.2 Logit vs Probit 비교

두 cdf 의 차이

시각적 차이 (Figure 9.3, 9.4):

  • 로지스틱 cdf: 두꺼운 꼬리.
  • 정규 cdf: 얇은 꼬리.
  • 분산: 정규 = 1, 로지스틱 = \(\pi^2 / 3 \approx 3.29\).
  • 표준화된 형태에서 두 곡선이 거의 구분 불가 (Figure 9.4).

McCullagh (1980) 의 권고:

“두 모형이 보통 비슷한 결과 → 해석 용이성 기준 선택. 일반적으로 logit 선호 (OR 해석).”

Doksum & Gasko (1990): 두 모형 차이 식별에 큰 + 양질 데이터 필요.

5 § 9.4 — Threshold Concept (잠재 변수 모형)

5.1 잠재 변수 표현

Bock (1975) 의 Threshold Concept

이항 \(Y\)연속 잠재 변수 \(y\) 로부터 결정:

\[ Y = \begin{cases} 1 & \text{if } y > \gamma \\ 0 & \text{if } y \leq \gamma \end{cases} \]

여기서 \(\gamma\) = threshold (보통 0 으로 고정).

잠재 변수 \(y\) 의 회귀 모형:

\[ y_i = x_i^\top \beta + \epsilon_i \tag{9.11} \]

\(\epsilon_i\) 의 분포에 따라:

  • 로지스틱 (\(\epsilon \sim \text{Logistic}(0, \pi^2/3)\)): logistic regression.
  • 정규 (\(\epsilon \sim \mathcal{N}(0, 1)\)): probit regression.
Threshold 의 직관 — 잠재 의향 + 결정 임계값

예시 — 환자의 절제 행동:

  • 잠재 변수 \(y\): 환자의 잠재 절제 의향 (강함 → 양수, 약함 → 음수).
  • threshold \(\gamma = 0\): 의향이 0 을 넘으면 실제 절제 (\(Y = 1\)), 못 넘으면 흡연 (\(Y = 0\)).
  • 공변량 \(x\): 의향에 영향. 처치 \(\beta > 0\) → 의향 증가 → 절제 확률 증가.

이 framework 가 GLMM 이항 모형의 계산적·이론적 토대:

  • 확률 표현: \(P(Y = 1) = P(y > 0) = P(\epsilon > -x^\top\beta)\).
  • 로지스틱: \(P(\epsilon > -z) = \Psi(z)\) — 식 (9.2).
  • 정규: \(P(\epsilon > -z) = \Phi(z)\) — 식 (9.10).

5.2 Logit ↔︎ Probit Scaling (식 9.12)

\(\beta\) 의 분포별 scale 차이

잠재 변수 \(y\) 의 분산이 분포에 따라 다름:

  • 정규: \(V(\epsilon) = 1\).
  • 로지스틱: \(V(\epsilon) = \pi^2 / 3 \approx 3.29\).

\(y\) 의 분산을 같게 만드려면 (즉 같은 효과 크기) 회귀 계수가 scale 차이:

\[ \beta_L \approx \sqrt{\pi^2 / 3} \cdot \beta_P \approx 1.81 \cdot \beta_P \tag{9.12} \]

다른 scaling 추정값

문헌별 scaling factor:

출처 \(\beta_L / \beta_P\)
식 (9.12) (분산 일치) 1.81
Amemiya (1981) (cdf 일치) 1.6
Long (1997) 1.7

대략 1.6 ~ 1.8 배. 정확한 값은 데이터에 따라 미세 차이.

실용적 함의:

  • Logit·Probit 둘 다 같은 데이터 적합 → 회귀 계수 1.6 ~ 1.8 배 차이.
  • Z-statistic (\(\beta / \text{SE}\)) 는 거의 같음 (분자 분모 같은 비율로 변함).
  • 결론 (유의성, 임상 해석) 도 거의 같음.

6 § 9.5 — Mixed-Effects Logistic Regression

6.1 랜덤 절편 모형

식 (9.13) — 랜덤 절편 추가

종단·군집 이항 데이터에서 표준 로지스틱은 독립 가정 위반. 해결 — 랜덤 효과 추가:

\[ \log\left[\frac{p_{ij}}{1-p_{ij}}\right] = x_{ij}^\top \beta + \upsilon_i \tag{9.13} \]

여기서:

  • \(i = 1, \ldots, N\): level-2 (피험자).
  • \(j = 1, \ldots, n_i\): level-1 (시점).
  • \(\upsilon_i \sim \mathcal{N}(0, \sigma_\upsilon^2)\): 환자별 랜덤 절편.
표준화 형태 (식 9.14)

계산 편의로 \(\upsilon_i = \sigma_\upsilon \theta_i\) (\(\theta_i \sim \mathcal{N}(0, 1)\)) 로 표준화:

\[ \log\left[\frac{p_{ij}}{1-p_{ij}}\right] = x_{ij}^\top \beta + \sigma_\upsilon \theta_i \tag{9.14} \]

의미: \(\sigma_\upsilon\) 가 회귀 계수와 같은 scale (logit 단위) — 직접 비교·해석 가능.

→ “랜덤 효과 표준편차” 가 logit 단위 → 그 자체가 회귀 효과의 크기로 해석 (예: \(\sigma_\upsilon = 1\) 은 logit 1 단위 변동).

6.2 잠재 변수 형태 (식 9.15)

Random-effects threshold model

잠재 변수 형태로 식 (9.14) 를 표현:

\[ y_{ij} = x_{ij}^\top \beta + \sigma_\upsilon \theta_i + \epsilon_{ij} \tag{9.15} \]

  • \(\theta_i\): 환자별 잠재 효과 (의향).
  • \(\epsilon_{ij}\): 시점별 잡음 (logistic, \(V = \pi^2/3\)).

총 분산:

\[ V(y_{ij}) = \sigma_\upsilon^2 + \frac{\pi^2}{3} \]

(피험자 간 + 피험자 내.)

ICC (Intra-class Correlation) — 잠재 변수 척도

이항 GLMM 의 ICC (잠재 변수 기준):

\[ \text{ICC} = \frac{\sigma_\upsilon^2}{\sigma_\upsilon^2 + \pi^2/3} \]

(로지스틱). Probit 의 경우 \(\pi^2/3\) 가 1 로 대체.

해석: 같은 환자의 두 시점이 잠재 의향 척도에서 얼마나 상관.

관측 척도 (이항) 의 ICC 는 다른 공식 — 잠재 변수보다 작음.

7 § 9.5 — Subject-Specific vs Population-Averaged

7.1 식 (9.16) — Mixed vs Fixed/GEE Scale 차이

비축소성 (Non-collapsibility)

잠재 변수 분산 비교:

  • Mixed model (식 9.15): \(V(y \mid x) = \sigma_\upsilon^2 + \sigma_\epsilon^2\).
  • Fixed-effects (식 9.11) 또는 GEE: \(V(y \mid x) = \sigma_\epsilon^2\).

같은 효과 크기를 표현하려면 회귀 계수가 다른 scale:

\[ \beta_M \approx \sqrt{\frac{\sigma_\upsilon^2 + \sigma_\epsilon^2}{\sigma_\epsilon^2}} \cdot \beta_F \tag{9.16} \]

여기서 \(\beta_M\) = mixed (subject-specific), \(\beta_F\) = fixed/GEE (marginal).

\(\sigma_\upsilon = 0\): 두 모형 동일. \(\sigma_\upsilon\): Mixed 의 회귀 계수가 더 큼 (절대값).

이항 GLMM 과 GEE 가 같은 데이터에서 다른 회귀 계수. 정규 모형에서는 발생 안 함 (식 9.15 의 분산이 회귀 계수와 분리).

Zeger et al. (1988) 의 실용 보정

식 (9.16) 의 정확한 값보다 약간 다름:

\[ \beta_M \approx \sqrt{1 + (15/16)^2 \cdot \frac{\pi^2}{3} \cdot \sigma_\upsilon^2 / \sigma_\epsilon^2} \cdot \beta_F \]

근사 식:

\[ \beta_M \approx \beta_F \cdot \sqrt{1 + 0.346 \sigma_\upsilon^2} \]

(이항 logistic 일 때.)

: \(\sigma_\upsilon = 1\)\(\beta_M \approx 1.16 \beta_F\), \(\sigma_\upsilon = 2\)\(\beta_M \approx 1.55 \beta_F\).

7.2 두 효과의 의미 차이

Subject-Specific (GLMM) vs Population-Averaged (GEE/Fixed)

Subject-specific (Mixed):

같은 사람이 처치를 받으면 처치 안 받았을 때보다 logit 이 \(\beta_M\) 만큼 변함.”

조건부 효과 — 랜덤 효과 \(\theta_i\) 를 고정한 상태에서.

Population-averaged (Fixed/GEE):

모집단 전체에 처치를 적용하면 평균 logit 이 \(\beta_F\) 만큼 변함.”

주변 효과 — 랜덤 효과 분포 위에서 평균.

→ 같은 처치, 다른 질문, 다른 답.

비축소성: 비선형 link (logit) 의 본질적 성질 — 평균의 함수와 함수의 평균이 다름.

어느 것을 보고할까

연구 질문에 따라:

질문 권장 모형
“이 환자에게 처치 효과는?” GLMM (subject-specific)
“전체 모집단 평균 효과는?” GEE (marginal)
“정밀 의료 (개인별 예측)” GLMM
“공중보건 정책” GEE
“임상 시험 (회귀 계수만 관심)” 둘 다 가능, 결론 비슷

대부분 임상 시나리오에서 두 모형의 결론 (유의성, 방향) 은 같음. 정량적 효과 크기 만 차이.

자세한 비교 + 비즈니스 예시는 mm-08 GEE 개요 참조.

8 § 9.6-9.10 — 추정: Marginal MLE

8.1 Marginal Likelihood (식 9.21)

마진 우도 — 랜덤 효과 적분 제거

GLMM 의 marginal 평균 (식 9.21):

\[ \mu_{ij} = E(Y_{ij}) = \int g^{-1}\left[x_{ij}^\top \beta + \sigma_\upsilon \theta_i\right] f(\theta) \, d\theta \]

여기서 \(\theta \sim \mathcal{N}(0, 1)\).

Marginal likelihood:

\[ L(\beta, \sigma_\upsilon) = \prod_{i=1}^N \int \prod_{j=1}^{n_i} P(Y_{ij} \mid \theta_i) f(\theta_i) \, d\theta_i \]

문제: 비선형 link (logit) 때문에 적분 닫힌 해 없음. 수치 적분 필요.

8.2 Gauss-Hermite Quadrature

수치 적분 — 핵심 알고리즘

표준 정규 분포 위의 적분을 가중 합으로 근사:

\[ \int_{-\infty}^{\infty} h(\theta) \phi(\theta) \, d\theta \approx \sum_{q=1}^Q w_q \cdot h(\theta_q) \]

여기서:

  • \(\{\theta_q\}_{q=1}^Q\): Hermite 다항식의 근 (quadrature points).
  • \(\{w_q\}\): 대응 가중치.
  • \(Q\): quadrature points 수 (보통 10~30).

\(Q\) 의 trade-off:

  • 작음 (Q=5): 빠름, 부정확.
  • 큼 (Q=30): 정확, 느림.
  • 보통 Q=10~20 충분.
Adaptive Quadrature

랜덤 효과 분산이 작거나 (\(\sigma_\upsilon^2 < 0.1\)) 표본 작을 때:

  • 표준 GHQ 의 \(\theta_q\) 들이 \(\theta_i\) 의 사후 분포와 멀리 떨어질 수 있음 → 부정확.
  • Adaptive GHQ (Pinheiro & Bates 1995): 각 피험자의 사후 모드 주위에서 적분점 재배치.
  • 더 정확 + Q 적게 사용 가능.

R lme4::glmer, Python statsmodels.formula.api.glmm 의 default — adaptive quadrature.

8.3 Fisher Scoring

추정 방정식 풀이

Marginal log-likelihood 의 score 와 Fisher information 을 quadrature 로 근사.

각 반복 \(t \to t+1\):

  1. 현재 \(\beta^{(t)}, \sigma_\upsilon^{(t)}\) 에서 marginal score 계산 (quadrature).
  2. Fisher information matrix 계산 (quadrature).
  3. Newton-Raphson 갱신: \[ \theta^{(t+1)} = \theta^{(t)} + \mathcal{I}^{(t),-1} U^{(t)} \] (\(\theta = (\beta, \sigma_\upsilon)\).)
  4. 수렴까지 반복.

→ ML 추정량과 점근 분산-공분산 동시 획득.

8.4 Empirical Bayes — \(\hat\upsilon_i\) 추정

BLUP 의 GLMM 버전

피험자별 \(\hat\theta_i\) 추정 (사후 분포의 모드 또는 평균):

\[ \hat\theta_i = E[\theta_i \mid Y_i, \hat\beta, \hat\sigma_\upsilon] \approx \arg\max_\theta L(Y_i \mid \theta) f(\theta) \]

이로부터 \(\hat\upsilon_i = \hat\sigma_\upsilon \hat\theta_i\).

용도:

  • 개인별 예측: \(\hat P(Y_{ij}^{\text{new}} = 1 \mid \theta_i) = \Psi(x_{ij}^\top \hat\beta + \hat\sigma_\upsilon \hat\theta_i)\).
  • 환자별 추세 진단.
  • 정밀 의료 (개인 맞춤 처치).

GEE 는 \(\hat\theta_i\) 를 못 함 (marginal 모형) → GLMM 의 결정적 차별점.

9 § 9.11 — Subject-Specific vs Population-Averaged 정리

9.1 두 효과의 수학적 관계

비축소성의 정확한 식 (식 9.21 풀이)

이항 GLMM 의 marginal 확률:

\[ \mu_{ij} = E[Y_{ij}] = \int \Psi(x_{ij}^\top \beta_M + \sigma_\upsilon \theta) \phi(\theta) \, d\theta \]

GEE/fixed 의 marginal 확률:

\[ \mu_{ij}^{(F)} = \Psi(x_{ij}^\top \beta_F) \]

같은 데이터에서 두 표현이 다른 \(\beta\) 를 줌 — 비축소성.

Zeger et al. (1988) 근사:

\[ \beta_M \approx \beta_F \cdot \sqrt{1 + (15/16)^2 \pi^2/3 \cdot \sigma_\upsilon^2} \]

→ 정량 변환 가능.

정규 GLM 과의 대비

정규 + identity link (Ch.4-5 의 MRM):

  • Mixed 의 회귀 계수 = Marginal 의 회귀 계수 (정확히 일치).
  • 비선형 link 가 아니므로 평균 적분 시 회귀 계수 보존.

비정규 GLMM (이항·카운트):

  • 비선형 link → 비축소성 발생.
  • \(\sigma_\upsilon = 0\) 이면 두 모형 일치, \(\sigma_\upsilon\) 클수록 차이 큼.

비축소성은 비정규 GLMM 의 본질적 성질, GLMM ↔︎ GEE 차이의 수학적 근거.

10 § 9.12 — 정신과 데이터 예시 (간략)

10.1 NIMH Schizophrenia Collaborative Study

Hedeker §9.12 의 사례 (간략 요약)
  • 표본: 437 명 정신분열병 환자, 6 주 추적.
  • 반응: 임상 호전 여부 (binary, 1 = 호전).
  • 그룹: Drug (chlorpromazine) vs Placebo.
  • 모형: 랜덤 절편 + 시간 + 그룹 + 그룹×시간.

적합 결과 (대략):

  • \(\hat\beta_{\text{group}}\): 처치 효과 유의 (drug 가 placebo 보다 호전 odds 높음).
  • \(\hat\beta_{\text{group} \times \text{time}}\): 시간 따라 처치 효과 증가.
  • \(\hat\sigma_\upsilon\): 환자 간 변동 큼 — ICC 약 0.5.

임상 해석: Drug 의 호전 효과가 유의 + 시간 따라 강해짐. 개인별 변동도 큼 → BLUP 으로 환자별 예측 가능.

자세한 수치 재현은 별도 sub-post 가치 (§ 9.12 자체가 자세한 case study).

11 코드 예시

11.1 Step 1: GLMM 이항 적합 (R lme4)

library(lme4)

# Hedeker 정신과 데이터 같은 종단 이항
fit_glmm <- glmer(
    improvement ~ time + group + time:group + (1 | subject),
    data = df,
    family = binomial(link = "logit"),
    nAGQ = 10  # adaptive Gauss-Hermite quadrature, Q=10
)

summary(fit_glmm)
# Output:
# Random effects:
#   subject (Intercept) sigma^2_v
# Fixed effects:
#   beta_0, beta_time, beta_group, beta_time:group

# OR 계산
exp(fixef(fit_glmm))

# Subject-specific BLUP
ranef(fit_glmm)$subject  # \hat{v}_i

# 각 피험자의 예측 확률
predict(fit_glmm, type = "response")  # P(Y=1 | x, v)

11.2 Step 2: Subject-Specific vs Marginal 비교

import numpy as np
import pandas as pd
import statsmodels.api as sm
import statsmodels.formula.api as smf
from statsmodels.genmod.generalized_estimating_equations import GEE
from statsmodels.genmod.cov_struct import Exchangeable


# GLMM (statsmodels — 제한적, R lme4 권장)
# 또는 R 의 glmer() 결과 사용

# GEE (marginal)
fit_gee = GEE.from_formula(
    "improvement ~ time + group + time:group",
    groups="subject",
    data=df,
    cov_struct=Exchangeable(),
    family=sm.families.Binomial(),
).fit()

beta_marginal = fit_gee.params

# Hedeker 식 (9.16) Zeger 근사로 변환
sigma_v = 1.5  # GLMM 추정값 가정
scale_factor = np.sqrt(1 + (15/16)**2 * np.pi**2 / 3 * sigma_v**2)

beta_subject_specific = beta_marginal * scale_factor

print(f"Marginal (GEE): {beta_marginal}")
print(f"Subject-specific (GLMM 근사): {beta_subject_specific}")
print(f"Scale factor: {scale_factor:.2f}")
# 예: σ_v = 1.5, scale ≈ 1.39

11.3 Step 3: ICC 계산 (잠재 변수 척도)

def icc_logistic(sigma_v: float) -> float:
    """이항 GLMM 의 잠재 변수 ICC"""
    return sigma_v**2 / (sigma_v**2 + np.pi**2 / 3)


def icc_probit(sigma_v: float) -> float:
    """Probit GLMM 의 잠재 변수 ICC"""
    return sigma_v**2 / (sigma_v**2 + 1)


# 예시
for sigma in [0.5, 1.0, 1.5, 2.0, 3.0]:
    print(f"σ_v = {sigma}: ICC (logit) = {icc_logistic(sigma):.3f}, "
          f"ICC (probit) = {icc_probit(sigma):.3f}")
ICC 해석
\(\sigma_\upsilon\) ICC (logit) 해석
0.5 0.071 약한 군집 — 시점 간 거의 독립
1.0 0.233 보통 군집 — Bock 같은 임상
1.5 0.406 강한 군집 — 환자 간 큰 차이
2.0 0.549 매우 강 — 같은 환자 시점 매우 유사
3.0 0.732 극도 강 — 환자 효과가 시점 효과 압도

ICC > 0.1 이면 GLMM 적용 정당화. ICC < 0.05 면 단순 로지스틱으로도 충분.

12 핵심 정리

한 페이지 요약
  1. GLMM 이항의 자리: Ch.4-7 정규 + Ch.8 GEE 의 비정규 종단 분석 패러다임 중 subject-specific 길.
  2. 로지스틱 회귀 (식 9.1-9.3): \(\log[p/(1-p)] = x^\top\beta\). logit scale 선형, \(p\) scale S 자.
  3. Probit (식 9.10): \(p = \Phi(x^\top\beta)\). 로지스틱과 비슷 결과, scale 차이만.
  4. Threshold concept (식 9.11): 잠재 변수 \(y = x^\top\beta + \epsilon\), \(Y = I(y > 0)\). 로지스틱·probit 의 통합.
  5. Logit ↔︎ Probit scaling (식 9.12): \(\beta_L \approx 1.81 \beta_P\). 결론 (유의성·방향) 거의 같음.
  6. Mixed-effects logistic (식 9.13-9.14): 랜덤 절편 추가 + 표준화 형태 (\(\sigma_\upsilon \theta_i\)).
  7. 잠재 변수 모형 (식 9.15): \(y_{ij} = x_{ij}^\top\beta + \sigma_\upsilon\theta_i + \epsilon_{ij}\). 분산 분해.
  8. ICC 잠재 변수: \(\sigma_\upsilon^2 / (\sigma_\upsilon^2 + \pi^2/3)\) (logit). 군집 강도.
  9. 비축소성 (식 9.16): \(\beta_M \approx \beta_F \sqrt{(\sigma_\upsilon^2+\sigma_\epsilon^2)/\sigma_\epsilon^2}\). GLMM 과 GEE 회귀 계수 차이.
  10. Subject-specific vs Marginal: 같은 데이터, 다른 질문. 결론은 보통 같음.
  11. 추정: Marginal MLE — Gauss-Hermite quadrature + Fisher scoring. Adaptive quadrature 권장.
  12. BLUP: \(\hat\theta_i\) — GLMM 의 결정적 차별점 (GEE 불가).

GLMM 이항은 종단 이항 데이터의 subject-specific 모형. Threshold concept 으로 이항을 잠재 정규/로지스틱으로 표현하고, 랜덤 효과 추가로 환자 간 이질성 모형화. 비축소성으로 GEE 와 회귀 계수 다르지만 임상 결론은 보통 같음.

내용 핵심 식
§ 9.1 GLMM 이항의 자리
§ 9.2-9.3 로지스틱·Probit 복습 (9.1)-(9.10)
§ 9.4 Threshold concept (9.11)-(9.12)
§ 9.5 Mixed-effects logistic (9.13)-(9.16)
§ 9.6-9.10 추정 Quadrature + Fisher
§ 9.11 Subject-specific vs Marginal (9.16)
§ 9.12 정신과 데이터 예시

13 다음 단계

주제 내용 위치
§ 9 sub-post 시리즈 §9.4 (threshold), §9.5 (mixed), §9.6-10 (추정), §9.11-12 (사례) 미작성
Ch.10 GLMM 순서형 비례 오즈 + 랜덤 효과 미작성
Ch.11 GLMM 명목 다항 + 랜덤 효과 미작성
Ch.12 GLMM 카운트 Poisson, NB, ZIP + 랜덤 효과 미작성 (mm-07 참조)

14 관련 주제

선행 지식

관련

후속 주제

  • Ch.9 sub-post 시리즈 (§ 9.4 threshold, § 9.5 mixed, § 9.6-10 estimation, § 9.12 사례)
  • Ch.10 순서형 GLMM
  • Ch.11 명목 GLMM
  • Ch.12 카운트 GLMM (mm-07 카운트 참조)

교재

  • Hedeker, D. & Gibbons, R. D. (2006). Longitudinal Data Analysis, Wiley, Ch.9 (pp. 149-186)
  • Bock, R. D. (1975). Multivariate Statistical Methods in Behavioral Research, McGraw-Hill — Threshold concept
  • McCullagh, P. & Nelder, J. A. (1989). Generalized Linear Models (2nd ed.), Chapman & Hall
  • Gibbons, R. D. (1981). “An empirical Bayes approach to detecting deficient educational programs”, JASA 76, 547-553
  • Stiratelli, R., Laird, N. M. & Ware, J. H. (1984). “Random-effects models for serial observations with binary response”, Biometrics 40, 961-971
  • Anderson, D. A. & Aitkin, M. (1985). “Variance component models with binary response: interviewer variability”, JRSS B 47, 203-210
  • Wong, G. Y. & Mason, W. M. (1985). “The hierarchical logistic regression model for multilevel analysis”, JASA 80, 513-524
  • Gibbons, R. D. & Bock, R. D. (1987). “Trend in correlated proportions”, Psychometrika 52, 113-124
  • Goldstein, H. (1991). “Nonlinear multilevel models, with an application to discrete response data”, Biometrika 78, 45-51
  • Zeger, S. L., Liang, K.-Y. & Albert, P. S. (1988). “Models for longitudinal data: a generalized estimating equation approach”, Biometrics 44, 1049-1060 — 비축소성 근사
  • Long, J. S. (1997). Regression Models for Categorical and Limited Dependent Variables, Sage — 잠재 변수 모형
  • Pinheiro, J. C. & Bates, D. M. (1995). “Approximations to the log-likelihood function in the nonlinear mixed-effects model”, JCGS 4, 12-35 — Adaptive quadrature
  • Snijders, T. A. B. & Bosker, R. J. (1999). Multilevel Analysis, Sage — 다수준 logistic

Subscribe

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