<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>Kwangmin Kim</title>
<link>kk3225.netlify.app/docs/blog/</link>
<atom:link href="kk3225.netlify.app/docs/blog/index.xml" rel="self" type="application/rss+xml"/>
<description>blog</description>
<generator>quarto-1.4.543</generator>
<lastBuildDate>Tue, 31 Dec 2109 15:00:00 GMT</lastBuildDate>
<item>
  <title>Data Governance</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Governance/</link>
  <description><![CDATA[ 





<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="kk3225.netlify.app/images/governance/data_governance.png" class="img-fluid figure-img" style="width:50.0%"></p>
<figcaption>Governance</figcaption>
</figure>
</div>
<section id="data-governance" class="level1" data-number="1">
<h1 data-number="1"><span class="header-section-number">1</span> Data Governance</h1>
<section id="data-governance-basic-concept" class="level2" data-number="1.1">
<h2 data-number="1.1" class="anchored" data-anchor-id="data-governance-basic-concept"><span class="header-section-number">1.1</span> Data Governance Basic Concept</h2>
<ul>
<li>2024-08-01, <a href="../../../../docs/blog/posts/Governance/1.basis.html">Data Governance Basic Concepts, 거버넌스 기본 개념</a></li>
<li>2024-08-02, <a href="../../../../docs/blog/posts/Governance/2.task_process.html">Task Process, 업무 절차</a></li>
<li>2024-08-03, <a href="../../../../docs/blog/posts/Governance/3.architetucre.html">Data Architecture, 구조관리</a></li>
<li>0000-00-00, [Data Pipeline Design, 파이프라인 설계]</li>
<li>0000-00-00, [Data Storage, 저장소 관리]</li>
<li>0000-00-00, [Data Management Policy, 데이터 관리 정책]</li>
<li>0000-00-00, [Data Stewardship Model, 데이터 관리 모델]</li>
</ul>
</section>
<section id="data-modeling" class="level2" data-number="1.2">
<h2 data-number="1.2" class="anchored" data-anchor-id="data-modeling"><span class="header-section-number">1.2</span> Data Modeling</h2>
<ul>
<li>2024-08-04, <a href="../../../../docs/blog/posts/Governance/4-0.data_model.html">Data Model (1) - Basic Concept</a></li>
<li>2024-08-05, <a href="../../../../docs/blog/posts/Governance/4-1.data_model_database.html">Data Model (2) - Database Basis</a></li>
<li>2024-08-06, <a href="../../../../docs/blog/posts/Governance/4-2.data_model_sql.html">Data Model (3) - SQL Concept</a></li>
<li>2024-08-07, <a href="../../../../docs/blog/posts/Governance/4-3.data_model_schema.html">Data Model (4) - DB Design</a></li>
<li>2024-08-08, <a href="../../../../docs/blog/posts/Governance/4-4.data_model_requirements.html">Data Model (5) - Requirement Collection</a></li>
<li>2024-08-09, <a href="../../../../docs/blog/posts/Governance/4-5-0.data_model_conceptual.html">Data Model (6) - Conceptual Design</a></li>
<li>2024-08-10, <a href="../../../../docs/blog/posts/Governance/4-5-1.data_model_conceptual_ER_model.html">Data Model (7) - ER Modeling</a></li>
</ul>
<section id="data-standardization" class="level3" data-number="1.2.1">
<h3 data-number="1.2.1" class="anchored" data-anchor-id="data-standardization"><span class="header-section-number">1.2.1</span> Data Standardization</h3>
<ul>
<li>2024-08-11, <a href="../../../../docs/blog/posts/Governance/5-0-0.data_standard.html">Data Standardization - Basic Concept</a></li>
<li>2024-08-12, <a href="../../../../docs/blog/posts/Governance/5-0-1.stndrdztn_rule.ver1.0.0.html">Data Standardization - Standard Rules</a></li>
<li>2024-11-25, <a href="../../../../docs/blog/posts/Governance/5-0-2.terminology_hierarchy.html">Data Standardization - 용어 정리</a></li>
<li>2024-08-12, <a href="../../../../docs/blog/posts/Governance/5-1.data_word_dictionary.html">Data Standardization - 표준 단어 사전</a></li>
<li>2024-08-13, <a href="../../../../docs/blog/posts/Governance/5-2.data_word_domain.html">Data Standardization - 표준 도메인 사전</a></li>
<li>2024-08-14, <a href="../../../../docs/blog/posts/Governance/5-3.data_word_glossary.html">Data Standardization - 표준 용어 사전</a></li>
<li>2024-08-15, <a href="../../../../docs/blog/posts/Governance/5-4.data_code.html">Data Standardization - 표준 코드</a></li>
<li>2024-08-16, <a href="../../../../docs/blog/posts/Governance/6-0.data_registration_process.html">Data Standardization - 등록 프로세스</a></li>
<li>2024-08-17, <a href="../../../../docs/blog/posts/Governance/6-1.data_review_process.html">Data Standardization - 용어 검토 프로세스</a></li>
<li>2024-08-18, <a href="../../../../docs/blog/posts/Governance/6-2.data_code_registration.html">Data Standardization - 코드 등록 프로세스</a></li>
<li>2024-08-19, <a href="../../../../docs/blog/posts/Governance/8-0.data_quality_measures.html">Data Standardization - 데이터 품질 측정</a></li>
<li>2024-08-19, <a href="../../../../docs/blog/posts/Governance/7-0.data_glossary_rules.html">Data Standardization - Glossary Usage Rules</a></li>
</ul>
</section>
<section id="data-quality" class="level3" data-number="1.2.2">
<h3 data-number="1.2.2" class="anchored" data-anchor-id="data-quality"><span class="header-section-number">1.2.2</span> Data Quality</h3>
<ul>
<li>0000-00-00, [Data Quality Control Process, 데이터 품질 절차]</li>
<li>0000-00-00, [Data Quality Measurement, 데이터 품질 측정]</li>
<li>0000-00-00, [Data Validation, 데이터 품질 검증]</li>
</ul>
</section>
<section id="etc." class="level3" data-number="1.2.3">
<h3 data-number="1.2.3" class="anchored" data-anchor-id="etc."><span class="header-section-number">1.2.3</span> etc.</h3>
<ul>
<li>2024-08-20, <a href="../../../../docs/blog/posts/Governance/current_status.html">Current Status, 현황 파악</a></li>
<li>0000-00-00, [Data Governance Solutions, 데이터 관리 솔루션]</li>
<li>2026-03-24, <a href="../../../../docs/blog/posts/Governance/9-0.ontology_overview.html">온톨로지 개론</a></li>
<li>2026-03-24, <a href="../../../../docs/blog/posts/Governance/9-1.metadata_ontology.html">온톨로지와 메타데이터 저장소 설계</a></li>
<li>2026-03-26, <a href="../../../../docs/blog/posts/Governance/10-0.metadata_mgmt_system_concept.html">메타데이터 관리 시스템 — 개념과 범위 정의</a></li>
<li>2026-03-26, <a href="../../../../docs/blog/posts/Governance/10-1.metadata_mgmt_system_data_model.html">메타데이터 관리 시스템 — 저장소 데이터 모델</a></li>
<li>2026-03-26, <a href="../../../../docs/blog/posts/Governance/10-2.metadata_mgmt_system_collection_change.html">메타데이터 관리 시스템 — 수집과 변경 관리</a></li>
<li>2026-03-26, <a href="../../../../docs/blog/posts/Governance/10-3.metadata_mgmt_system_quality_security.html">메타데이터 관리 시스템 — 품질과 보안</a></li>
<li>2026-03-26, <a href="../../../../docs/blog/posts/Governance/10-4.metadata_mgmt_system_architecture.html">메타데이터 관리 시스템 — 아키텍처와 구축 우선순위</a></li>
<li>0000-00-00, [Metadata Management, 메타데이터 관리]</li>
<li>0000-00-00, [Data Integration, 데이터 통합]</li>
<li>0000-00-00, [Data Security, 데이터 보안]</li>
</ul>
</section>
</section>
<section id="dama-framework" class="level2" data-number="1.3">
<h2 data-number="1.3" class="anchored" data-anchor-id="dama-framework"><span class="header-section-number">1.3</span> DAMA Framework</h2>
<ul>
<li>2026-03-27, <a href="../../../../docs/blog/posts/Governance/11-0.dama_framework_overview.html">데이터 거버넌스란 무엇인가 - DAMA 프레임워크와 데이터 자산의 본질</a></li>
<li>2026-03-27, <a href="../../../../docs/blog/posts/Governance/11-1.data_lifecycle_design.html">데이터 라이프사이클 설계 - 순환 구조가 파이프라인보다 강한 이유</a></li>
<li>2026-03-27, <a href="../../../../docs/blog/posts/Governance/11-2.data_standard_design.html">데이터 표준 관리 - 용어, 단어, 도메인 3계층이 필요한 이유</a></li>
<li>2026-03-27, <a href="../../../../docs/blog/posts/Governance/11-3.data_structure_mgmt.html">데이터 구조 관리 - 스키마 변경이 통제되지 않으면 생기는 일</a></li>
<li>2026-03-27, <a href="../../../../docs/blog/posts/Governance/11-4.code_master_data_mgmt.html">공통코드와 마스터 데이터 관리 - 개념 분리가 설계를 바꾼다</a></li>
<li>2026-03-27, <a href="../../../../docs/blog/posts/Governance/11-5.sensitive_data_mgmt.html">중요데이터 관리와 비식별화 - 보안이 활용을 막지 않는 설계</a></li>
<li>2026-03-27, <a href="../../../../docs/blog/posts/Governance/11-6.data_quality_lifecycle.html">데이터 품질 관리 - 프로파일링에서 클린징까지 자동화 사이클</a></li>
<li>2026-03-27, <a href="../../../../docs/blog/posts/Governance/11-7.data_utilization_federation.html">데이터 활용 - Federation과 BI, DW 없이 데이터를 제공하는 설계</a></li>
<li>2026-03-27, <a href="../../../../docs/blog/posts/Governance/11-8.change_mgmt_workflow.html">변경 관리 워크플로 - 변경 관리가 없으면 통제가 없다</a></li>
<li>2026-03-27, <a href="../../../../docs/blog/posts/Governance/11-9.integrated_architecture.html">통합 아키텍처 설계 - 단일 패키지 vs 컴포넌트 방식, 멀티 DBMS 추상화, RBAC, 스케줄러</a></li>
<li>2026-03-27, <a href="../../../../docs/blog/posts/Governance/11-10.roi_adoption_strategy.html">ROI 분석과 단계적 도입 전략 - 품질 향상 30%, 비용 절감 10배의 측정 근거와 업종별 시작점</a></li>
</ul>


</section>
</section>

 ]]></description>
  <category>Data Governance</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Governance/</guid>
  <pubDate>Tue, 31 Dec 2109 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Epidemiology</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Experimentation/Epidemiology/</link>
  <description><![CDATA[ 





<section id="contents" class="level1" data-number="1">
<h1 data-number="1"><span class="header-section-number">1</span> Contents</h1>
<section id="learning-path-for-experimentation" class="level2" data-number="1.1">
<h2 data-number="1.1" class="anchored" data-anchor-id="learning-path-for-experimentation"><span class="header-section-number">1.1</span> Learning Path for Experimentation</h2>
<p><strong>Priority Topics for Experimentation:</strong> 1. <strong>Experimental Studies → RCT</strong> (A/B Testing 직접 원형) 2. <strong>Causal Inference</strong> (전체 섹션 - 실험의 이론적 기초) 3. <strong>Effect Modification</strong> (Heterogeneous Treatment Effects) 4. <strong>Sample Size and Power</strong> (실험 설계 필수) 5. <strong>Propensity Score Methods</strong> (Observational causal inference)</p>
<p><strong>Recommended Study Order:</strong></p>
<p>Phase 1 (1-2주): Foundations + Study Designs → Focus on RCT and experimental principles</p>
<p>Phase 2 (1주): Measures of Association and Impact → Effect measures calculation practice</p>
<p>Phase 3 (2주): Causal Inference ⭐ → DAG practice, Counterfactual framework → Most critical for experimentation</p>
<p>Phase 4 (1주): Bias and Confounding + Study Fundamentals → Sample size calculations → Validity considerations</p>
<p>Phase 5 (선택): Advanced Topics → As needed for specific applications</p>
</section>
<section id="foundations" class="level2" data-number="1.2">
<h2 data-number="1.2" class="anchored" data-anchor-id="foundations"><span class="header-section-number">1.2</span> Foundations</h2>
<ul>
<li>1111-11-11, <a href="./foundations/concepts.qmd">Epidemiologic Concepts</a>
<ul>
<li>1111-11-11, <a href="./foundations/incidence_prevalence.qmd">Incidence vs.&nbsp;Prevalence (발생률 vs.&nbsp;유병률)</a></li>
<li>1111-11-11, <a href="./foundations/population_at_risk.qmd">Population at Risk (위험인구)</a></li>
<li>1111-11-11, <a href="./foundations/exposure_outcome.qmd">Exposure and Outcome (노출과 결과)</a></li>
</ul></li>
<li>1111-11-11, <a href="./foundations/framework.qmd">Study Design Framework (연구설계 프레임워크)</a>
<ul>
<li>1111-11-11, <a href="./foundations/descriptive_analytical.qmd">Descriptive vs.&nbsp;Analytical Studies (기술 vs.&nbsp;분석 연구)</a></li>
<li>1111-11-11, <a href="./foundations/observational_experimental.qmd">Observational vs.&nbsp;Experimental Studies (관찰 vs.&nbsp;실험 연구)</a></li>
<li>1111-11-11, <a href="./foundations/time_relationship.qmd">Time Relationship (시간적 관계)</a></li>
</ul></li>
</ul>
</section>
<section id="study-designs" class="level2" data-number="1.3">
<h2 data-number="1.3" class="anchored" data-anchor-id="study-designs"><span class="header-section-number">1.3</span> Study Designs</h2>
<ul>
<li>2023-02-27, <a href="../../../../../docs/blog/posts/Experimentation/Epidemiology/study_design.html">Types of Study Designs in Epidemiology</a>
<ul>
<li>1111-11-11, Descriptive Studies (기술연구)
<ul>
<li>1111-11-11, <a href="./descriptive/case_reports.qmd">Case Reports and Case Series (증례보고 및 증례군)</a></li>
<li>1111-11-11, <a href="./descriptive/ecological.qmd">Ecological Studies (생태학적 연구)</a></li>
</ul></li>
<li>1111-11-11, Observational Analytical Studies (관찰 분석연구)
<ul>
<li>1111-11-11, <a href="./observational/cross_sectional.qmd">Cross-sectional Studies (단면연구)</a></li>
<li>1111-11-11, <a href="./observational/case_control.qmd">Case-control Studies (환자-대조군 연구)</a></li>
<li>1111-11-11, <a href="./observational/cohort.qmd">Cohort Studies (코호트 연구)</a>
<ul>
<li>1111-11-11, <a href="./observational/cohort_prospective.qmd">Prospective Cohort (전향적 코호트)</a></li>
<li>1111-11-11, <a href="./observational/cohort_retrospective.qmd">Retrospective Cohort (후향적 코호트)</a></li>
</ul></li>
</ul></li>
<li>1111-11-11, Experimental Studies (실험연구) ⭐
<ul>
<li>1111-11-11, <a href="./experimental/rct.qmd">Randomized Controlled Trial (무작위 대조 시험)</a> ⭐</li>
<li>1111-11-11, <a href="./experimental/quasi_experimental.qmd">Quasi-experimental Studies (준실험 연구)</a></li>
<li>1111-11-11, <a href="./experimental/before_after.qmd">Before-after Studies (전후 연구)</a></li>
<li>1111-11-11, <a href="./experimental/factorial_design.qmd">Factorial Design (요인 설계)</a></li>
</ul></li>
<li>1111-11-11, Evidence Synthesis (근거 통합)
<ul>
<li>1111-11-11, <a href="./synthesis/systematic_review.qmd">Systematic Reviews (체계적 문헌고찰)</a></li>
<li>1111-11-11, <a href="./synthesis/meta_analysis.qmd">Meta-analyses (메타분석)</a></li>
</ul></li>
</ul></li>
</ul>
</section>
<section id="measures-of-association-and-impact" class="level2" data-number="1.4">
<h2 data-number="1.4" class="anchored" data-anchor-id="measures-of-association-and-impact"><span class="header-section-number">1.4</span> Measures of Association and Impact</h2>
<ul>
<li>2026-05-08, <a href="../../../../../docs/blog/posts/Experimentation/Epidemiology/effect_measures.html">Effect Measures: 효과·영향·인과 추정량 종합</a> ⭐ — RD/ARR/NNT/AR/PAR + ATE/ITT/LATE + p/CI/power/Cohen’s d + E-value + OEC/MDE 통합</li>
<li>2023-05-23, <a href="../../../../../docs/blog/posts/Experimentation/Epidemiology/relative_risk_odds_ratio.html">Measures of Risk: Relative Risk &amp; Odds Ratio</a> — RR/OR 정의 (위 글의 base)</li>
<li>2023-05-23, <a href="./measures_overview.qmd">Measures in Epidemiology</a>
<ul>
<li>1111-11-11, Contingency Tables and Basic Measures (분할표와 기본 측정)
<ul>
<li>1111-11-11, <a href="./measures/contingency_table.qmd">2x2 Contingency Tables (2x2 분할표)</a></li>
<li>1111-11-11, <a href="./measures/risk_rate_odds.qmd">Risk, Rate, and Odds (위험, 비율, 오즈)</a></li>
</ul></li>
<li>1111-11-11, Measures of Association (연관성 지표)
<ul>
<li>1111-11-11, <a href="./measures/relative_risk.qmd">Relative Risk (상대위험도)</a></li>
<li>1111-11-11, <a href="./measures/odds_ratio.qmd">Odds Ratio (오즈비)</a></li>
<li>1111-11-11, <a href="./measures/rate_ratio.qmd">Rate Ratio (비율비)</a></li>
</ul></li>
<li>1111-11-11, Measures of Effect (효과 지표)
<ul>
<li>1111-11-11, <a href="./measures/risk_difference.qmd">Risk Difference (위험차이)</a></li>
<li>1111-11-11, <a href="./measures/rrr.qmd">Relative Risk Reduction (상대위험감소)</a></li>
<li>1111-11-11, <a href="./measures/arr.qmd">Absolute Risk Reduction (절대위험감소)</a></li>
<li>1111-11-11, <a href="./measures/nnt.qmd">Number Needed to Treat (치료필요수)</a></li>
</ul></li>
<li>1111-11-11, Measures of Impact (영향 지표)
<ul>
<li>1111-11-11, <a href="./measures/attributable_risk.qmd">Attributable Risk (기여위험도)</a></li>
<li>1111-11-11, <a href="./measures/ar_percent.qmd">Attributable Risk Percent (기여위험분율)</a></li>
<li>1111-11-11, <a href="./measures/population_attributable_risk.qmd">Population Attributable Risk (인구기여위험도)</a></li>
<li>1111-11-11, <a href="./measures/par_percent.qmd">Population Attributable Risk Percent (인구기여위험분율)</a></li>
</ul></li>
<li>1111-11-11, Statistical Inference (통계적 추론)
<ul>
<li>1111-11-11, <a href="./measures/confidence_intervals.qmd">Confidence Intervals (신뢰구간)</a></li>
<li>1111-11-11, <a href="./measures/hypothesis_testing.qmd">Hypothesis Testing (가설 검정)</a></li>
<li>1111-11-11, <a href="./measures/p_values.qmd">p-values and Interpretation (p-값과 해석)</a></li>
</ul></li>
</ul></li>
</ul>
</section>
<section id="causal-inference" class="level2" data-number="1.5">
<h2 data-number="1.5" class="anchored" data-anchor-id="causal-inference"><span class="header-section-number">1.5</span> Causal Inference ⭐</h2>
<ul>
<li>1111-11-11, <a href="./causation/index.qmd">Causation in Epidemiology (역학에서의 인과관계)</a>
<ul>
<li>1111-11-11, Causation Concepts (인과관계 개념)
<ul>
<li>1111-11-11, <a href="./causation/necessary_sufficient.qmd">Necessary vs.&nbsp;Sufficient Causes (필요조건 vs.&nbsp;충분조건)</a></li>
<li>1111-11-11, <a href="./causation/component_causes.qmd">Component Causes (구성요인)</a></li>
<li>1111-11-11, <a href="./causation/induction_period.qmd">Induction Period (유도기간)</a></li>
</ul></li>
<li>1111-11-11, <a href="./causation/bradford_hill.qmd">Bradford Hill Criteria (Bradford Hill 기준)</a>
<ul>
<li>1111-11-11, <a href="./causation/strength.qmd">Strength of Association (연관성의 강도)</a></li>
<li>1111-11-11, <a href="./causation/consistency.qmd">Consistency and Replication (일관성과 재현성)</a></li>
<li>1111-11-11, <a href="./causation/specificity.qmd">Specificity (특이성)</a></li>
<li>1111-11-11, <a href="./causation/temporality.qmd">Temporality (시간적 선후관계)</a></li>
<li>1111-11-11, <a href="./causation/dose_response.qmd">Biological Gradient (생물학적 기울기)</a></li>
<li>1111-11-11, <a href="./causation/plausibility.qmd">Plausibility and Coherence (개연성과 일관성)</a></li>
<li>1111-11-11, <a href="./causation/experiment_analogy.qmd">Experiment and Analogy (실험과 유추)</a></li>
</ul></li>
<li>1111-11-11, <a href="./causation/counterfactual.qmd">Counterfactual Framework (반사실적 프레임워크)</a> ⭐
<ul>
<li>1111-11-11, <a href="./causation/potential_outcomes.qmd">Potential Outcomes (잠재결과)</a></li>
<li>1111-11-11, <a href="./causation/ate.qmd">Average Treatment Effect (평균 처치효과)</a></li>
<li>1111-11-11, <a href="./causation/sutva.qmd">SUTVA (안정단위처치값 가정)</a></li>
</ul></li>
<li>1111-11-11, <a href="./causation/dag.qmd">Directed Acyclic Graphs (방향성 비순환 그래프)</a> ⭐
<ul>
<li>1111-11-11, <a href="./causation/causal_pathways.qmd">Causal Pathways (인과 경로)</a></li>
<li>1111-11-11, <a href="./causation/confounding_paths.qmd">Confounding Paths (교란 경로)</a></li>
<li>1111-11-11, <a href="./causation/colliders.qmd">Colliders and Selection Bias (충돌자와 선택 편향)</a></li>
<li>1111-11-11, <a href="./causation/d_separation.qmd">d-separation (d-분리)</a></li>
</ul></li>
<li>1111-11-11, <a href="./causation/propensity_score.qmd">Propensity Score Methods (성향점수 방법)</a>
<ul>
<li>1111-11-11, <a href="./causation/ps_matching.qmd">Propensity Score Matching (성향점수 매칭)</a></li>
<li>1111-11-11, <a href="./causation/iptw.qmd">Inverse Probability Weighting (역확률 가중)</a></li>
<li>1111-11-11, <a href="./causation/ps_stratification.qmd">Propensity Score Stratification (성향점수 층화)</a></li>
<li>1111-11-11, <a href="./causation/ps_adjustment.qmd">Covariate Adjustment (공변량 조정)</a></li>
</ul></li>
</ul></li>
</ul>
</section>
<section id="bias-and-confounding" class="level2" data-number="1.6">
<h2 data-number="1.6" class="anchored" data-anchor-id="bias-and-confounding"><span class="header-section-number">1.6</span> Bias and Confounding</h2>
<ul>
<li>1111-11-11, <a href="./bias/index.qmd">Bias in Epidemiologic Studies (역학 연구의 편향)</a>
<ul>
<li>1111-11-11, Types of Bias (편향의 종류)
<ul>
<li>1111-11-11, <a href="./bias/selection_bias.qmd">Selection Bias (선택 편향)</a></li>
<li>1111-11-11, <a href="./bias/information_bias.qmd">Information Bias (정보 편향)</a></li>
<li>1111-11-11, <a href="./bias/misclassification.qmd">Misclassification Bias (오분류 편향)</a>
<ul>
<li>1111-11-11, <a href="./bias/nondifferential.qmd">Non-differential Misclassification (비차별적 오분류)</a></li>
<li>1111-11-11, <a href="./bias/differential.qmd">Differential Misclassification (차별적 오분류)</a></li>
</ul></li>
</ul></li>
</ul></li>
<li>1111-11-11, <a href="./confounding/index.qmd">Confounding (교란)</a>
<ul>
<li>1111-11-11, <a href="./confounding/definition.qmd">Definition and Criteria (정의와 기준)</a></li>
<li>1111-11-11, <a href="./confounding/positive_negative.qmd">Positive vs.&nbsp;Negative Confounding (양성 vs.&nbsp;음성 교란)</a></li>
<li>1111-11-11, <a href="./confounding/residual.qmd">Residual Confounding (잔여 교란)</a></li>
</ul></li>
<li>1111-11-11, <a href="./effect_modification/index.qmd">Effect Modification (효과 수정)</a> ⭐
<ul>
<li>1111-11-11, <a href="./effect_modification/vs_confounding.qmd">vs.&nbsp;Confounding (교란과의 구분)</a></li>
<li>1111-11-11, <a href="./effect_modification/statistical_interaction.qmd">Statistical Interaction (통계적 상호작용)</a></li>
<li>1111-11-11, <a href="./effect_modification/biological_interaction.qmd">Biological Interaction (생물학적 상호작용)</a></li>
</ul></li>
<li>1111-11-11, <a href="./control/index.qmd">Control Methods (통제 방법)</a>
<ul>
<li>1111-11-11, Design Stage Methods (설계 단계 방법)
<ul>
<li>1111-11-11, <a href="./control/restriction.qmd">Restriction (제한)</a></li>
<li>1111-11-11, <a href="./control/matching.qmd">Matching (매칭)</a></li>
</ul></li>
<li>1111-11-11, Analysis Stage Methods (분석 단계 방법)
<ul>
<li>1111-11-11, <a href="./control/stratification.qmd">Stratification Analysis (층화 분석)</a></li>
<li>1111-11-11, <a href="./control/standardization.qmd">Standardization (표준화)</a></li>
<li>1111-11-11, <a href="./control/regression_adjustment.qmd">Regression Adjustment (회귀 조정)</a></li>
</ul></li>
</ul></li>
</ul>
</section>
<section id="study-design-fundamentals" class="level2" data-number="1.7">
<h2 data-number="1.7" class="anchored" data-anchor-id="study-design-fundamentals"><span class="header-section-number">1.7</span> Study Design Fundamentals</h2>
<ul>
<li>1111-11-11, <a href="./fundamentals/sample_size_power.qmd">Sample Size and Power (표본 크기와 검정력)</a> ⭐
<ul>
<li>1111-11-11, <a href="./fundamentals/type1_error.qmd">Type I Error (1종 오류, α)</a></li>
<li>1111-11-11, <a href="./fundamentals/type2_error.qmd">Type II Error (2종 오류, β)</a></li>
<li>1111-11-11, <a href="./fundamentals/power.qmd">Statistical Power (통계적 검정력, 1-β)</a></li>
<li>1111-11-11, <a href="./fundamentals/effect_size.qmd">Effect Size (효과 크기)</a></li>
<li>1111-11-11, <a href="./fundamentals/sample_size_calc.qmd">Sample Size Calculation (표본 크기 계산)</a></li>
</ul></li>
<li>1111-11-11, <a href="./fundamentals/randomization.qmd">Randomization Methods (무작위 배정 방법)</a>
<ul>
<li>1111-11-11, <a href="./fundamentals/simple_random.qmd">Simple Randomization (단순 무작위배정)</a></li>
<li>1111-11-11, <a href="./fundamentals/block_random.qmd">Block Randomization (블록 무작위배정)</a></li>
<li>1111-11-11, <a href="./fundamentals/stratified_random.qmd">Stratified Randomization (층화 무작위배정)</a></li>
</ul></li>
<li>1111-11-11, <a href="./fundamentals/validity.qmd">Validity in Epidemiologic Studies (역학 연구의 타당도)</a>
<ul>
<li>1111-11-11, <a href="./fundamentals/internal_validity.qmd">Internal Validity (내적 타당도)</a></li>
<li>1111-11-11, <a href="./fundamentals/external_validity.qmd">External Validity (외적 타당도)</a></li>
<li>1111-11-11, <a href="./fundamentals/construct_validity.qmd">Construct Validity (구성 타당도)</a></li>
</ul></li>
</ul>
</section>
<section id="screening-and-diagnostic-tests" class="level2" data-number="1.8">
<h2 data-number="1.8" class="anchored" data-anchor-id="screening-and-diagnostic-tests"><span class="header-section-number">1.8</span> Screening and Diagnostic Tests</h2>
<ul>
<li>2026-05-08, <a href="../../../../../docs/blog/posts/Experimentation/Epidemiology/diagnostic_measures.html">Diagnostic &amp; Screening Measures: 진단·분류 평가 지표 종합</a> ⭐ — Sn/Sp/PPV/NPV/LR±/DOR/Youden’s J/AUC/Brier/Calibration/NRI/IDI + Bayesian update + 진단 메타분석</li>
<li>1111-11-11, <a href="./screening/index.qmd">Evaluation of Diagnostic Tests (진단검사 평가)</a>
<ul>
<li>1111-11-11, Test Performance Measures (검사 성능 지표)
<ul>
<li>1111-11-11, <a href="./screening/sensitivity.qmd">Sensitivity (민감도, True Positive Rate)</a></li>
<li>1111-11-11, <a href="./screening/specificity.qmd">Specificity (특이도, True Negative Rate)</a></li>
<li>1111-11-11, <a href="./screening/ppv.qmd">Positive Predictive Value (양성 예측도, PPV)</a></li>
<li>1111-11-11, <a href="./screening/npv.qmd">Negative Predictive Value (음성 예측도, NPV)</a></li>
</ul></li>
<li>1111-11-11, <a href="./screening/likelihood_ratios.qmd">Likelihood Ratios (우도비)</a>
<ul>
<li>1111-11-11, <a href="./screening/lr_positive.qmd">Positive Likelihood Ratio (양성 우도비, LR+)</a></li>
<li>1111-11-11, <a href="./screening/lr_negative.qmd">Negative Likelihood Ratio (음성 우도비, LR-)</a></li>
<li>1111-11-11, <a href="./screening/pretest_posttest.qmd">Pre-test to Post-test Probability (사전-사후 확률)</a></li>
</ul></li>
<li>1111-11-11, Trade-offs and Optimization (상충관계와 최적화)
<ul>
<li>1111-11-11, <a href="./screening/roc_curve.qmd">ROC Curve (ROC 곡선)</a></li>
<li>1111-11-11, <a href="./screening/auc.qmd">Area Under Curve (곡선하면적, AUC)</a></li>
<li>1111-11-11, <a href="./screening/cutpoint.qmd">Optimal Cut-point Selection (최적 절단값 선택)</a></li>
</ul></li>
<li>1111-11-11, <a href="./screening/bayesian.qmd">Bayesian Interpretation (베이지안 해석)</a>
<ul>
<li>1111-11-11, <a href="./screening/bayes_theorem.qmd">Bayes’ Theorem Connection (베이즈 정리와의 연결)</a></li>
</ul></li>
</ul></li>
</ul>
</section>
<section id="survival-analysis" class="level2" data-number="1.9">
<h2 data-number="1.9" class="anchored" data-anchor-id="survival-analysis"><span class="header-section-number">1.9</span> Survival Analysis</h2>
<ul>
<li>2026-05-08, <a href="../../../../../docs/blog/posts/Experimentation/Epidemiology/time_to_event_measures.html">Time-to-Event Measures: 시간-사건 분석 지표 종합</a> ⭐ — IR/IRR/HR/KM/log-rank/Cox PH/SMR·SIR/Causal Survival/메타분석 통합</li>
<li>1111-11-11, <a href="./survival/index.qmd">Time-to-Event Analysis (시간-사건 분석)</a>
<ul>
<li>1111-11-11, Basic Concepts (기본 개념)
<ul>
<li>1111-11-11, <a href="./survival/censoring.qmd">Censoring (중도절단)</a></li>
<li>1111-11-11, <a href="./survival/survival_function.qmd">Survival Function (생존함수)</a></li>
<li>1111-11-11, <a href="./survival/hazard_function.qmd">Hazard Function (위험함수)</a></li>
</ul></li>
<li>1111-11-11, <a href="./survival/kaplan_meier.qmd">Kaplan-Meier Method (Kaplan-Meier 방법)</a>
<ul>
<li>1111-11-11, <a href="./survival/nonparametric.qmd">Non-parametric Estimation (비모수 추정)</a></li>
<li>1111-11-11, <a href="./survival/logrank_test.qmd">Log-rank Test (로그순위 검정)</a></li>
</ul></li>
<li>1111-11-11, <a href="./survival/cox_model.qmd">Cox Proportional Hazards Model (Cox 비례위험모형)</a>
<ul>
<li>1111-11-11, <a href="./survival/semiparametric.qmd">Semi-parametric Model (준모수 모형)</a></li>
<li>1111-11-11, <a href="./survival/hazard_ratio.qmd">Hazard Ratio (위험비)</a></li>
<li>1111-11-11, <a href="./survival/ph_assumption.qmd">Proportional Hazards Assumption (비례위험 가정)</a></li>
</ul></li>
<li>1111-11-11, Advanced Survival Topics (고급 생존분석 주제)
<ul>
<li>1111-11-11, <a href="./survival/competing_risks.qmd">Competing Risks (경쟁위험)</a></li>
<li>1111-11-11, <a href="./survival/recurrent_events.qmd">Recurrent Events (반복사건)</a></li>
</ul></li>
</ul></li>
</ul>
</section>
<section id="advanced-topics" class="level2" data-number="1.10">
<h2 data-number="1.10" class="anchored" data-anchor-id="advanced-topics"><span class="header-section-number">1.10</span> Advanced Topics</h2>
<ul>
<li>1111-11-11, <a href="./advanced/designs/index.qmd">Advanced Study Designs (고급 연구설계)</a>
<ul>
<li>1111-11-11, <a href="./advanced/designs/cluster_rct.qmd">Cluster Randomized Trials (군집 무작위 시험)</a></li>
<li>1111-11-11, <a href="./advanced/designs/stepped_wedge.qmd">Stepped Wedge Designs (단계적 쐐기 설계)</a></li>
<li>1111-11-11, <a href="./advanced/designs/adaptive.qmd">Adaptive Designs (적응형 설계)</a></li>
<li>1111-11-11, <a href="./advanced/designs/platform_trials.qmd">Platform Trials (플랫폼 시험)</a></li>
</ul></li>
<li>1111-11-11, <a href="./advanced/causal/index.qmd">Advanced Causal Methods (고급 인과추론 방법)</a>
<ul>
<li>1111-11-11, <a href="./advanced/causal/instrumental_variables.qmd">Instrumental Variables (도구변수)</a></li>
<li>1111-11-11, <a href="./advanced/causal/rdd.qmd">Regression Discontinuity Design (회귀불연속 설계)</a></li>
<li>1111-11-11, <a href="./advanced/causal/did.qmd">Difference-in-Differences (이중차분법)</a></li>
<li>1111-11-11, <a href="./advanced/causal/synthetic_control.qmd">Synthetic Control Methods (합성 통제 방법)</a></li>
</ul></li>
<li>1111-11-11, <a href="./advanced/stats/index.qmd">Advanced Statistical Methods (고급 통계 방법)</a>
<ul>
<li>1111-11-11, <a href="./advanced/stats/multilevel_modeling.qmd">Multilevel/Hierarchical Modeling (다층/계층 모델링)</a></li>
<li>1111-11-11, <a href="./advanced/stats/meta_analysis.qmd">Meta-analysis (메타분석)</a>
<ul>
<li>1111-11-11, <a href="./advanced/stats/fixed_effects.qmd">Fixed Effects Model (고정효과 모형)</a></li>
<li>1111-11-11, <a href="./advanced/stats/random_effects.qmd">Random Effects Model (무선효과 모형)</a></li>
<li>1111-11-11, <a href="./advanced/stats/meta_regression.qmd">Meta-regression (메타회귀분석)</a></li>
</ul></li>
<li>1111-11-11, <a href="./advanced/stats/missing_data.qmd">Missing Data Methods (결측치 처리 방법)</a>
<ul>
<li>1111-11-11, <a href="./advanced/stats/missing_mechanisms.qmd">MCAR, MAR, MNAR (결측 메커니즘)</a></li>
<li>1111-11-11, <a href="./advanced/stats/multiple_imputation.qmd">Multiple Imputation (다중대체)</a></li>
</ul></li>
<li>1111-11-11, <a href="./advanced/stats/measurement_error.qmd">Measurement Error Models (측정 오차 모형)</a></li>
</ul></li>
<li>1111-11-11, <a href="./advanced/special/index.qmd">Special Topics (특수 주제)</a>
<ul>
<li>1111-11-11, <a href="./advanced/special/time_varying_confounding.qmd">Time-varying Confounding (시간가변 교란)</a></li>
<li>1111-11-11, <a href="./advanced/special/mediation.qmd">Mediation Analysis (매개분석)</a></li>
<li>1111-11-11, <a href="./advanced/special/g_methods.qmd">G-methods (G-방법)</a>
<ul>
<li>1111-11-11, <a href="./advanced/special/g_computation.qmd">G-computation (G-계산)</a></li>
<li>1111-11-11, <a href="./advanced/special/ipw.qmd">Inverse Probability Weighting (역확률 가중)</a></li>
<li>1111-11-11, <a href="./advanced/special/g_estimation.qmd">G-estimation (G-추정)</a></li>
</ul></li>
<li>1111-11-11, <a href="./advanced/special/sensitivity_analysis.qmd">Sensitivity Analysis (민감도 분석)</a></li>
<li>1111-11-11, <a href="./advanced/special/marginal_structural_models.qmd">Marginal Structural Models (주변구조모형)</a></li>
</ul></li>
</ul>
</section>
<section id="causal-survival-analysis" class="level2" data-number="1.11">
<h2 data-number="1.11" class="anchored" data-anchor-id="causal-survival-analysis"><span class="header-section-number">1.11</span> Causal Survival Analysis</h2>
<ul>
<li>1111-11-11, <a href="./advanced/causal_survival/index.qmd">Causal Survival Analysis (인과적 생존분석)</a>
<ul>
<li>1111-11-11, <a href="./advanced/causal_survival/hazards_risks.qmd">Hazards and Risks in Causal Framework (인과적 프레임워크에서의 위험과 위험률)</a></li>
<li>1111-11-11, <a href="./advanced/causal_survival/ipw_survival.qmd">IP Weighting for Survival (생존분석에서의 역확률 가중)</a></li>
<li>1111-11-11, <a href="./advanced/causal_survival/g_formula_survival.qmd">G-formula for Survival (생존분석에서의 G-공식)</a></li>
<li>1111-11-11, <a href="./advanced/causal_survival/censoring_causal.qmd">Censoring and Causal Inference (중도절단과 인과추론)</a></li>
</ul></li>
</ul>
</section>
<section id="variable-selection-for-causal-inference" class="level2" data-number="1.12">
<h2 data-number="1.12" class="anchored" data-anchor-id="variable-selection-for-causal-inference"><span class="header-section-number">1.12</span> Variable Selection for Causal Inference</h2>
<ul>
<li>1111-11-11, <a href="./advanced/variable_selection/index.qmd">Variable Selection in Causal Inference (인과추론에서의 변수 선택)</a>
<ul>
<li>1111-11-11, <a href="./advanced/variable_selection/confounder_selection.qmd">Confounder Selection (교란변수 선택)</a></li>
<li>1111-11-11, <a href="./advanced/variable_selection/high_dimensional.qmd">High-dimensional Data and Causal Inference (고차원 데이터와 인과추론)</a></li>
</ul></li>
</ul>


</section>
</section>

 ]]></description>
  <category>Epidemiology</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Experimentation/Epidemiology/</guid>
  <pubDate>Sun, 28 Feb 2100 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Mathematics</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Math/</link>
  <description><![CDATA[ 





<section id="contents" class="level1" data-number="1">

<section id="basic" class="level2" data-number="1.1">

<ul>
<li>2023-03-23, <a href="../../../../docs/blog/posts/Math/variables.html">Variable types</a></li>
<li>2023-03-14, <a href="./mean.qmd">Harmonic Mean</a></li>
<li>2026-05-05, <a href="../../../../docs/blog/posts/Math/closed-functional-canonical-form.html">Closed Form, Functional Form, Canonical Form</a></li>
<li>1111-11-11, Function
<ul>
<li>2023-01-31, <a href="../../../../docs/blog/posts/Math/function/function.html">Function</a></li>
<li>2023-01-31, <a href="../../../../docs/blog/posts/Math/function/univariable_scalar_function.html">Function (1) - Univariable Scalar Function (One to One)</a></li>
<li>2023-01-31, <a href="../../../../docs/blog/posts/Math/function/multivariable_scalar_function.html">Function (2) - Multi-variable Scalar Function (Many to One)</a></li>
<li>2023-01-31, <a href="../../../../docs/blog/posts/Math/function/univariable_vector_function.html">Function (3) - Univariable Vector Function (One to Many)</a></li>
<li>2023-01-31, <a href="../../../../docs/blog/posts/Math/function/mutivariable_vector_function.html">Function (4) - Multi-variable Vector Function (Many to Many)</a></li>
<li>2023-02-18, <a href="../../../../docs/blog/posts/Math/function/composite_function.html">Function (5) - Composite Function</a></li>
<li>2026-03-23, <a href="../../../../docs/blog/posts/Math/function/function_addition_vs_composition.html">Function (6) - 함수의 합 vs 합성함수 — Sequential vs Joint 추정</a></li>
</ul></li>
<li>2023-02-18, <a href="../../../../docs/blog/posts/Math/transformation.html">Transformations of Functions</a></li>
<li>2023-03-24, <a href="../../../../docs/blog/posts/Math/convex_combination.html">Convex Combination</a></li>
<li>2023-03-18, <a href="../../../../docs/blog/posts/Math/2023-03-18_higher_order_derivative.html">Higher Order Derivative</a></li>
<li>2023-03-15, <a href="../../../../docs/blog/posts/Math/minimizer.html">Minimizer &amp; Minimum</a></li>
<li>2023-03-15, <a href="../../../../docs/blog/posts/Math/taylor_series.html">Taylor Series</a></li>
<li>1111-11-11, Vector &amp; Matrix</li>
<li>2023-03-14, <a href="../../../../docs/blog/posts/Math/epsilon_delta.html">Limit, <img src="https://latex.codecogs.com/png.latex?%5Cepsilon-%5Cdelta"> Method</a></li>
<li>Differentiation
<ul>
<li>2023-02-04, <a href="../../../../docs/blog/posts/Math/2023-02-04_uni_derivative.html">Derivative (1) - Univariable Scalar Funtion</a></li>
<li>2023-02-10, <a href="../../../../docs/blog/posts/Math/2023-02-10_composite_partial_derivative.html">Derivative (2) - Chain Rule &amp; Partial Derivative</a></li>
<li>1111-11-11, Derivative (3) - Higher Order Derivative</li>
<li>1111-11-11, Derivative (4) - Mean Value Theorem</li>
<li>1111-11-11, Derivative (5) - Gradient</li>
</ul></li>
<li>2023-03-15, <a href="./taylor_series/index.qmd">Talyer’s Series</a></li>
<li>1111-11-11, Gradient Direction</li>
<li>1111-11-11, Random Variable</li>
<li>1111-11-11, Probability Distribution</li>
<li>1111-11-11, Information Theory - Entropy</li>
<li>1111-11-11,</li>
<li>1111-11-11,</li>
<li>1111-11-11,</li>
<li>1111-11-11,</li>
</ul>
</section>
<section id="linear-algebra" class="level2" data-number="1.2">

<section id="mit-18.06-linear-algebra-gilbert-strang-강의-시리즈" class="level3" data-number="1.2.1">

<ul>
<li>2026-04-08, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-00-gilbert-strang-overview.html">MIT 18.06 코스 전체 개요 — 왜 배우는가, 무엇을 다루는가</a></li>
</ul>
<section id="ch.1-introduction-to-vectors" class="level4" data-number="1.2.1.1">

<ul>
<li>2026-04-06, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-01-1-gilbert-strang-vectors-overview.html">Ch.1 Overview — 선형결합, 내적, 코사인, 노름 종류</a></li>
<li>2026-04-06, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-01-2-gilbert-strang-vectors-linear-combinations.html">Ch.1 §1.1 — Vectors and Linear Combinations</a></li>
<li>2026-04-08, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-01-3-gilbert-strang-vectors-length-dot-products.html">Ch.1 §1.2 — Lengths and Dot Products</a></li>
</ul>
</section>
<section id="ch.2-solving-linear-equations" class="level4" data-number="1.2.1.2">

<ul>
<li>2026-04-08, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-02-1-gilbert-strang-solving-linear-equation-overview.html">Ch.2 Overview — Row Picture · Column Picture · Ax=b에서 LU 분해까지</a></li>
<li>2026-04-08, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-02-2-gilbert-strang-vectors-linear-equations.html">Ch.2 §2.1 — Vectors and Linear Equations</a></li>
<li>2026-04-08, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-02-3-gilbert-strang-elimination-idea.html">Ch.2 §2.2 — The Idea of Elimination</a></li>
<li>2026-04-08, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-02-4-gilbert-strang-matrix-elimination.html">Ch.2 §2.3 — Elimination Using Matrices</a></li>
<li>2026-04-08, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-02-5-gilbert-strang-matrix-operation-rules.html">Ch.2 §2.4 — Rules for Matrix Operations</a></li>
<li>2026-04-08, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-02-6-gilbert-strang-factorization.html">Ch.2 §2.6 — Elimination = Factorization: A = LU</a></li>
<li>2026-04-08, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-02-7-gilbert-strang-transpose-permutations.html">Ch.2 §2.7 — Transposes and Permutations</a></li>
</ul>
</section>
<section id="ch.3-vector-spaces-and-subspaces" class="level4" data-number="1.2.1.3">

<ul>
<li>2026-04-09, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-03-1-gilbert-strang-vector-space-overview.html">Ch.3 §3.1 — Spaces of Vectors and Subspaces Overview</a></li>
<li>2026-04-09, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-03-2-gilbert-strang-spaces-of-vectors.html">Ch.3 §3.1 심화 — Spaces of Vectors (행렬·다항식·함수 공간, 부분공간 교집합·합)</a></li>
<li>2026-04-09, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-03-3-gilbert-strang-null-space.html">Ch.3 §3.2 — The Nullspace of A: Solving Ax = 0</a></li>
<li>2026-04-09, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-03-4-gilbert-strang-rank-row-reduced-form.html">Ch.3 §3.3 — The Rank and the Row Reduced Form</a></li>
<li>2026-04-09, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-03-5-gilbert-strang-complete-solution.html">Ch.3 §3.4 — The Complete Solution to Ax = b</a></li>
<li>2026-04-09, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-03-6-gilbert-strang-independence-basis-dimension.html">Ch.3 §3.5 — Independence, Basis and Dimension</a></li>
<li>2026-04-09, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-03-7-gilbert-strang-four-subspaces.html">Ch.3 §3.6 — Dimensions of the Four Subspaces</a></li>
<li>2023-03-30, <a href="../../../../docs/blog/posts/Math/linear_algebra/special-matrices-catalog.html">Special Matrices — 카탈로그 (정사각·대각·대칭·멱등·중심행렬·공분산)</a></li>
<li>2026-04-12, <a href="../../../../docs/blog/posts/Math/linear_algebra/12.xtx-variance-covariance.html"><img src="https://latex.codecogs.com/png.latex?X%5E%5Ctop%20X"> 가 왜 분산인가 — Gram Matrix, Scatter Matrix, 공분산 행렬</a></li>
</ul>
</section>
<section id="ch.4-orthogonality" class="level4" data-number="1.2.1.4">

<ul>
<li>2026-04-10, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-04-1-gilbert-strang-orthogonality-overview.html">Ch.4 Overview — 직교성(Orthogonality) 개요</a></li>
<li>2026-04-10, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-04-2-gilbert-strang-orthogonality-four-subspaces.html">Ch.4 §4.1 — Orthogonality of the Four Subspaces</a></li>
<li>2026-04-10, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-04-3-gilbert-strang-projections.html">Ch.4 §4.2 — Projections (투영)</a></li>
<li>2026-04-10, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-04-4-gilbert-strang-least-squares.html">Ch.4 §4.3 — Least Squares Approximations (최소제곱 근사)</a></li>
<li>2026-04-10, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-04-5-gilbert-strang-orthogonal-bases-gram-schmidt.html">Ch.4 §4.4 — Orthogonal Bases and Gram-Schmidt (정규직교 기저와 그람-슈미트)</a></li>
</ul>
</section>
<section id="ch.5-determinants" class="level4" data-number="1.2.1.5">

<ul>
<li>2026-04-10, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-05-1-gilbert-strang-determinants-overview.html">Ch.5 Overview — Determinants (행렬식) 개요</a></li>
<li>2026-04-10, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-05-2-gilbert-strang-properties-of-determinants.html">Ch.5 §5.1 — The Properties of Determinants (행렬식의 성질)</a></li>
<li>2026-04-10, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-05-3-gilbert-strang-permutations-and-cofactors.html">Ch.5 §5.2 — Permutations and Cofactors (순열과 여인수)</a></li>
<li>2026-04-10, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-05-4-gilbert-strang-cramer-inverse-volume.html">Ch.5 §5.3 — Cramer’s Rule, Inverses, and Volumes (크래머 공식·역행렬·부피)</a></li>
</ul>
</section>
<section id="ch.6-eigenvalues-and-eigenvectors" class="level4" data-number="1.2.1.6">

<ul>
<li>2026-04-10, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-06-1-gilbert-strang-eigenvalue-overview.html">Ch.6 Overview — 고유값과 고유벡터: 정의·기하 직관·특성 방정식·ML 응용</a></li>
<li>2026-04-10, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-06-2-gilbert-strang-diagonalization.html">Ch.6 §6.2 — 행렬의 대각화: A=SΛS⁻¹ 유도·기저 변환·스펙트럼 분해</a></li>
<li>2026-04-10, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-06-3-gilbert-strang-differential-equations.html">Ch.6 §6.3 — 미분방정식에의 응용: du/dt=Au 해법·안정성·행렬 지수</a></li>
<li>2026-04-10, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-06-4-gilbert-strang-symmetric-matrices.html">Ch.6 §6.4 — 대칭 행렬: 실수 고유값·직교 고유벡터·스펙트럼 정리 A=QΛQᵀ</a></li>
<li>2026-04-10, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-06-5-gilbert-strang-positive-definite-matrices.html">Ch.6 §6.5 — 양정치 행렬: 5가지 동치 조건·에너지·이차형식 기하·촐레스키·ML 응용</a></li>
<li>2026-04-10, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-06-6-gilbert-strang-similar-matrices.html">Ch.6 §6.6 — 닮음 행렬: 기저 변환·닮음 불변량·조르당 표준형·행렬 거듭제곱과 미분방정식 응용</a></li>
<li>2026-04-11, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-06-7-gilbert-strang-svd.html">Ch.6 §6.7 — 특이값 분해 (SVD): A=UΣVᵀ 구조·4개 부분공간·저차원 근사·PCA·이미지 압축</a></li>
</ul>
</section>
<section id="ch.7-linear-transformations" class="level4" data-number="1.2.1.7">

<ul>
<li>2026-04-11, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-07-1-gilbert-strang-linear-transformations-overview.html">Ch.7 Overview — 선형 변환: 정의·기하 직관·행렬 표현·기저 변환·ML 응용</a></li>
<li>2026-04-11, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-07-2-gilbert-strang-matrix-of-linear-transformation.html">Ch.7 §7.2 — 선형 변환의 행렬: 구성 레시피·미분/적분 연산자·합성 = 행렬 곱의 이유</a></li>
<li>2026-04-11, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-07-3-gilbert-strang-diagonalization-pseudoinverse.html">Ch.7 §7.3 — 대각화와 의사역행렬: <img src="https://latex.codecogs.com/png.latex?S%5E%7B-1%7DAS=%5CLambda">, SVD, 극분해, <img src="https://latex.codecogs.com/png.latex?A%5E+"> 와 최단 최소제곱해</a></li>
</ul>
</section>
<section id="ch.9-numerical-linear-algebra" class="level4" data-number="1.2.1.8">

<ul>
<li>2026-04-13, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-09-1-gilbert-strang-numerical-linear-algebra-overview.html">Ch.9 Overview — 수치 선형대수 개요: 부동소수점·조건수·직접법·반복법</a></li>
<li>2026-04-13, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-09-2-gilbert-strang-gaussian-elimination-in-practice.html">Ch.9 §9.1 — 실전 가우스 소거법: 부분 피벗팅·PA=LU·연산량·성장 인자·희소 전략</a></li>
<li>2026-04-13, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-09-3-gilbert-strang-norms-condition-numbers.html">Ch.9 §9.2 — 노름과 조건수: 연산자 노름·Rayleigh 몫·조건수·log κ 자리수 손실</a></li>
<li>2026-04-13, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-09-4-gilbert-strang-iterative-methods-preconditioners.html">Ch.9 §9.3 — 반복법과 전처리기: 분할·스펙트럼 반경·Jacobi·GS·SOR·ILU·CG·Multigrid</a></li>
<li>2026-04-13, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-10-1-gilbert-strang-complex-vectors-matrices-overview.html">Ch.10 Overview — 복소 벡터와 행렬 개요: Hermitian·Unitary·Fourier 행렬의 지도</a></li>
<li>2026-04-13, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-10-2-gilbert-strang-complex-numbers.html">Ch.10 §10.1 — 복소수: <img src="https://latex.codecogs.com/png.latex?i%5E2=-1"> 부터 Euler 공식·극형식·1의 n제곱근까지</a></li>
<li>2026-04-13, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-10-3-gilbert-strang-hermitian-unitary.html">Ch.10 §10.2 — Hermitian과 Unitary 행렬: 실대칭·직교의 복소 일반화와 스펙트럼 정리</a></li>
<li>2026-04-13, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-10-4-gilbert-strang-fft.html">Ch.10 §10.3 — 고속 푸리에 변환: <img src="https://latex.codecogs.com/png.latex?F_n"> 재귀 분해·butterfly·bit-reversal·<img src="https://latex.codecogs.com/png.latex?O(n%5Clog%20n)"></a></li>
</ul>
</section>
</section>
<section id="응용확장-토픽" class="level3" data-number="1.2.2">

<ul>
<li>2023-04-02, <a href="../../../../docs/blog/posts/Math/linear_algebra/matrix-calculus-derivatives.html">Matrix Calculus — 행렬·벡터 미분 공식</a></li>
<li>2026-04-11, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-06-7-gilbert-strang-svd.html">Singular Value Decomposition (SVD)</a></li>
<li>2026-04-11, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-07-1-gilbert-strang-linear-transformations-overview.html">Linear Transformations (심화) — 개요 포스트 참조</a></li>
<li>2026-04-12, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-08-1-gilbert-strang-applications-overview.html">Ch.8 Applications — 선형대수의 7가지 응용 종합 개요</a></li>
<li>2026-04-12, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-08-2-gilbert-strang-applications-engineering.html">Ch.8 §8.1 Matrices in Engineering — 강성행렬 <img src="https://latex.codecogs.com/png.latex?K%20=%20A%5E%5Ctop%20C%20A"> 와 차분-물성-균형</a></li>
<li>2026-04-12, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-08-3-gilbert-strang-applications-graphs-networks.html">Ch.8 §8.2 Graphs and Networks — 접속행렬·키르히호프 법칙·그래프 라플라시안</a></li>
<li>2026-04-12, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-08-4-gilbert-strang-applications-markov-population-economics.html">Ch.8 §8.3 Markov Matrices, Population, and Economics — Perron-Frobenius·Leslie·Leontief</a></li>
<li>2026-04-12, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-08-5-gilbert-strang-linear-programming.html">Ch.8 §8.4 Linear Programming — 부등식·최소화가 선형대수를 만났을 때</a></li>
<li>2026-04-12, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-08-6-gilbert-strang-fourier-series.html">Ch.8 §8.5 Fourier Series — 함수 공간에서의 선형대수</a></li>
<li>2026-04-12, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-08-7-gilbert-strang-statistics-probability.html">Ch.8 §8.6 Linear Algebra for Statistics and Probability — 가중 최소제곱·공분산·PCA</a></li>
<li>2026-04-12, <a href="../../../../docs/blog/posts/Math/linear_algebra/mit-08-8-gilbert-strang-computer-graphics.html">Ch.8 §8.7 Computer Graphics — 동차 좌표와 4×4 행렬의 세계</a></li>
</ul>
</section>
</section>
<section id="graph-theory" class="level2" data-number="1.3">

<ul>
<li>2026-03-24, <a href="../../../../docs/blog/posts/Math/graph_theory/01.graph_theory_basics.html">그래프 이론 기초</a></li>
<li>1111-11-11, 그래프 알고리즘 심화 (SCC, 위상 정렬, 최소 신장 트리)</li>
<li>1111-11-11, 그래프 임베딩 (Node2Vec, GNN)</li>
</ul>
</section>
<section id="optimization" class="level2" data-number="1.4">

<ul>
<li>2023-03-23, <a href="./optimization/minimizer.qmd">Minimizer &amp; Minimum</a></li>
<li>1111-11-11, Convex Set</li>
<li>1111-11-11, Convex Function</li>
<li>1111-11-11, Unconstrained Optimization</li>
<li>1111-11-11, Non-linear Least Square</li>
<li>1111-11-11, Largrange Multiplier Method
<ul>
<li>1111-11-11, Largrange Primal Function</li>
<li>1111-11-11, Largrange Dual Function</li>
<li>1111-11-11, KKT conditions</li>
</ul></li>
<li>1111-11-11, Gradient Descent Optimizers</li>
<li>1111-11-11,</li>
<li>1111-11-11,</li>
<li>1111-11-11,</li>
<li>1111-11-11,</li>
<li>1111-11-11,</li>
<li>1111-11-11,</li>
</ul>


</section>
</section>

 ]]></description>
  <category>Mathematics</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Math/</guid>
  <pubDate>Sun, 28 Feb 2100 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Azure AI Search Multimodal Search</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Engineering/Infra/Cloud/Azure/31-az-ai-search-classic-multimodal-search.html</link>
  <description><![CDATA[ 





<section id="개요" class="level1" data-number="1">
<h1 data-number="1"><span class="header-section-number">1</span> 개요</h1>
<p><strong>Multimodal Search</strong>는 텍스트, 이미지, 비디오, 오디오 등 여러 콘텐츠 형식에서 정보를 수집, 이해, 검색하는 기능이다. Azure AI Search는 텍스트와 이미지가 포함된 문서를 처리하여 두 형식을 결합한 검색을 지원한다.</p>
<section id="왜-multimodal-search인가" class="level2" data-number="1.1">
<h2 data-number="1.1" class="anchored" data-anchor-id="왜-multimodal-search인가"><span class="header-section-number">1.1</span> 왜 Multimodal Search인가?</h2>
<p>전통적으로 멀티모달 검색은 텍스트와 이미지 처리를 위한 <strong>별도의 시스템</strong>이 필요하며, 사용자 지정 코드와 복잡한 구성이 요구된다. 이는 높은 비용, 복잡성, 유지보수 부담을 야기한다.</p>
<p><strong>Azure AI Search의 해결책</strong>: 이미지를 텍스트와 동일한 검색 파이프라인에 통합하여 단일 멀티모달 파이프라인으로 처리한다.</p>
<section id="주요-장점" class="level3" data-number="1.1.1">
<h3 data-number="1.1.1" class="anchored" data-anchor-id="주요-장점"><span class="header-section-number">1.1.1</span> 주요 장점</h3>
<ul>
<li><strong>통합 파이프라인</strong>: 차트, 스크린샷, 인포그래픽, 스캔 양식 등의 시각적 데이터를 텍스트와 함께 처리</li>
<li><strong>RAG 시나리오 최적화</strong>: 이미지의 구조적 논리를 해석하여 RAG 애플리케이션과 AI 에이전트가 중요한 시각적 세부 정보를 활용 가능</li>
<li><strong>정확한 인용</strong>: 원본 형식(텍스트/이미지)에 관계없이 원래 소스로 추적 가능한 답변 제공</li>
</ul>
<p><strong>실제 사례</strong>: “HR 양식 승인 프로세스는 무엇인가요?”라는 질문에 대해, 프로세스 설명이 PDF의 다이어그램에만 있어도 답변 가능</p>
</section>
</section>
</section>
<section id="multimodal-search-작동-원리" class="level1" data-number="2">
<h1 data-number="2"><span class="header-section-number">2</span> Multimodal Search 작동 원리</h1>
<section id="단계-파이프라인" class="level2" data-number="2.1">
<h2 data-number="2.1" class="anchored" data-anchor-id="단계-파이프라인"><span class="header-section-number">2.1</span> 5단계 파이프라인</h2>
<p>Azure AI Search는 <strong>Azure Portal의 “데이터 가져오기” 마법사</strong>를 통해 멀티모달 파이프라인 구축을 간소화한다.</p>
<section id="단계별-처리-흐름" class="level3" data-number="2.1.1">
<h3 data-number="2.1.1" class="anchored" data-anchor-id="단계별-처리-흐름"><span class="header-section-number">2.1.1</span> 단계별 처리 흐름</h3>
<p>```mermaid graph TD A[1. 콘텐츠 추출] –&gt; B[2. 텍스트 청킹] A –&gt; C[3. 이미지 설명 생성] B –&gt; D[4. 임베딩 생성] C –&gt; D A –&gt; E[5. 이미지 저장] D –&gt; F[검색 인덱스] E –&gt; G[지식 저장소] ```</p>
</section>
<section id="각-단계-상세" class="level3" data-number="2.1.2">
<h3 data-number="2.1.2" class="anchored" data-anchor-id="각-단계-상세"><span class="header-section-number">2.1.2</span> 각 단계 상세</h3>
<section id="콘텐츠-추출" class="level4" data-number="2.1.2.1">
<h4 data-number="2.1.2.1" class="anchored" data-anchor-id="콘텐츠-추출"><span class="header-section-number">2.1.2.1</span> 콘텐츠 추출</h4>
<p>3가지 기본 제공 기술 중 선택: - <strong>Document Extraction Skill</strong>: 기본 추출 - <strong>Document Layout Skill</strong>: 위치 메타데이터 포함 (페이지 번호, 경계 영역) - <strong>Azure Content Understanding Skill</strong>: 의미 기반 청킹, 페이지 간 테이블 처리</p>
</section>
<section id="텍스트-청킹" class="level4" data-number="2.1.2.2">
<h4 data-number="2.1.2.2" class="anchored" data-anchor-id="텍스트-청킹"><span class="header-section-number">2.1.2.2</span> 텍스트 청킹</h4>
<p><strong>Text Split Skill</strong>이 추출된 텍스트를 관리 가능한 청크로 분할하여 임베딩 기술이 처리할 수 있게 준비한다.</p>
</section>
<section id="이미지-설명-생성-선택" class="level4" data-number="2.1.2.3">
<h4 data-number="2.1.2.3" class="anchored" data-anchor-id="이미지-설명-생성-선택"><span class="header-section-number">2.1.2.3</span> 이미지 설명 생성 (선택)</h4>
<p><strong>GenAI Prompt Skill</strong>이 LLM을 호출하여 각 이미지에 대한 간결한 자연어 설명을 생성한다. - 예: “관리자 승인으로 시작하는 5단계 HR 액세스 워크플로”</p>
</section>
<section id="임베딩-생성" class="level4" data-number="2.1.2.4">
<h4 data-number="2.1.2.4" class="anchored" data-anchor-id="임베딩-생성"><span class="header-section-number">2.1.2.4</span> 임베딩 생성</h4>
<p>텍스트와 이미지의 벡터 표현을 생성하여 유사성 검색 및 하이브리드 검색 지원: - <strong>Azure OpenAI Embedding Skill</strong> - <strong>Microsoft Foundry Embedding Model</strong> - <strong>Azure Vision Multimodal Embedding Skill</strong></p>
</section>
<section id="이미지-저장" class="level4" data-number="2.1.2.5">
<h4 data-number="2.1.2.5" class="anchored" data-anchor-id="이미지-저장"><span class="header-section-number">2.1.2.5</span> 이미지 저장</h4>
<p><strong>지식 저장소(Knowledge Store)</strong>에 추출된 이미지를 저장하여 클라이언트 애플리케이션이 직접 반환할 수 있게 한다. 이미지 위치는 인덱스에 저장되어 쿼리 시 편리하게 검색 가능하다.</p>
</section>
</section>
</section>
<section id="azure-portal-마법사" class="level2" data-number="2.2">
<h2 data-number="2.2" class="anchored" data-anchor-id="azure-portal-마법사"><span class="header-section-number">2.2</span> Azure Portal 마법사</h2>
<p><strong>빠른 시작</strong>: <a href="https://learn.microsoft.com/ko-kr/azure/search/search-get-started-portal-image-search">Azure Portal에서 멀티모달 검색</a></p>
<p>마법사를 통해 다음을 구성: - 데이터 원본 - 추출 및 보강 설정 - 텍스트, 이미지 참조, 벡터 임베딩이 포함된 멀티모달 인덱스</p>
</section>
</section>
<section id="콘텐츠-추출-옵션-비교" class="level1" data-number="3">
<h1 data-number="3"><span class="header-section-number">3</span> 콘텐츠 추출 옵션 비교</h1>
<p>Azure AI Search는 3가지 기본 제공 추출 기술을 제공한다.</p>
<section id="기술별-기능-비교" class="level2" data-number="3.1">
<h2 data-number="3.1" class="anchored" data-anchor-id="기술별-기능-비교"><span class="header-section-number">3.1</span> 기술별 기능 비교</h2>
<table class="table">
<colgroup>
<col style="width: 8%">
<col style="width: 27%">
<col style="width: 23%">
<col style="width: 39%">
</colgroup>
<thead>
<tr class="header">
<th>기능</th>
<th>Document Extraction</th>
<th>Document Layout</th>
<th>Azure Content Understanding</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><strong>텍스트 위치 메타데이터</strong></td>
<td>❌</td>
<td>✅ (페이지, 경계 다각형)</td>
<td>✅ (페이지, 경계 다각형)</td>
</tr>
<tr class="even">
<td><strong>이미지 위치 메타데이터</strong></td>
<td>✅</td>
<td>✅</td>
<td>✅</td>
</tr>
<tr class="odd">
<td><strong>테이블 추출</strong></td>
<td>❌</td>
<td>❌</td>
<td>✅ (페이지 간 포함)</td>
</tr>
<tr class="even">
<td><strong>교차 페이지 의미 단위</strong></td>
<td>N/A</td>
<td>❌ (단일 페이지만)</td>
<td>✅</td>
</tr>
<tr class="odd">
<td><strong>기본 제공 청킹</strong></td>
<td>❌ (Text Split 사용)</td>
<td>✅ (단락 경계)</td>
<td>✅ (의미 기반)</td>
</tr>
<tr class="even">
<td><strong>지원 파일 형식</strong></td>
<td>PDF만</td>
<td>다중 형식 (DI Layout)</td>
<td>PDF, DOCX, XLSX, PPTX</td>
</tr>
<tr class="odd">
<td><strong>과금 기준</strong></td>
<td>Azure AI Search 가격</td>
<td>Document Layout 가격</td>
<td>Content Understanding 가격</td>
</tr>
</tbody>
</table>
</section>
<section id="권장-시나리오" class="level2" data-number="3.2">
<h2 data-number="3.2" class="anchored" data-anchor-id="권장-시나리오"><span class="header-section-number">3.2</span> 권장 시나리오</h2>
<section id="document-extraction" class="level3" data-number="3.2.1">
<h3 data-number="3.2.1" class="anchored" data-anchor-id="document-extraction"><span class="header-section-number">3.2.1</span> Document Extraction</h3>
<ul>
<li><strong>사용 사례</strong>: 빠른 프로토타이핑, 위치 정보가 불필요한 프로덕션 파이프라인</li>
<li><strong>장점</strong>: 구성 간단, 비용 효율적</li>
<li><strong>제약</strong>: 위치 메타데이터 없음, PDF만 지원</li>
</ul>
</section>
<section id="document-layout" class="level3" data-number="3.2.2">
<h3 data-number="3.2.2" class="anchored" data-anchor-id="document-layout"><span class="header-section-number">3.2.2</span> Document Layout</h3>
<ul>
<li><strong>사용 사례</strong>: 정확한 페이지 번호, 페이지 강조 표시, 다이어그램 오버레이가 필요한 RAG 파이프라인</li>
<li><strong>장점</strong>: 위치 메타데이터 포함, 다중 파일 형식</li>
<li><strong>제약</strong>: 단일 페이지 단위 처리</li>
</ul>
</section>
<section id="azure-content-understanding" class="level3" data-number="3.2.3">
<h3 data-number="3.2.3" class="anchored" data-anchor-id="azure-content-understanding"><span class="header-section-number">3.2.3</span> Azure Content Understanding</h3>
<ul>
<li><strong>사용 사례</strong>: 페이지 간 테이블, 의미 기반 청킹, 일관된 다중 형식 처리</li>
<li><strong>장점</strong>: 가장 포괄적, 의미 기반 청킹, 교차 페이지 처리</li>
<li><strong>제약</strong>: 높은 비용</li>
</ul>
</section>
</section>
</section>
<section id="임베딩-옵션" class="level1" data-number="4">
<h1 data-number="4"><span class="header-section-number">4</span> 임베딩 옵션</h1>
<p>Azure AI Search는 이미지 처리를 위한 2가지 보완적 접근법을 제공한다.</p>
<section id="이미지-언어화-텍스트-임베딩" class="level2" data-number="4.1">
<h2 data-number="4.1" class="anchored" data-anchor-id="이미지-언어화-텍스트-임베딩"><span class="header-section-number">4.1</span> 이미지 언어화 + 텍스트 임베딩</h2>
<section id="처리-흐름" class="level3" data-number="4.1.1">
<h3 data-number="4.1.1" class="anchored" data-anchor-id="처리-흐름"><span class="header-section-number">4.1.1</span> 처리 흐름</h3>
<p>``` 이미지 → GenAI Prompt Skill → 자연어 설명 → 텍스트 임베딩 ```</p>
</section>
<section id="특징" class="level3" data-number="4.1.2">
<h3 data-number="4.1.2" class="anchored" data-anchor-id="특징"><span class="header-section-number">4.1.2</span> 특징</h3>
<ul>
<li><strong>LLM 기반</strong>: 각 이미지에 대해 LLM 호출 (인덱싱 시)</li>
<li><strong>의미 풍부</strong>: 다이어그램의 관계와 엔터티 해석</li>
<li><strong>인용 가능</strong>: LLM이 응답에서 그대로 인용 가능한 캡션 제공</li>
<li><strong>RAG 최적화</strong>: 접지된 데이터로 관련 스니펫 반환</li>
</ul>
</section>
<section id="장점" class="level3" data-number="4.1.3">
<h3 data-number="4.1.3" class="anchored" data-anchor-id="장점"><span class="header-section-number">4.1.3</span> 장점</h3>
<ul>
<li>다이어그램, 흐름도 등 설명적 시각 자료에 최적</li>
<li>AI 에이전트와 RAG 애플리케이션에 풍부한 컨텍스트 제공</li>
</ul>
</section>
<section id="단점" class="level3" data-number="4.1.4">
<h3 data-number="4.1.4" class="anchored" data-anchor-id="단점"><span class="header-section-number">4.1.4</span> 단점</h3>
<ul>
<li>모든 이미지마다 LLM 호출 필요</li>
<li>인덱싱 시간 증가</li>
<li>비용 상승</li>
</ul>
</section>
</section>
<section id="직접-멀티모달-임베딩" class="level2" data-number="4.2">
<h2 data-number="4.2" class="anchored" data-anchor-id="직접-멀티모달-임베딩"><span class="header-section-number">4.2</span> 직접 멀티모달 임베딩</h2>
<section id="처리-흐름-1" class="level3" data-number="4.2.1">
<h3 data-number="4.2.1" class="anchored" data-anchor-id="처리-흐름-1"><span class="header-section-number">4.2.1</span> 처리 흐름</h3>
<p>``` 이미지/텍스트 → Multimodal Embedding Model → 공유 벡터 공간 ```</p>
</section>
<section id="특징-1" class="level3" data-number="4.2.2">
<h3 data-number="4.2.2" class="anchored" data-anchor-id="특징-1"><span class="header-section-number">4.2.2</span> 특징</h3>
<ul>
<li><strong>직접 벡터화</strong>: 이미지와 텍스트를 동일한 벡터 공간에 직접 매핑</li>
<li><strong>LLM 불필요</strong>: 인덱싱 시 LLM 호출 없음</li>
<li><strong>시각적 유사성</strong>: “이것과 비슷한 것 찾기” 시나리오에 적합</li>
</ul>
</section>
<section id="장점-1" class="level3" data-number="4.2.3">
<h3 data-number="4.2.3" class="anchored" data-anchor-id="장점-1"><span class="header-section-number">4.2.3</span> 장점</h3>
<ul>
<li>구성 간단</li>
<li>빠른 인덱싱</li>
<li>비용 효율적</li>
<li>시각적 유사성 검색에 최적</li>
</ul>
</section>
<section id="단점-1" class="level3" data-number="4.2.4">
<h3 data-number="4.2.4" class="anchored" data-anchor-id="단점-1"><span class="header-section-number">4.2.4</span> 단점</h3>
<ul>
<li>순수 수학적 표현 (의미 설명 없음)</li>
<li>인용이나 상세 설명용 컨텍스트 부족</li>
</ul>
</section>
</section>
<section id="두-방법의-결합" class="level2" data-number="4.3">
<h2 data-number="4.3" class="anchored" data-anchor-id="두-방법의-결합"><span class="header-section-number">4.3</span> 두 방법의 결합</h2>
<p>많은 솔루션은 <strong>두 인코딩 경로를 병행</strong>한다:</p>
<table class="table">
<thead>
<tr class="header">
<th>콘텐츠 유형</th>
<th>추천 방식</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>다이어그램, 흐름도, 설명적 시각 자료</td>
<td>이미지 언어화 + 텍스트 임베딩</td>
</tr>
<tr class="even">
<td>스크린샷, 제품 사진, 아트워크</td>
<td>직접 멀티모달 임베딩</td>
</tr>
</tbody>
</table>
<p>Azure AI Search 인덱스와 스킬셋 파이프라인을 커스터마이징하여 <strong>두 벡터 집합을 저장</strong>하고 나란히 검색 가능하다.</p>
</section>
</section>
<section id="쿼리-옵션" class="level1" data-number="5">
<h1 data-number="5"><span class="header-section-number">5</span> 쿼리 옵션</h1>
<section id="텍스트-쿼리-genai-prompt-기반" class="level2" data-number="5.1">
<h2 data-number="5.1" class="anchored" data-anchor-id="텍스트-쿼리-genai-prompt-기반"><span class="header-section-number">5.1</span> 텍스트 쿼리 (GenAI Prompt 기반)</h2>
<p>GenAI Prompt Skill로 구동되는 파이프라인에서는 <strong>하이브리드 쿼리</strong> 실행 가능: - 일반 텍스트와 언어화된 이미지 모두 검색 - 필터로 특정 콘텐츠 유형(텍스트만/이미지만) 범위 지정 - 전체 텍스트 검색 + 벡터 검색 + 의미 순위 결합</p>
<section id="제약사항" class="level3" data-number="5.1.1">
<h3 data-number="5.1.1" class="anchored" data-anchor-id="제약사항"><span class="header-section-number">5.1.1</span> 제약사항</h3>
<p><strong>이미지-벡터 쿼리 미지원</strong>: GenAI Prompt는 텍스트-벡터 쿼리만 지원</p>
</section>
</section>
<section id="이미지-쿼리-멀티모달-임베딩" class="level2" data-number="5.2">
<h2 data-number="5.2" class="anchored" data-anchor-id="이미지-쿼리-멀티모달-임베딩"><span class="header-section-number">5.2</span> 이미지 쿼리 (멀티모달 임베딩)</h2>
<p>이미지를 쿼리 입력으로 사용하려면 멀티모달 임베딩 모델 필수: - <strong>AML Skill</strong> 또는 - <strong>Azure Vision Multimodal Embedding Skill</strong></p>
<p>이들 기술만 쿼리 시 이미지를 벡터로 변환하는 <strong>벡터라이저</strong>를 제공한다.</p>
<section id="구성" class="level3" data-number="5.2.1">
<h3 data-number="5.2.1" class="anchored" data-anchor-id="구성"><span class="header-section-number">5.2.1</span> 구성</h3>
<p><a href="https://learn.microsoft.com/ko-kr/azure/search/vector-search-how-to-configure-vectorizer">검색 인덱스에서 벡터라이저 구성</a> 참조</p>
</section>
</section>
</section>
<section id="실습-리소스" class="level1" data-number="6">
<h1 data-number="6"><span class="header-section-number">6</span> 실습 리소스</h1>
<section id="빠른-시작" class="level2" data-number="6.1">
<h2 data-number="6.1" class="anchored" data-anchor-id="빠른-시작"><span class="header-section-number">6.1</span> 빠른 시작</h2>
<ul>
<li><strong>Azure Portal 마법사</strong>: <a href="https://learn.microsoft.com/ko-kr/azure/search/search-get-started-portal-image-search">빠른 시작: Azure Portal에서 멀티모달 검색</a>
<ul>
<li>마법사와 검색 탐색기로 멀티모달 인덱스 생성 및 테스트</li>
</ul></li>
</ul>
</section>
<section id="튜토리얼" class="level2" data-number="6.2">
<h2 data-number="6.2" class="anchored" data-anchor-id="튜토리얼"><span class="header-section-number">6.2</span> 튜토리얼</h2>
<section id="이미지-언어화-기반" class="level3" data-number="6.2.1">
<h3 data-number="6.2.1" class="anchored" data-anchor-id="이미지-언어화-기반"><span class="header-section-number">6.2.1</span> 이미지 언어화 기반</h3>
<ol type="1">
<li><strong><a href="https://learn.microsoft.com/ko-kr/azure/search/tutorial-document-extraction-image-verbalization">생성 AI로 이미지 설명하기</a></strong> (Document Extraction)
<ul>
<li>Document Extraction Skill로 텍스트/이미지 추출</li>
<li>다이어그램 언어화</li>
<li>설명과 텍스트를 검색 인덱스에 임베딩</li>
</ul></li>
<li><strong><a href="https://learn.microsoft.com/ko-kr/azure/search/tutorial-document-layout-image-verbalization">구조화된 문서 레이아웃에서 이미지 언어화</a></strong> (Document Layout)
<ul>
<li>레이아웃 기반 블록 및 다이어그램 언어화</li>
<li>위치 메타데이터 캡처</li>
<li>정확한 인용 및 페이지 강조 표시</li>
</ul></li>
</ol>
</section>
<section id="직접-멀티모달-임베딩-1" class="level3" data-number="6.2.2">
<h3 data-number="6.2.2" class="anchored" data-anchor-id="직접-멀티모달-임베딩-1"><span class="header-section-number">6.2.2</span> 직접 멀티모달 임베딩</h3>
<ol start="3" type="1">
<li><strong><a href="https://learn.microsoft.com/ko-kr/azure/search/tutorial-document-extraction-multimodal-embeddings">이미지 및 텍스트 벡터화</a></strong> (Document Extraction)
<ul>
<li>Vision 멀티모달 모델로 텍스트/이미지 직접 임베딩</li>
<li>스캔 PDF의 시각적 유사성 검색</li>
</ul></li>
<li><strong><a href="https://learn.microsoft.com/ko-kr/azure/search/tutorial-document-layout-multimodal-embeddings">구조화된 문서 레이아웃에서 벡터화</a></strong> (Document Layout)
<ul>
<li>레이아웃 기반 청킹 + 통합 임베딩</li>
<li>하이브리드 의미/키워드 검색</li>
<li>정확한 적중 위치 반환</li>
</ul></li>
</ol>
</section>
</section>
</section>
<section id="튜토리얼-상세-document-extraction-multimodal-embeddings" class="level1" data-number="7">
<h1 data-number="7"><span class="header-section-number">7</span> 튜토리얼 상세: Document Extraction + Multimodal Embeddings</h1>
<p>이 섹션은 <strong>Azure Vision 4.0 Multimodal Embedding</strong>을 사용한 구현 방법을 단계별로 설명한다.</p>
<section id="필수-구성-요소" class="level2" data-number="7.1">
<h2 data-number="7.1" class="anchored" data-anchor-id="필수-구성-요소"><span class="header-section-number">7.1</span> 필수 구성 요소</h2>
<section id="azure-리소스" class="level3" data-number="7.1.1">
<h3 data-number="7.1.1" class="anchored" data-anchor-id="azure-리소스"><span class="header-section-number">7.1.1</span> Azure 리소스</h3>
<ol type="1">
<li><strong>Azure AI Search</strong> (Basic 이상)
<ul>
<li>역할 기반 액세스 제어 및 관리 ID 구성</li>
<li>무료 계층 미지원</li>
</ul></li>
<li><strong>Microsoft Foundry 리소스</strong>
<ul>
<li>Azure Vision Multimodal 4.0 API 액세스</li>
<li>지역 제약: Multimodal 4.0 지원 지역 확인 필요</li>
</ul></li>
<li><strong>Azure Storage</strong>
<ul>
<li>샘플 데이터 저장</li>
<li>지식 저장소 (추출된 이미지)</li>
<li>검색 서비스에 Storage Blob Data Reader 역할 할당</li>
</ul></li>
</ol>
</section>
<section id="도구" class="level3" data-number="7.1.2">
<h3 data-number="7.1.2" class="anchored" data-anchor-id="도구"><span class="header-section-number">7.1.2</span> 도구</h3>
<ul>
<li>Visual Studio Code + REST 클라이언트</li>
</ul>
</section>
</section>
<section id="데이터-준비" class="level2" data-number="7.2">
<h2 data-number="7.2" class="anchored" data-anchor-id="데이터-준비"><span class="header-section-number">7.2</span> 데이터 준비</h2>
<section id="샘플-데이터" class="level3" data-number="7.2.1">
<h3 data-number="7.2.1" class="anchored" data-anchor-id="샘플-데이터"><span class="header-section-number">7.2.1</span> 샘플 데이터</h3>
<p>36페이지 PDF 문서: <a href="https://cdn-dynmedia-1.microsoft.com/is/content/microsoftcorp/microsoft/msc/documents/presentations/CSR/Accelerating-Sustainability-with-AI-2025.pdf">Accelerating Sustainability with AI</a> - 차트, 인포그래픽, 스캔 페이지 포함</p>
</section>
<section id="스토리지-구성" class="level3" data-number="7.2.2">
<h3 data-number="7.2.2" class="anchored" data-anchor-id="스토리지-구성"><span class="header-section-number">7.2.2</span> 스토리지 구성</h3>
<div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode numberSource bash number-lines code-with-copy"><code class="sourceCode bash"><span id="cb1-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 1. Blob Container 생성</span></span>
<span id="cb1-2"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">Container</span> Name: sustainable-ai-pdf</span>
<span id="cb1-3"></span>
<span id="cb1-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 2. PDF 업로드</span></span>
<span id="cb1-5"></span>
<span id="cb1-6"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 3. 역할 할당 (관리 ID 사용)</span></span>
<span id="cb1-7"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">-</span> Storage Blob Data Reader <span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">(</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">인덱서용</span><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">)</span></span>
<span id="cb1-8"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">-</span> Storage Blob Data Contributor <span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">(</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">지식</span> 저장소용<span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">)</span></span>
<span id="cb1-9"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">-</span> Storage Table Data Contributor <span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">(</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">지식</span> 저장소용<span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div>
</section>
<section id="연결-문자열-관리-id" class="level3" data-number="7.2.3">
<h3 data-number="7.2.3" class="anchored" data-anchor-id="연결-문자열-관리-id"><span class="header-section-number">7.2.3</span> 연결 문자열 (관리 ID)</h3>
<div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode numberSource json number-lines code-with-copy"><code class="sourceCode json"><span id="cb2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb2-2">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"credentials"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb2-3">    <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"connectionString"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"ResourceId=/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.Storage/storageAccounts/{storage-account}/;"</span></span>
<span id="cb2-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb2-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span></code></pre></div>
</section>
</section>
<section id="모델-준비" class="level2" data-number="7.3">
<h2 data-number="7.3" class="anchored" data-anchor-id="모델-준비"><span class="header-section-number">7.3</span> 모델 준비</h2>
<section id="foundry-역할-할당" class="level3" data-number="7.3.1">
<h3 data-number="7.3.1" class="anchored" data-anchor-id="foundry-역할-할당"><span class="header-section-number">7.3.1</span> Foundry 역할 할당</h3>
<div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode numberSource bash number-lines code-with-copy"><code class="sourceCode bash"><span id="cb3-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Azure Portal &gt; Foundry 리소스 &gt; 액세스 제어(IAM)</span></span>
<span id="cb3-2"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">역할:</span> Cognitive Services 사용자</span>
<span id="cb3-3"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">할당</span> 대상: 검색 서비스 관리 ID</span></code></pre></div>
<p><strong>중요</strong>: Foundry 리소스는 Multimodal 4.0 API 지원 지역에 있어야 함</p>
</section>
</section>
<section id="인덱스-스키마" class="level2" data-number="7.4">
<h2 data-number="7.4" class="anchored" data-anchor-id="인덱스-스키마"><span class="header-section-number">7.4</span> 인덱스 스키마</h2>
<section id="필드-정의" class="level3" data-number="7.4.1">
<h3 data-number="7.4.1" class="anchored" data-anchor-id="필드-정의"><span class="header-section-number">7.4.1</span> 필드 정의</h3>
<div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode numberSource json number-lines code-with-copy"><code class="sourceCode json"><span id="cb4-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb4-2">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"doc-extraction-multimodal-embedding-index"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-3">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"fields"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb4-4">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb4-5">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"content_id"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-6">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"type"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Edm.String"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-7">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"key"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">true</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-8">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"analyzer"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"keyword"</span></span>
<span id="cb4-9">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-10">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb4-11">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"text_document_id"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-12">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"type"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Edm.String"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-13">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"filterable"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">true</span></span>
<span id="cb4-14">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-15">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb4-16">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"image_document_id"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-17">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"type"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Edm.String"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-18">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"filterable"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">true</span></span>
<span id="cb4-19">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-20">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb4-21">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"document_title"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-22">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"type"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Edm.String"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-23">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"searchable"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">true</span></span>
<span id="cb4-24">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-25">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb4-26">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"content_text"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-27">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"type"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Edm.String"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-28">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"searchable"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">true</span></span>
<span id="cb4-29">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-30">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb4-31">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"content_embedding"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-32">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"type"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Collection(Edm.Single)"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-33">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"dimensions"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1024</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-34">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"vectorSearchProfile"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"hnsw"</span></span>
<span id="cb4-35">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-36">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb4-37">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"content_path"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-38">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"type"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Edm.String"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-39">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"retrievable"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">true</span></span>
<span id="cb4-40">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-41">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb4-42">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"location_metadata"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-43">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"type"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Edm.ComplexType"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-44">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"fields"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb4-45">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb4-46">          <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"page_number"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-47">          <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"type"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Edm.Int32"</span></span>
<span id="cb4-48">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-49">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb4-50">          <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bounding_polygons"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb4-51">          <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"type"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Edm.String"</span></span>
<span id="cb4-52">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb4-53">      <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span></span>
<span id="cb4-54">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb4-55">  <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span></span>
<span id="cb4-56"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span></code></pre></div>
</section>
<section id="벡터-검색-구성" class="level3" data-number="7.4.2">
<h3 data-number="7.4.2" class="anchored" data-anchor-id="벡터-검색-구성"><span class="header-section-number">7.4.2</span> 벡터 검색 구성</h3>
<div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode numberSource json number-lines code-with-copy"><code class="sourceCode json"><span id="cb5-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb5-2">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"vectorSearch"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb5-3">    <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"profiles"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb5-4">      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb5-5">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"hnsw"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb5-6">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"algorithm"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"defaulthnsw"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb5-7">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"vectorizer"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"demo-vectorizer"</span></span>
<span id="cb5-8">      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb5-9">    <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb5-10">    <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"algorithms"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb5-11">      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb5-12">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"defaulthnsw"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb5-13">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"kind"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"hnsw"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb5-14">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"hnswParameters"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb5-15">          <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"m"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb5-16">          <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"efConstruction"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">400</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb5-17">          <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"metric"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"cosine"</span></span>
<span id="cb5-18">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb5-19">      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb5-20">    <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb5-21">    <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"vectorizers"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb5-22">      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb5-23">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"demo-vectorizer"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb5-24">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"kind"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"aiServicesVision"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb5-25">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"aiServicesVisionParameters"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb5-26">          <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"resourceUri"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"{{cognitiveServicesUrl}}"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb5-27">          <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"authIdentity"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">null</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb5-28">          <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"modelVersion"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2023-04-15"</span></span>
<span id="cb5-29">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb5-30">      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb5-31">    <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span></span>
<span id="cb5-32">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb5-33"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span></code></pre></div>
<p><strong>핵심 포인트</strong>: - <code>dimensions: 1024</code> - Azure Vision Multimodal 4.0의 벡터 차원 - <code>vectorizer: aiServicesVision</code> - 쿼리 시 이미지 벡터화 지원</p>
</section>
</section>
<section id="스킬셋-구성" class="level2" data-number="7.5">
<h2 data-number="7.5" class="anchored" data-anchor-id="스킬셋-구성"><span class="header-section-number">7.5</span> 스킬셋 구성</h2>
<section id="전체-파이프라인" class="level3" data-number="7.5.1">
<h3 data-number="7.5.1" class="anchored" data-anchor-id="전체-파이프라인"><span class="header-section-number">7.5.1</span> 전체 파이프라인</h3>
<div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode numberSource mermaid number-lines code-with-copy"><code class="sourceCode"><span id="cb6-1">graph LR</span>
<span id="cb6-2">    A[Document Extraction] --&gt; B[Text Split]</span>
<span id="cb6-3">    A --&gt; C[Vision Vectorize Text]</span>
<span id="cb6-4">    A --&gt; D[Vision Vectorize Image]</span>
<span id="cb6-5">    B --&gt; C</span>
<span id="cb6-6">    C --&gt; E[Index Projection]</span>
<span id="cb6-7">    D --&gt; E</span>
<span id="cb6-8">    A --&gt; F[Shaper]</span>
<span id="cb6-9">    F --&gt; G[Knowledge Store]</span></code></pre></div>
</section>
<section id="주요-스킬" class="level3" data-number="7.5.2">
<h3 data-number="7.5.2" class="anchored" data-anchor-id="주요-스킬"><span class="header-section-number">7.5.2</span> 주요 스킬</h3>
<section id="document-extraction-skill" class="level4" data-number="7.5.2.1">
<h4 data-number="7.5.2.1" class="anchored" data-anchor-id="document-extraction-skill"><span class="header-section-number">7.5.2.1</span> 1. Document Extraction Skill</h4>
<div class="sourceCode" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode numberSource json number-lines code-with-copy"><code class="sourceCode json"><span id="cb7-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb7-2">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"@odata.type"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#Microsoft.Skills.Util.DocumentExtractionSkill"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb7-3">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"parsingMode"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"default"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb7-4">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"dataToExtract"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"contentAndMetadata"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb7-5">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"configuration"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb7-6">    <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"imageAction"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"generateNormalizedImages"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb7-7">    <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"normalizedImageMaxWidth"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2000</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb7-8">    <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"normalizedImageMaxHeight"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2000</span></span>
<span id="cb7-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">},</span></span>
<span id="cb7-10">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"context"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb7-11">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"inputs"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb7-12">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb7-13">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"file_data"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb7-14">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"source"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/file_data"</span></span>
<span id="cb7-15">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb7-16">  <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb7-17">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"outputs"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb7-18">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb7-19">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"content"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb7-20">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"targetName"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"extracted_content"</span></span>
<span id="cb7-21">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb7-22">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb7-23">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"normalized_images"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb7-24">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"targetName"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"normalized_images"</span></span>
<span id="cb7-25">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb7-26">  <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span></span>
<span id="cb7-27"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span></code></pre></div>
<p><strong>출력</strong>: - <code>extracted_content</code>: 문서의 모든 텍스트 - <code>normalized_images</code>: 정규화된 이미지 배열 (최대 2000x2000)</p>
</section>
<section id="text-split-skill" class="level4" data-number="7.5.2.2">
<h4 data-number="7.5.2.2" class="anchored" data-anchor-id="text-split-skill"><span class="header-section-number">7.5.2.2</span> 2. Text Split Skill</h4>
<div class="sourceCode" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode numberSource json number-lines code-with-copy"><code class="sourceCode json"><span id="cb8-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb8-2">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"@odata.type"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#Microsoft.Skills.Text.SplitSkill"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb8-3">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"context"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb8-4">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"defaultLanguageCode"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"en"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb8-5">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"textSplitMode"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"pages"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb8-6">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"maximumPageLength"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2000</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb8-7">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"pageOverlapLength"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb8-8">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"unit"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"characters"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb8-9">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"inputs"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb8-10">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb8-11">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"text"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb8-12">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"source"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/extracted_content"</span></span>
<span id="cb8-13">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb8-14">  <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb8-15">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"outputs"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb8-16">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb8-17">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"textItems"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb8-18">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"targetName"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"pages"</span></span>
<span id="cb8-19">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb8-20">  <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span></span>
<span id="cb8-21"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span></code></pre></div>
<p><strong>청킹 전략</strong>: - 2000자 청크 - 200자 오버랩 (문맥 유지)</p>
</section>
<section id="azure-vision-vectorize-skill-text" class="level4" data-number="7.5.2.3">
<h4 data-number="7.5.2.3" class="anchored" data-anchor-id="azure-vision-vectorize-skill-text"><span class="header-section-number">7.5.2.3</span> 3. Azure Vision Vectorize Skill (Text)</h4>
<div class="sourceCode" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode numberSource json number-lines code-with-copy"><code class="sourceCode json"><span id="cb9-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb9-2">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"@odata.type"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#Microsoft.Skills.Vision.VectorizeSkill"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb9-3">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"text-embedding-skill"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb9-4">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"context"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/pages/*"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb9-5">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"modelVersion"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2023-04-15"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb9-6">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"inputs"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb9-7">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb9-8">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"text"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb9-9">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"source"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/pages/*"</span></span>
<span id="cb9-10">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb9-11">  <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb9-12">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"outputs"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb9-13">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb9-14">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"vector"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb9-15">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"targetName"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"text_vector"</span></span>
<span id="cb9-16">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb9-17">  <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span></span>
<span id="cb9-18"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span></code></pre></div>
</section>
<section id="azure-vision-vectorize-skill-image" class="level4" data-number="7.5.2.4">
<h4 data-number="7.5.2.4" class="anchored" data-anchor-id="azure-vision-vectorize-skill-image"><span class="header-section-number">7.5.2.4</span> 4. Azure Vision Vectorize Skill (Image)</h4>
<div class="sourceCode" id="cb10" style="background: #f1f3f5;"><pre class="sourceCode numberSource json number-lines code-with-copy"><code class="sourceCode json"><span id="cb10-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb10-2">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"@odata.type"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#Microsoft.Skills.Vision.VectorizeSkill"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb10-3">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"image-embedding-skill"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb10-4">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"context"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/normalized_images/*"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb10-5">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"modelVersion"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2023-04-15"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb10-6">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"inputs"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb10-7">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb10-8">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"image"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb10-9">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"source"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/normalized_images/*"</span></span>
<span id="cb10-10">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb10-11">  <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb10-12">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"outputs"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb10-13">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb10-14">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"vector"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb10-15">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"targetName"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"image_vector"</span></span>
<span id="cb10-16">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb10-17">  <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span></span>
<span id="cb10-18"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span></code></pre></div>
<p><strong>Azure Vision Multimodal Embedding</strong>: - 동일한 스킬, 입력만 다름 (text vs image) - 1024차원 벡터 생성 - 공유 벡터 공간 (텍스트-이미지 간 코사인 유사도 계산 가능)</p>
</section>
<section id="shaper-skill" class="level4" data-number="7.5.2.5">
<h4 data-number="7.5.2.5" class="anchored" data-anchor-id="shaper-skill"><span class="header-section-number">7.5.2.5</span> 5. Shaper Skill</h4>
<div class="sourceCode" id="cb11" style="background: #f1f3f5;"><pre class="sourceCode numberSource json number-lines code-with-copy"><code class="sourceCode json"><span id="cb11-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb11-2">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"@odata.type"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#Microsoft.Skills.Util.ShaperSkill"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb11-3">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"context"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/normalized_images/*"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb11-4">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"inputs"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb11-5">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb11-6">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"imagePath"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb11-7">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"source"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"='{{imageProjectionContainer}}/'+$(/document/normalized_images/*/imagePath)"</span></span>
<span id="cb11-8">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb11-9">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb11-10">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"location_metadata"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb11-11">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"sourceContext"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/normalized_images/*"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb11-12">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"inputs"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb11-13">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb11-14">          <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"page_number"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb11-15">          <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"source"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/normalized_images/*/pageNumber"</span></span>
<span id="cb11-16">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb11-17">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb11-18">          <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"bounding_polygons"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb11-19">          <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"source"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/normalized_images/*/boundingPolygon"</span></span>
<span id="cb11-20">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb11-21">      <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span></span>
<span id="cb11-22">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb11-23">  <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb11-24">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"outputs"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb11-25">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb11-26">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"output"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb11-27">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"targetName"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"new_normalized_images"</span></span>
<span id="cb11-28">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb11-29">  <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span></span>
<span id="cb11-30"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span></code></pre></div>
</section>
</section>
<section id="index-projections" class="level3" data-number="7.5.3">
<h3 data-number="7.5.3" class="anchored" data-anchor-id="index-projections"><span class="header-section-number">7.5.3</span> Index Projections</h3>
<div class="sourceCode" id="cb12" style="background: #f1f3f5;"><pre class="sourceCode numberSource json number-lines code-with-copy"><code class="sourceCode json"><span id="cb12-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb12-2">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"indexProjections"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb12-3">    <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"selectors"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb12-4">      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb12-5">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"targetIndexName"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"doc-extraction-multimodal-embedding-index"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-6">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"parentKeyFieldName"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"text_document_id"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-7">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"sourceContext"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/pages/*"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-8">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"mappings"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb12-9">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb12-10">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"content_embedding"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-11">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"source"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/pages/*/text_vector"</span></span>
<span id="cb12-12">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-13">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb12-14">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"content_text"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-15">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"source"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/pages/*"</span></span>
<span id="cb12-16">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-17">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb12-18">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"document_title"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-19">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"source"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/document_title"</span></span>
<span id="cb12-20">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb12-21">        <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span></span>
<span id="cb12-22">      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-23">      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb12-24">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"targetIndexName"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"doc-extraction-multimodal-embedding-index"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-25">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"parentKeyFieldName"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"image_document_id"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-26">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"sourceContext"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/normalized_images/*"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-27">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"mappings"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb12-28">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb12-29">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"content_embedding"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-30">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"source"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/normalized_images/*/image_vector"</span></span>
<span id="cb12-31">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-32">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb12-33">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"content_path"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-34">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"source"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/normalized_images/*/new_normalized_images/imagePath"</span></span>
<span id="cb12-35">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-36">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb12-37">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"location_metadata"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-38">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"source"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/normalized_images/*/new_normalized_images/location_metadata"</span></span>
<span id="cb12-39">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-40">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb12-41">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"document_title"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-42">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"source"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/document_title"</span></span>
<span id="cb12-43">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb12-44">        <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span></span>
<span id="cb12-45">      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb12-46">    <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb12-47">    <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"parameters"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb12-48">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"projectionMode"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"skipIndexingParentDocuments"</span></span>
<span id="cb12-49">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb12-50">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb12-51"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span></code></pre></div>
<p><strong>동작 원리</strong>: - 텍스트 청크당 1개 문서 생성 (<code>text_document_id</code>) - 이미지당 1개 문서 생성 (<code>image_document_id</code>) - 부모 문서(원본 PDF)는 인덱싱 건너뛰기</p>
</section>
<section id="knowledge-store" class="level3" data-number="7.5.4">
<h3 data-number="7.5.4" class="anchored" data-anchor-id="knowledge-store"><span class="header-section-number">7.5.4</span> Knowledge Store</h3>
<div class="sourceCode" id="cb13" style="background: #f1f3f5;"><pre class="sourceCode numberSource json number-lines code-with-copy"><code class="sourceCode json"><span id="cb13-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb13-2">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"knowledgeStore"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb13-3">    <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"storageConnectionString"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"{{storageConnection}}"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb13-4">    <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"projections"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb13-5">      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb13-6">        <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"files"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">[</span></span>
<span id="cb13-7">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb13-8">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"storageContainer"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"{{imageProjectionContainer}}"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb13-9">            <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"source"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/document/normalized_images/*"</span></span>
<span id="cb13-10">          <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb13-11">        <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span></span>
<span id="cb13-12">      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb13-13">    <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">]</span></span>
<span id="cb13-14">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb13-15"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span></code></pre></div>
<p><strong>저장 내용</strong>: - 정규화된 이미지 파일 (JPEG) - 파일명: <code>{document-id}_{image-index}.jpg</code></p>
</section>
</section>
<section id="인덱서-실행" class="level2" data-number="7.6">
<h2 data-number="7.6" class="anchored" data-anchor-id="인덱서-실행"><span class="header-section-number">7.6</span> 인덱서 실행</h2>
<section id="구성-1" class="level3" data-number="7.6.1">
<h3 data-number="7.6.1" class="anchored" data-anchor-id="구성-1"><span class="header-section-number">7.6.1</span> 구성</h3>
<div class="sourceCode" id="cb14" style="background: #f1f3f5;"><pre class="sourceCode numberSource json number-lines code-with-copy"><code class="sourceCode json"><span id="cb14-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb14-2">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"name"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"doc-extraction-multimodal-embedding-indexer"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb14-3">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"dataSourceName"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"doc-extraction-multimodal-embedding-ds"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb14-4">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"targetIndexName"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"doc-extraction-multimodal-embedding-index"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb14-5">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"skillsetName"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"doc-extraction-multimodal-embedding-skillset"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb14-6">  <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"parameters"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb14-7">    <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"batchSize"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">,</span></span>
<span id="cb14-8">    <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"configuration"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">{</span></span>
<span id="cb14-9">      <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">"allowSkillsetToReadFileData"</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">:</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">true</span></span>
<span id="cb14-10">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb14-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span>
<span id="cb14-12"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">}</span></span></code></pre></div>
</section>
<section id="처리-시간-예상-36페이지-pdf" class="level3" data-number="7.6.2">
<h3 data-number="7.6.2" class="anchored" data-anchor-id="처리-시간-예상-36페이지-pdf"><span class="header-section-number">7.6.2</span> 처리 시간 예상 (36페이지 PDF)</h3>
<table class="table">
<thead>
<tr class="header">
<th>단계</th>
<th>시간</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>문서 추출</td>
<td>2-3초</td>
</tr>
<tr class="even">
<td>텍스트 분할</td>
<td>&lt;1초</td>
</tr>
<tr class="odd">
<td>텍스트 임베딩 (18 청크)</td>
<td>1-2초</td>
</tr>
<tr class="even">
<td>이미지 임베딩 (25 이미지)</td>
<td>4-8초</td>
</tr>
<tr class="odd">
<td>인덱싱</td>
<td>1-2초</td>
</tr>
<tr class="even">
<td><strong>총계</strong></td>
<td><strong>8-16초</strong></td>
</tr>
</tbody>
</table>
</section>
</section>
<section id="쿼리-예제" class="level2" data-number="7.7">
<h2 data-number="7.7" class="anchored" data-anchor-id="쿼리-예제"><span class="header-section-number">7.7</span> 쿼리 예제</h2>
<section id="텍스트-쿼리-하이브리드" class="level3" data-number="7.7.1">
<h3 data-number="7.7.1" class="anchored" data-anchor-id="텍스트-쿼리-하이브리드"><span class="header-section-number">7.7.1</span> 1. 텍스트 쿼리 (하이브리드)</h3>
<div class="sourceCode" id="cb15" style="background: #f1f3f5;"><pre class="sourceCode numberSource http number-lines code-with-copy"><code class="sourceCode"><span id="cb15-1">POST /indexes/doc-extraction-multimodal-embedding-index/docs/search?api-version=2025-11-01-preview</span>
<span id="cb15-2">Content-Type: application/json</span>
<span id="cb15-3"></span>
<span id="cb15-4">{</span>
<span id="cb15-5">  "search": "energy sustainability",</span>
<span id="cb15-6">  "vectorQueries": [</span>
<span id="cb15-7">    {</span>
<span id="cb15-8">      "kind": "text",</span>
<span id="cb15-9">      "text": "energy sustainability",</span>
<span id="cb15-10">      "k": 10,</span>
<span id="cb15-11">      "fields": "content_embedding"</span>
<span id="cb15-12">    }</span>
<span id="cb15-13">  ],</span>
<span id="cb15-14">  "select": "content_id, document_title, content_text, content_path"</span>
<span id="cb15-15">}</span></code></pre></div>
<p><strong>결과</strong>: 텍스트와 이미지 모두 반환 (공유 벡터 공간)</p>
</section>
<section id="이미지만-필터링" class="level3" data-number="7.7.2">
<h3 data-number="7.7.2" class="anchored" data-anchor-id="이미지만-필터링"><span class="header-section-number">7.7.2</span> 2. 이미지만 필터링</h3>
<div class="sourceCode" id="cb16" style="background: #f1f3f5;"><pre class="sourceCode numberSource http number-lines code-with-copy"><code class="sourceCode"><span id="cb16-1">POST /indexes/doc-extraction-multimodal-embedding-index/docs/search?api-version=2025-11-01-preview</span>
<span id="cb16-2">Content-Type: application/json</span>
<span id="cb16-3"></span>
<span id="cb16-4">{</span>
<span id="cb16-5">  "search": "*",</span>
<span id="cb16-6">  "filter": "image_document_id ne null",</span>
<span id="cb16-7">  "select": "content_id, document_title, content_path, location_metadata"</span>
<span id="cb16-8">}</span></code></pre></div>
</section>
<section id="이미지-쿼리-이미지로-검색" class="level3" data-number="7.7.3">
<h3 data-number="7.7.3" class="anchored" data-anchor-id="이미지-쿼리-이미지로-검색"><span class="header-section-number">7.7.3</span> 3. 이미지 쿼리 (이미지로 검색)</h3>
<div class="sourceCode" id="cb17" style="background: #f1f3f5;"><pre class="sourceCode numberSource http number-lines code-with-copy"><code class="sourceCode"><span id="cb17-1">POST /indexes/doc-extraction-multimodal-embedding-index/docs/search?api-version=2025-11-01-preview</span>
<span id="cb17-2">Content-Type: application/json</span>
<span id="cb17-3"></span>
<span id="cb17-4">{</span>
<span id="cb17-5">  "vectorQueries": [</span>
<span id="cb17-6">    {</span>
<span id="cb17-7">      "kind": "image",</span>
<span id="cb17-8">      "image": "{base64-encoded-image}",</span>
<span id="cb17-9">      "k": 5,</span>
<span id="cb17-10">      "fields": "content_embedding"</span>
<span id="cb17-11">    }</span>
<span id="cb17-12">  ]</span>
<span id="cb17-13">}</span></code></pre></div>
<p><strong>작동 원리</strong>: 1. 쿼리 이미지 → Azure Vision 벡터라이저 → 1024차원 벡터 2. 인덱스의 모든 벡터(텍스트+이미지)와 코사인 유사도 계산 3. 상위 k개 결과 반환</p>
</section>
</section>
<section id="주요-특징-정리" class="level2" data-number="7.8">
<h2 data-number="7.8" class="anchored" data-anchor-id="주요-특징-정리"><span class="header-section-number">7.8</span> 주요 특징 정리</h2>
<section id="content_text-필드" class="level3" data-number="7.8.1">
<h3 data-number="7.8.1" class="anchored" data-anchor-id="content_text-필드"><span class="header-section-number">7.8.1</span> Content_text 필드</h3>
<ul>
<li><strong>텍스트 문서</strong>: 추출된 텍스트 청크</li>
<li><strong>이미지 문서</strong>: null (이미지는 벡터로만 표현)</li>
</ul>
</section>
<section id="content_embedding-필드" class="level3" data-number="7.8.2">
<h3 data-number="7.8.2" class="anchored" data-anchor-id="content_embedding-필드"><span class="header-section-number">7.8.2</span> Content_embedding 필드</h3>
<ul>
<li><strong>차원</strong>: 1024</li>
<li><strong>텍스트와 이미지 공유</strong>: 동일한 벡터 공간</li>
<li><strong>유사도 계산</strong>: 텍스트-텍스트, 이미지-이미지, 텍스트-이미지 모두 가능</li>
</ul>
</section>
<section id="content_path-필드" class="level3" data-number="7.8.3">
<h3 data-number="7.8.3" class="anchored" data-anchor-id="content_path-필드"><span class="header-section-number">7.8.3</span> Content_path 필드</h3>
<ul>
<li><strong>텍스트 문서</strong>: null</li>
<li><strong>이미지 문서</strong>: Knowledge Store 이미지 경로</li>
<li><strong>형식</strong>: <code>{container}/{document-id}_{image-index}.jpg</code></li>
</ul>
</section>
<section id="location_metadata-필드" class="level3" data-number="7.8.4">
<h3 data-number="7.8.4" class="anchored" data-anchor-id="location_metadata-필드"><span class="header-section-number">7.8.4</span> Location_metadata 필드</h3>
<ul>
<li><strong>이미지만 해당</strong>: 페이지 번호, 경계 다각형</li>
<li><strong>활용</strong>: RAG 응답에서 이미지 위치 표시, 페이지 강조</li>
</ul>
</section>
</section>
<section id="제약사항-1" class="level2" data-number="7.9">
<h2 data-number="7.9" class="anchored" data-anchor-id="제약사항-1"><span class="header-section-number">7.9</span> 제약사항</h2>
<section id="document-extraction-제약" class="level3" data-number="7.9.1">
<h3 data-number="7.9.1" class="anchored" data-anchor-id="document-extraction-제약"><span class="header-section-number">7.9.1</span> Document Extraction 제약</h3>
<ul>
<li><strong>텍스트 위치 메타데이터 없음</strong>: 텍스트 청크의 페이지 번호 미제공</li>
<li><strong>PDF만 지원</strong>: DOCX, XLSX 등 미지원</li>
<li><strong>해결</strong>: Document Layout Skill 사용 권장</li>
</ul>
</section>
<section id="azure-vision-multimodal-제약" class="level3" data-number="7.9.2">
<h3 data-number="7.9.2" class="anchored" data-anchor-id="azure-vision-multimodal-제약"><span class="header-section-number">7.9.2</span> Azure Vision Multimodal 제약</h3>
<ul>
<li><strong>지역 제한</strong>: Multimodal 4.0 API 지원 지역만 가능</li>
<li><strong>지원 지역</strong>: <a href="https://learn.microsoft.com/ko-kr/azure/ai-services/computer-vision/overview-image-analysis#region-availability">Azure Vision 문서 확인</a></li>
</ul>
</section>
</section>
<section id="비용-분석-36페이지-pdf-예제" class="level2" data-number="7.10">
<h2 data-number="7.10" class="anchored" data-anchor-id="비용-분석-36페이지-pdf-예제"><span class="header-section-number">7.10</span> 비용 분석 (36페이지 PDF 예제)</h2>
<table class="table">
<thead>
<tr class="header">
<th>항목</th>
<th>단가</th>
<th>수량</th>
<th>비용</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>이미지 추출</td>
<td>$0.001/image</td>
<td>25</td>
<td>$0.025</td>
</tr>
<tr class="even">
<td>텍스트 임베딩</td>
<td>$0.0001/1K char</td>
<td>36K</td>
<td>$0.004</td>
</tr>
<tr class="odd">
<td>이미지 임베딩</td>
<td>$0.002/image</td>
<td>25</td>
<td>$0.050</td>
</tr>
<tr class="even">
<td>인덱싱</td>
<td>포함</td>
<td>-</td>
<td>-</td>
</tr>
<tr class="odd">
<td><strong>총계</strong></td>
<td></td>
<td></td>
<td><strong>$0.079</strong></td>
</tr>
</tbody>
</table>
<p><strong>확장 예측</strong> (1000개 문서): - 1000 × $0.079 = <strong>$79</strong> - 재인덱싱 불필요 (증분 업데이트)</p>
</section>
<section id="샘플-애플리케이션" class="level2" data-number="7.11">
<h2 data-number="7.11" class="anchored" data-anchor-id="샘플-애플리케이션"><span class="header-section-number">7.11</span> 샘플 애플리케이션</h2>
<p><strong><a href="https://aka.ms/azs-multimodal-sample-app-repo">Multimodal RAG GitHub Repository</a></strong> - 텍스트 조각과 이미지 주석을 모두 표시하는 엔드투엔드 RAG 애플리케이션 - 엔터프라이즈 비즈니스 도구 빠른 시작에 이상적 - 데이터 수집 및 인덱싱의 코드 기반 프로세스 예시</p>
</section>
</section>
<section id="핵심-구성-요소-정리" class="level1" data-number="8">
<h1 data-number="8"><span class="header-section-number">8</span> 핵심 구성 요소 정리</h1>
<section id="파이프라인-선택-가이드" class="level2" data-number="8.1">
<h2 data-number="8.1" class="anchored" data-anchor-id="파이프라인-선택-가이드"><span class="header-section-number">8.1</span> 파이프라인 선택 가이드</h2>
<table class="table">
<thead>
<tr class="header">
<th>요구사항</th>
<th>추천 구성</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>빠른 프로토타이핑, 기본 기능</td>
<td>Document Extraction + 이미지 언어화</td>
</tr>
<tr class="even">
<td>정확한 페이지 참조, 위치 정보 필요</td>
<td>Document Layout + 이미지 언어화</td>
</tr>
<tr class="odd">
<td>시각적 유사성 검색</td>
<td>Document Extraction + 멀티모달 임베딩</td>
</tr>
<tr class="even">
<td>정확한 위치 + 시각적 검색</td>
<td>Document Layout + 멀티모달 임베딩</td>
</tr>
<tr class="odd">
<td>페이지 간 테이블, 의미 청킹</td>
<td>Content Understanding + 적절한 임베딩</td>
</tr>
<tr class="even">
<td>설명적 다이어그램 + 시각 자료 혼합</td>
<td>두 임베딩 방식 병행</td>
</tr>
</tbody>
</table>
</section>
<section id="비용-고려사항" class="level2" data-number="8.2">
<h2 data-number="8.2" class="anchored" data-anchor-id="비용-고려사항"><span class="header-section-number">8.2</span> 비용 고려사항</h2>
<ul>
<li><strong>Document Extraction</strong>: 이미지 추출 시 Azure AI Search 요금 부과</li>
<li><strong>Document Layout</strong>: Document Intelligence Layout 가격 적용</li>
<li><strong>Content Understanding</strong>: Azure Content Understanding 가격 (가장 높음)</li>
<li><strong>GenAI Prompt</strong>: 이미지당 LLM 호출 비용</li>
<li><strong>Azure Vision Multimodal</strong>: 이미지/텍스트 임베딩 API 호출 비용</li>
</ul>
</section>
<section id="성능-특성" class="level2" data-number="8.3">
<h2 data-number="8.3" class="anchored" data-anchor-id="성능-특성"><span class="header-section-number">8.3</span> 성능 특성</h2>
<table class="table">
<thead>
<tr class="header">
<th>단계</th>
<th>평균 처리 시간</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>이미지 추출</td>
<td>문서당 1-3초</td>
</tr>
<tr class="even">
<td>이미지 언어화 (LLM)</td>
<td>이미지당 2-5초</td>
</tr>
<tr class="odd">
<td>텍스트 임베딩</td>
<td>청크당 50-150ms</td>
</tr>
<tr class="even">
<td>멀티모달 임베딩</td>
<td>이미지당 150-300ms</td>
</tr>
</tbody>
</table>
</section>
</section>
<section id="참고-문서" class="level1" data-number="9">
<h1 data-number="9"><span class="header-section-number">9</span> 참고 문서</h1>
<ul>
<li><a href="https://learn.microsoft.com/ko-kr/azure/search/">Azure AI Search 공식 문서</a></li>
<li><a href="https://learn.microsoft.com/ko-kr/azure/search/retrieval-augmented-generation-overview">RAG (검색 보강 생성) 개요</a></li>
<li><a href="https://learn.microsoft.com/ko-kr/azure/search/hybrid-search-overview">하이브리드 검색 개요</a></li>
<li><a href="https://learn.microsoft.com/ko-kr/azure/search/vector-search-overview">벡터 검색 개요</a></li>
<li><a href="https://learn.microsoft.com/ko-kr/azure/search/semantic-search-overview">의미 순위 개요</a></li>
<li><a href="https://learn.microsoft.com/ko-kr/azure/search/tutorial-document-extraction-multimodal-embeddings">Tutorial - 이미지 및 텍스트 벡터화</a> ’@</li>
</ul>


</section>

 ]]></description>
  <category>Engineering</category>
  <category>Infra</category>
  <category>Cloud</category>
  <category>Azure</category>
  <category>RAG</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Engineering/Infra/Cloud/Azure/31-az-ai-search-classic-multimodal-search.html</guid>
  <pubDate>Thu, 24 Dec 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Hedeker § 7.2 — MRM with Autocorrelated Errors</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Statistics/LDA/07-1-mrm-autocorrelated-errors.html</link>
  <description><![CDATA[ 





<section id="도입-ch.7-의-위치" class="level2" data-number="1">
<h2 data-number="1" class="anchored" data-anchor-id="도입-ch.7-의-위치"><span class="header-section-number">1</span> 도입 — Ch.7 의 위치</h2>
<p>Hedeker 책 Ch.4-5 에서 다룬 표준 <strong>혼합효과 회귀 모형 (MRM)</strong> 은 다음 두 가정을 깔고 있다:</p>
<ol type="1">
<li><strong>랜덤 효과</strong>: <img src="https://latex.codecogs.com/png.latex?v_i%20%5Csim%20N(0,%20%5CSigma_v)"> — 피험자 간 이질성.</li>
<li><strong>조건부 독립 오차</strong>: <img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon_i%20%5Csim%20N(0,%20%5Csigma%5E2%20I_%7Bn_i%7D)"> — random effect 가 주어지면 같은 피험자의 오차들이 독립.</li>
</ol>
<p>Ch.6 의 <strong>공분산 패턴 모형 (CPM)</strong> 은 다른 길로 — random effect 를 안 두고 <img src="https://latex.codecogs.com/png.latex?V(y_i)"> 를 직접 (<img src="https://latex.codecogs.com/png.latex?%5CSigma_i"> = AR(1), Toeplitz 등) 모형화. 시간적 상관을 명시.</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — Ch.7 = MRM + CPM 의 결합
</div>
</div>
<div class="callout-body-container callout-body">
<p>MRM (Ch.4-5): “<strong>피험자별 위치/기울기가 다르다</strong>.” Random effect 가 그 이질성을 잡는다.</p>
<p>CPM (Ch.6): “<strong>같은 피험자의 시간 점들이 상관 있다</strong>.” 공분산 구조가 그 상관을 잡는다.</p>
<p><strong>Ch.7</strong>: 두 시점의 결합 — 피험자별 random effect (이질성) <strong>+</strong> 시간적 자기상관 (조건부 독립 위반). 가장 유연한 분산-공분산 모형.</p>
<p>식으로:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20V(y_i)%20=%20%5Cunderbrace%7BZ_i%20%5CSigma_v%20Z_i'%7D_%7B%5Ctext%7B%ED%94%BC%ED%97%98%EC%9E%90%20%EA%B0%84%20%EC%9D%B4%EC%A7%88%EC%84%B1%20(MRM)%7D%7D%20%5C;+%5C;%20%5Cunderbrace%7B%5Csigma%5E2%20%5COmega_i%7D_%7B%5Ctext%7B%EC%A1%B0%EA%B1%B4%EB%B6%80%20%EC%9E%90%EA%B8%B0%EC%83%81%EA%B4%80%20(CPM%20%EC%99%80%20%EA%B2%B0%ED%95%A9)%7D%7D%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%5COmega_i"> 가 단위 행렬이면 표준 MRM (Ch.4-5), <img src="https://latex.codecogs.com/png.latex?Z_i%20=%200"> 이면 CPM (Ch.6), 둘 다 일반이면 Ch.7.</p>
</div>
</div>
<p>본 포스트는 § 7.2 의 일반 framework + 다섯 자기상관 구조 (AR(1), MA(1), ARMA(1,1), Toeplitz, NS-AR(1)) 를 차례로 다룬다.</p>
</section>
<section id="일반-framework-식-7.1-7.6" class="level2" data-number="2">
<h2 data-number="2" class="anchored" data-anchor-id="일반-framework-식-7.1-7.6"><span class="header-section-number">2</span> § 7.2 일반 Framework — 식 (7.1)-(7.6)</h2>
<section id="모형-정의-식-7.1" class="level3" data-number="2.1">
<h3 data-number="2.1" class="anchored" data-anchor-id="모형-정의-식-7.1"><span class="header-section-number">2.1</span> 모형 정의 — 식 (7.1)</h3>
<p><img src="https://latex.codecogs.com/png.latex?i"> 번째 피험자의 <img src="https://latex.codecogs.com/png.latex?n_i%20%5Ctimes%201"> 반응 벡터:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20y_i%20=%20X_i%20%5Cbeta%20+%20Z_i%20v_i%20+%20%5Cvarepsilon_i%20,%20%5Cquad%20i%20=%201,%20%5Cldots,%20N%20.%20%5Ctag%7B%EC%8B%9D%207.1%7D%20"></p>
<p>각 항:</p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?y_i">: <img src="https://latex.codecogs.com/png.latex?n_i%20%5Ctimes%201"> 반응 벡터</li>
<li><img src="https://latex.codecogs.com/png.latex?X_i">: <img src="https://latex.codecogs.com/png.latex?n_i%20%5Ctimes%20p"> 고정 효과 설계 행렬</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cbeta">: <img src="https://latex.codecogs.com/png.latex?p%20%5Ctimes%201"> 고정 회귀 모수</li>
<li><img src="https://latex.codecogs.com/png.latex?Z_i">: <img src="https://latex.codecogs.com/png.latex?n_i%20%5Ctimes%20r"> 랜덤 효과 설계 행렬</li>
<li><img src="https://latex.codecogs.com/png.latex?v_i">: <img src="https://latex.codecogs.com/png.latex?r%20%5Ctimes%201"> 랜덤 효과 (<img src="https://latex.codecogs.com/png.latex?v_i%20%5Csim%20N(0,%20%5CSigma_v)">)</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon_i">: <img src="https://latex.codecogs.com/png.latex?n_i%20%5Ctimes%201"> 오차 벡터</li>
</ul>
</section>
<section id="표준-mrm-의-v-식-7.2" class="level3" data-number="2.2">
<h3 data-number="2.2" class="anchored" data-anchor-id="표준-mrm-의-v-식-7.2"><span class="header-section-number">2.2</span> 표준 MRM 의 V — 식 (7.2)</h3>
<p>오차가 conditional independent (<img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon_i%20%5Csim%20N(0,%20%5Csigma%5E2%20I_%7Bn_i%7D)">) 이면:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20V(y_i)%20=%20Z_i%20%5CSigma_v%20Z_i'%20+%20%5Csigma%5E2%20I_%7Bn_i%7D%20.%20%5Ctag%7B%EC%8B%9D%207.2%7D%20"></p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 표준 MRM 의 분산 분해
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?V(y_i)"> 의 두 부분:</p>
<ol type="1">
<li><p><strong><img src="https://latex.codecogs.com/png.latex?Z_i%20%5CSigma_v%20Z_i'"></strong>: 피험자 간 차이가 만드는 분산. 같은 피험자의 다른 시점은 같은 <img src="https://latex.codecogs.com/png.latex?v_i"> 를 공유하므로 양의 공분산 발생. 이게 <strong>피험자 간 이질성</strong>.</p></li>
<li><p><strong><img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2%20I_%7Bn_i%7D"></strong>: 조건부 잔차 분산. 단위 행렬이라 다른 시점의 <img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon_%7Bij%7D,%20%5Cvarepsilon_%7Bik%7D"> 가 <strong>독립</strong>.</p></li>
</ol>
<p>표준 MRM 은 같은 피험자의 시점들이 연관되는 유일한 통로가 random effect <img src="https://latex.codecogs.com/png.latex?v_i">. 이게 너무 강한 가정.</p>
</div>
</div>
</section>
<section id="ac-오차-추가-식-7.3" class="level3" data-number="2.3">
<h3 data-number="2.3" class="anchored" data-anchor-id="ac-오차-추가-식-7.3"><span class="header-section-number">2.3</span> AC 오차 추가 — 식 (7.3)</h3>
<p><img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon_i%20%5Csim%20N(0,%20%5Csigma%5E2%20%5COmega_i)"> 로 일반화 (<img src="https://latex.codecogs.com/png.latex?%5COmega_i"> 는 자기상관 행렬):</p>
<p><img src="https://latex.codecogs.com/png.latex?%20V(y_i)%20=%20Z_i%20%5CSigma_v%20Z_i'%20+%20%5Csigma%5E2%20%5COmega_i%20.%20%5Ctag%7B%EC%8B%9D%207.3%7D%20"></p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
식 (7.3) 의 두 성분 — 본질적 대비
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong><img src="https://latex.codecogs.com/png.latex?Z_i%20%5CSigma_v%20Z_i'"></strong>: <strong>피험자별 다른</strong> 위치/기울기. 같은 피험자 내에서 시점들이 연관되는 통로 1.</p>
<p><strong><img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2%20%5COmega_i"></strong>: <strong>모든 피험자에서 공통</strong>인 시간적 자기상관 패턴. 같은 피험자 내 통로 2 — random effect 외에 추가로.</p>
<p>핵심 관찰: 첫 항은 <strong>개체 차이</strong> (heterogeneity), 둘째 항은 <strong>시간 구조</strong> (temporal structure). 두 종류의 의존성이 분리되어 있다.</p>
<p><strong>예시</strong>: 우울증 점수의 시간 변화. - <img src="https://latex.codecogs.com/png.latex?Z_i%20v_i">: 환자별로 baseline 우울 정도 + 회복 속도가 다름 (개인차). - <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2%20%5COmega_i">: 한 환자 내에서 어제 우울했으면 오늘도 우울할 가능성 (단기 momentum) — 모든 환자에 공통.</p>
<p>표준 MRM 은 둘째 효과를 무시. Ch.7 은 둘 다 동시 모형화.</p>
</div>
</div>
</section>
<section id="eb-estimator-posterior-covariance-식-7.4-7.6" class="level3" data-number="2.4">
<h3 data-number="2.4" class="anchored" data-anchor-id="eb-estimator-posterior-covariance-식-7.4-7.6"><span class="header-section-number">2.4</span> EB Estimator + Posterior Covariance — 식 (7.4)-(7.6)</h3>
<p><img src="https://latex.codecogs.com/png.latex?y_i"> 와 <img src="https://latex.codecogs.com/png.latex?v_i"> 의 결합 분포:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cbegin%7Bpmatrix%7D%20y_i%20%5C%5C%20v_i%20%5Cend%7Bpmatrix%7D%20%5Csim%20N%5C!%5Cleft(%20%5Cbegin%7Bpmatrix%7D%20X_i%20%5Cbeta%20%5C%5C%200%20%5Cend%7Bpmatrix%7D,%20%5Cbegin%7Bpmatrix%7D%20Z_i%20%5CSigma_v%20Z_i'%20+%20%5Csigma%5E2%20%5COmega_i%20&amp;%20Z_i%20%5CSigma_v%20%5C%5C%20%5CSigma_v%20Z_i'%20&amp;%20%5CSigma_v%20%5Cend%7Bpmatrix%7D%20%5Cright)%20.%20%5Ctag%7B%EC%8B%9D%207.4%7D%20"></p>
<p>랜덤 효과의 사후 (posterior) 평균 — Empirical Bayes (EB) 추정량:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Chat%7Bv%7D_i%20=%20%5Cbig%5BZ_i'(%5Csigma%5E2%20%5COmega_i)%5E%7B-1%7D%20Z_i%20+%20%5CSigma_v%5E%7B-1%7D%5Cbig%5D%5E%7B-1%7D%20Z_i'%20(%5Csigma%5E2%20%5COmega_i)%5E%7B-1%7D%20(y_i%20-%20X_i%20%5Cbeta)%20.%20%5Ctag%7B%EC%8B%9D%207.5%7D%20"></p>
<p>사후 공분산:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5CSigma_%7Bv%7Cy_i%7D%20=%20%5Cbig%5BZ_i'(%5Csigma%5E2%20%5COmega_i)%5E%7B-1%7D%20Z_i%20+%20%5CSigma_v%5E%7B-1%7D%5Cbig%5D%5E%7B-1%7D%20.%20%5Ctag%7B%EC%8B%9D%207.6%7D%20"></p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Ch.4 의 식과 비교 — <img src="https://latex.codecogs.com/png.latex?I%20%5Cto%20%5COmega"> 만 변경
</div>
</div>
<div class="callout-body-container callout-body">
<p>Ch.4 의 EB estimator (표준 MRM):</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Chat%7Bv%7D_i%5E%7B(%5Ctext%7BCh.4%7D)%7D%20=%20%5Cbig%5BZ_i'(%5Csigma%5E2%20I_i)%5E%7B-1%7D%20Z_i%20+%20%5CSigma_v%5E%7B-1%7D%5Cbig%5D%5E%7B-1%7D%20Z_i'%20(%5Csigma%5E2%20I_i)%5E%7B-1%7D%20(y_i%20-%20X_i%20%5Cbeta)%20.%20"></p>
<p>식 (7.5) 와 비교하면 <strong>단위 행렬 <img src="https://latex.codecogs.com/png.latex?I_i"> 가 자기상관 행렬 <img src="https://latex.codecogs.com/png.latex?%5COmega_i"> 로 바뀐 것뿐</strong>. 식의 골격이 동일.</p>
<p>이는 <strong>자기상관 모형이 표준 MRM 의 자연스러운 일반화</strong> 임을 보여준다 — 모든 식이 <img src="https://latex.codecogs.com/png.latex?I%20%5Cto%20%5COmega"> 로 일관되게 확장. 따라서 표준 MRM 의 추정 알고리즘 (EM, Fisher Scoring) 도 거의 그대로 적용 가능.</p>
</div>
</div>
<p>이제 다섯 자기상관 구조를 차례로 본다.</p>
</section>
</section>
<section id="ar1-1차-자기회귀-오차" class="level2" data-number="3">
<h2 data-number="3" class="anchored" data-anchor-id="ar1-1차-자기회귀-오차"><span class="header-section-number">3</span> § 7.2.1 AR(1) — 1차 자기회귀 오차</h2>
<section id="정의-식-7.7" class="level3" data-number="3.1">
<h3 data-number="3.1" class="anchored" data-anchor-id="정의-식-7.7"><span class="header-section-number">3.1</span> 정의 — 식 (7.7)</h3>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cvarepsilon_j%20=%20%5Crho%20%5Cvarepsilon_%7Bj-1%7D%20+%20%5Cxi_j%20,%20%5Ctag%7B%EC%8B%9D%207.7%7D%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cxi_j%20%5Csim%20N(0,%20%5Csigma%5E2)"> i.i.d., <img src="https://latex.codecogs.com/png.latex?%7C%5Crho%7C%20%3C%201"> (정상성).</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — “어제의 오차가 오늘의 오차에 일부 들어옴”
</div>
</div>
<div class="callout-body-container callout-body">
<p>식 (7.7) 은 단순한 회귀 형식 — <img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon_j"> 를 <img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon_%7Bj-1%7D"> 에 1차 회귀.</p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?%5Crho%20%3E%200">: 어제 양의 오차 → 오늘도 양의 오차 경향. <strong>시간적 momentum</strong>.</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Crho%20%3C%200">: 어제 양 → 오늘 음. 진동 (oscillation).</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Crho%20=%200">: 독립 (표준 MRM).</li>
</ul>
<p><img src="https://latex.codecogs.com/png.latex?%5Crho"> 가 1 에 가까울수록 인접 시점 간 상관 강함. <img src="https://latex.codecogs.com/png.latex?%7C%5Crho%7C%20%3C%201"> 정상성 조건은 분산이 폭발하지 않도록 강제.</p>
<p><strong>임상 예</strong>: 우울증 점수 — 어제 우울했으면 오늘도 우울할 가능성 (<img src="https://latex.codecogs.com/png.latex?%5Crho%20%3E%200">). 하루 사이의 short-term carryover.</p>
</div>
</div>
</section>
<section id="분산과-공분산-식-7.9-7.12" class="level3" data-number="3.2">
<h3 data-number="3.2" class="anchored" data-anchor-id="분산과-공분산-식-7.9-7.12"><span class="header-section-number">3.2</span> 분산과 공분산 — 식 (7.9)-(7.12)</h3>
<p>식 (7.7) 에서 양변의 분산:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20V(%5Cvarepsilon_j)%20=%20%5Crho%5E2%20V(%5Cvarepsilon_%7Bj-1%7D)%20+%20%5Csigma%5E2%20.%20%5Ctag%7B%EC%8B%9D%207.9%7D%20"></p>
<p>정상성 (<img src="https://latex.codecogs.com/png.latex?V(%5Cvarepsilon_j)%20=%20V(%5Cvarepsilon_%7Bj-1%7D)">) 가정 하에:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20V(%5Cvarepsilon_j)%20=%20%5Cfrac%7B%5Csigma%5E2%7D%7B1%20-%20%5Crho%5E2%7D%20.%20%5Ctag%7B%EC%8B%9D%207.10%7D%20"></p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 정상성이 필요한 이유
</div>
</div>
<div class="callout-body-container callout-body">
<p>식 (7.9) 를 무한 과거로 풀면:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20V(%5Cvarepsilon_j)%20=%20%5Crho%5E2%20V(%5Cvarepsilon_%7Bj-1%7D)%20+%20%5Csigma%5E2%20=%20%5Crho%5E2%20%5B%5Crho%5E2%20V(%5Cvarepsilon_%7Bj-2%7D)%20+%20%5Csigma%5E2%5D%20+%20%5Csigma%5E2%20=%20%5Ccdots%20=%20%5Csigma%5E2%20%5Csum_%7Bk=0%7D%5E%5Cinfty%20%5Crho%5E%7B2k%7D%20.%20"></p>
<p>이 무한 합이 수렴하려면 <img src="https://latex.codecogs.com/png.latex?%7C%5Crho%7C%20%3C%201"> 필요 — 그렇지 않으면 분산이 발산. 수렴 합 = <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2/(1-%5Crho%5E2)">, 정상성 분산.</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Crho%20%5Cto%201"> 의 극한에서 분산 폭발 → AR(1) 모형이 비현실적이 됨. 따라서 <img src="https://latex.codecogs.com/png.latex?%7C%5Crho%7C"> 가 1 에 너무 가까우면 모형 진단 필요 (랜덤 워크 또는 비정상성 의심).</p>
</div>
</div>
<p>공분산은:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Ctext%7BCov%7D(%5Cvarepsilon_j,%20%5Cvarepsilon_%7Bj-s%7D)%20=%20%5Cfrac%7B%5Crho%5Es%20%5Csigma%5E2%7D%7B1%20-%20%5Crho%5E2%7D%20.%20%5Ctag%7B%EC%8B%9D%207.12%7D%20"></p>
<p>상관:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Ctext%7BCorr%7D(%5Cvarepsilon_j,%20%5Cvarepsilon_%7Bj-s%7D)%20=%20%5Crho%5Es%20.%20"></p>
<p><strong>lag-<img src="https://latex.codecogs.com/png.latex?s"> 상관이 <img src="https://latex.codecogs.com/png.latex?%5Crho%5Es"></strong> — 시차에 따라 지수 감쇠.</p>
</section>
<section id="분산-공분산-행렬-식-7.13" class="level3" data-number="3.3">
<h3 data-number="3.3" class="anchored" data-anchor-id="분산-공분산-행렬-식-7.13"><span class="header-section-number">3.3</span> 분산-공분산 행렬 — 식 (7.13)</h3>
<p>5 시점의 예 (<img src="https://latex.codecogs.com/png.latex?n%20=%205">):</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5CSigma%20=%20%5Cfrac%7B%5Csigma%5E2%7D%7B1%20-%20%5Crho%5E2%7D%20%5Cbegin%7Bpmatrix%7D%0A1%20&amp;%20%5Crho%20&amp;%20%5Crho%5E2%20&amp;%20%5Crho%5E3%20&amp;%20%5Crho%5E4%20%5C%5C%0A%5Crho%20&amp;%201%20&amp;%20%5Crho%20&amp;%20%5Crho%5E2%20&amp;%20%5Crho%5E3%20%5C%5C%0A%5Crho%5E2%20&amp;%20%5Crho%20&amp;%201%20&amp;%20%5Crho%20&amp;%20%5Crho%5E2%20%5C%5C%0A%5Crho%5E3%20&amp;%20%5Crho%5E2%20&amp;%20%5Crho%20&amp;%201%20&amp;%20%5Crho%20%5C%5C%0A%5Crho%5E4%20&amp;%20%5Crho%5E3%20&amp;%20%5Crho%5E2%20&amp;%20%5Crho%20&amp;%201%0A%5Cend%7Bpmatrix%7D%20.%20"></p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
행렬의 직관 — Toeplitz 구조 + 지수 감쇠
</div>
</div>
<div class="callout-body-container callout-body">
<p>식 (7.13) 의 행렬은 두 특성을 가진다:</p>
<ol type="1">
<li><strong>Toeplitz</strong>: 같은 시차의 원소가 같음. 대각선과 평행한 띠가 모두 동일 값.</li>
<li><strong>지수 감쇠</strong>: 시차 <img src="https://latex.codecogs.com/png.latex?s"> 의 상관이 <img src="https://latex.codecogs.com/png.latex?%5Crho%5Es"> — 멀어질수록 빠르게 감소.</li>
</ol>
<p>Toeplitz 는 시간적 일관성 (정상성), 지수 감쇠는 단기 momentum 의 두 가정을 한꺼번에 표현. AR(1) 의 우아함이 이 두 성질의 결합.</p>
<p><strong>자유 모수</strong>: <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2"> + <img src="https://latex.codecogs.com/png.latex?%5Crho"> = <strong>2 모수</strong>. <img src="https://latex.codecogs.com/png.latex?n%20%5Ctimes%20n"> 행렬 (<img src="https://latex.codecogs.com/png.latex?n(n+1)/2"> 자유) 을 단 2 개로 압축. 매우 절약적.</p>
</div>
</div>
</section>
<section id="parameterization-차이-식-7.14-7.15" class="level3" data-number="3.4">
<h3 data-number="3.4" class="anchored" data-anchor-id="parameterization-차이-식-7.14-7.15"><span class="header-section-number">3.4</span> Parameterization 차이 — 식 (7.14), (7.15)</h3>
<p>CPM 의 식 (6.4) 에서 사용한 AR(1) parameterization:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Csigma%5E%7B*2%7D%20%5Ccdot%20%5Crho%5E%7B%7Cj-k%7C%7D%20.%20"></p>
<p>식 (7.13) 의 parameterization:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cfrac%7B%5Csigma%5E2%7D%7B1%20-%20%5Crho%5E2%7D%20%5Ccdot%20%5Crho%5E%7B%7Cj-k%7C%7D%20.%20"></p>
<p>관계:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Csigma%5E%7B*2%7D%20=%20(1%20-%20%5Crho%5E2)%20%5Csigma%5E2%20%5Cquad%20%5CLeftrightarrow%20%5Cquad%20%5Csigma%5E2%20=%20%5Cfrac%7B%5Csigma%5E%7B*2%7D%7D%7B1%20-%20%5Crho%5E2%7D%20.%20%5Ctag%7B%EC%8B%9D%207.14,%207.15%7D%20"></p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
둘 중 무엇을 쓰나
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>식 (7.13) parameterization</strong> (시계열·계량경제학 표준): <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2"> 는 innovation <img src="https://latex.codecogs.com/png.latex?%5Cxi_j"> 의 분산.</p>
<p><strong>식 (6.4) parameterization</strong> (생물통계 표준): <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E%7B*2%7D"> 는 직접 관측 분산 (대각).</p>
<p>같은 모형의 다른 표기. 추정 결과 (분산 등) 는 다르지만 fitted values, predictions, 검정 통계량은 같다. <strong>소프트웨어가 어느 쪽을 쓰는지 매뉴얼 확인 필수</strong>.</p>
<p>R <code>nlme::corAR1</code> 은 식 (6.4) 형태, SAS PROC MIXED 의 <code>TYPE=AR(1)</code> 도 비슷. Stata 의 <code>xtreg, ar(1)</code> 은 식 (7.13) 형태.</p>
</div>
</div>
</section>
</section>
<section id="ma1-1차-이동평균-오차" class="level2" data-number="4">
<h2 data-number="4" class="anchored" data-anchor-id="ma1-1차-이동평균-오차"><span class="header-section-number">4</span> § 7.2.2 MA(1) — 1차 이동평균 오차</h2>
<section id="정의-식-7.16" class="level3" data-number="4.1">
<h3 data-number="4.1" class="anchored" data-anchor-id="정의-식-7.16"><span class="header-section-number">4.1</span> 정의 — 식 (7.16)</h3>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cvarepsilon_j%20=%20%5Cxi_j%20-%20%5Ctheta%20%5Cxi_%7Bj-1%7D%20,%20%5Ctag%7B%EC%8B%9D%207.16%7D%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cxi_j%20%5Csim%20N(0,%20%5Csigma%5E2)"> i.i.d.</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — “이번 disturbance + 어제 disturbance 의 일부”
</div>
</div>
<div class="callout-body-container callout-body">
<p>식 (7.16) 은 AR(1) 과 다른 메커니즘:</p>
<ul>
<li><strong>AR(1)</strong>: 어제 <strong>오차</strong> <img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon_%7Bj-1%7D"> 가 오늘 오차에 영향.</li>
<li><strong>MA(1)</strong>: 어제 <strong>disturbance</strong> <img src="https://latex.codecogs.com/png.latex?%5Cxi_%7Bj-1%7D"> 의 일부가 오늘 오차에 들어옴.</li>
</ul>
<p>차이는 미묘 — disturbance (<img src="https://latex.codecogs.com/png.latex?%5Cxi">) 는 latent shock, error (<img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon">) 는 observable quantity.</p>
<p><strong>실용적 차이</strong>: AR(1) 은 무한 lag 까지 상관 (<img src="https://latex.codecogs.com/png.latex?%5Crho%5Es">, 작아지지만 0 안 됨). MA(1) 은 <strong>lag-1 까지만</strong> 상관 — lag-2 이상은 정확히 0.</p>
<p><strong>임상 예</strong>: 식이 일기 — 어제 무엇을 먹었나가 오늘에 약간 영향 (남은 음식 처리 등) 이지만 그저께는 영향 X. AR(1) 보다 짧은 memory.</p>
</div>
</div>
</section>
<section id="분산-공분산-행렬" class="level3" data-number="4.2">
<h3 data-number="4.2" class="anchored" data-anchor-id="분산-공분산-행렬"><span class="header-section-number">4.2</span> 분산-공분산 행렬</h3>
<p>정상성 가정 하:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Csigma%5E2%20%5COmega%20=%20%5Csigma%5E2%20%5Cbegin%7Bpmatrix%7D%0A1%20+%20%5Ctheta%5E2%20&amp;%20-%5Ctheta%20&amp;%200%20&amp;%20%5Ccdots%20&amp;%200%20%5C%5C%0A-%5Ctheta%20&amp;%201%20+%20%5Ctheta%5E2%20&amp;%20-%5Ctheta%20&amp;%20%5Ccdots%20&amp;%200%20%5C%5C%0A0%20&amp;%20-%5Ctheta%20&amp;%201%20+%20%5Ctheta%5E2%20&amp;%20%5Ccdots%20&amp;%200%20%5C%5C%0A%5Cvdots%20&amp;%20&amp;%20&amp;%20%5Cddots%20&amp;%20-%5Ctheta%20%5C%5C%0A0%20&amp;%200%20&amp;%20%5Ccdots%20&amp;%20-%5Ctheta%20&amp;%201%20+%20%5Ctheta%5E2%0A%5Cend%7Bpmatrix%7D%20.%20"></p>
<p>대각: <img src="https://latex.codecogs.com/png.latex?(1%20+%20%5Ctheta%5E2)%20%5Csigma%5E2">, 첫째 off-diagonal: <img src="https://latex.codecogs.com/png.latex?-%5Ctheta%20%5Csigma%5E2">, 그 외: 0.</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
왜 lag-1 만 상관 인가
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon_j%20=%20%5Cxi_j%20-%20%5Ctheta%20%5Cxi_%7Bj-1%7D">, <img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon_%7Bj+1%7D%20=%20%5Cxi_%7Bj+1%7D%20-%20%5Ctheta%20%5Cxi_j">.</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Ctext%7BCov%7D(%5Cvarepsilon_j,%20%5Cvarepsilon_%7Bj+1%7D)%20=%20%5Ctext%7BCov%7D(%5Cxi_j%20-%20%5Ctheta%20%5Cxi_%7Bj-1%7D,%20%5Cxi_%7Bj+1%7D%20-%20%5Ctheta%20%5Cxi_j)%20=%20-%5Ctheta%20%5Csigma%5E2"> (<img src="https://latex.codecogs.com/png.latex?%5Cxi_j"> 가 양쪽에 등장).</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon_j"> 와 <img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon_%7Bj+2%7D%20=%20%5Cxi_%7Bj+2%7D%20-%20%5Ctheta%20%5Cxi_%7Bj+1%7D">: 공통 disturbance 없음 → 공분산 0.</p>
<p>따라서 <strong>lag-2 이상 정확히 0</strong>. AR(1) 의 지수 감쇠와 다른 hard cutoff.</p>
<p><strong>자유 모수</strong>: <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2%20+%20%5Ctheta"> = <strong>2 모수</strong> (AR(1) 과 같음).</p>
</div>
</div>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
CPM 으로는 부적합, MRM-AC 로는 합리적
</div>
</div>
<div class="callout-body-container callout-body">
<p>MA(1) 형태는 CPM (Ch.6) 의 직접 분산-공분산 모형에서는 거의 안 쓰임 — 이유: 관측 데이터의 marginal 분산-공분산 매트릭스에서 lag-1 만 상관 인 패턴은 비현실적 (긴 시간에도 약하지만 상관 잔존).</p>
<p>그러나 MRM 의 <strong>conditional</strong> 오차 (random effect 제거 후 잔차) 에서는 합리적 — random effect 가 장기 패턴을 잡고, MA(1) 가 단기 momentum 만 추가.</p>
<p>이 점이 § 7.2 가 Ch.6 와 다른 이유 — MRM 과 결합한 AC 모형이 단독 CPM 보다 더 다양한 자기상관 구조를 자연스럽게 수용.</p>
</div>
</div>
</section>
</section>
<section id="arma11-ar-ma-결합" class="level2" data-number="5">
<h2 data-number="5" class="anchored" data-anchor-id="arma11-ar-ma-결합"><span class="header-section-number">5</span> § 7.2.3 ARMA(1,1) — AR + MA 결합</h2>
<section id="정의-식-7.17" class="level3" data-number="5.1">
<h3 data-number="5.1" class="anchored" data-anchor-id="정의-식-7.17"><span class="header-section-number">5.1</span> 정의 — 식 (7.17)</h3>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cvarepsilon_j%20=%20%5Crho%20%5Cvarepsilon_%7Bj-1%7D%20+%20%5Cxi_j%20-%20%5Ctheta%20%5Cxi_%7Bj-1%7D%20.%20%5Ctag%7B%EC%8B%9D%207.17%7D%20"></p>
<p>AR(1) 과 MA(1) 를 모두 포함. 자유 모수: <img src="https://latex.codecogs.com/png.latex?%5Crho,%20%5Ctheta,%20%5Csigma%5E2"> = <strong>3 모수</strong>.</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — “lag-1 은 강하게, 그 후는 지수 감쇠”
</div>
</div>
<div class="callout-body-container callout-body">
<p>ARMA(1,1) 의 분산-공분산 행렬에서:</p>
<ul>
<li>대각: <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2%20(1%20+%20%5Ctheta%5E2%20-%202%5Crho%5Ctheta)%20/%20(1-%5Crho%5E2)"></li>
<li>첫 lag 공분산: <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2%20(1-%5Crho%5Ctheta)(%5Crho-%5Ctheta)%20/%20(1-%5Crho%5E2)"></li>
<li>그 후 lag <img src="https://latex.codecogs.com/png.latex?s">: <img src="https://latex.codecogs.com/png.latex?%5Crho%5E%7Bs-1%7D"> 에 비례 (지수 감쇠)</li>
</ul>
<p><strong>lag-1 의 상관이 다른 lag 보다 더 강한 hump 패턴</strong> 을 모형화.</p>
<p><strong>언제 적합한가</strong>: - AR(1) 만으로는 lag-1 상관이 충분히 안 잡힐 때. - 즉 인접 시점 간 매우 강한 상관 + 그 이후 일반 AR(1) 감쇠. - 임상에서 <strong>약물 약효의 carryover</strong> 와 같은 패턴.</p>
</div>
</div>
</section>
</section>
<section id="toeplitz-일반-띠-구조" class="level2" data-number="6">
<h2 data-number="6" class="anchored" data-anchor-id="toeplitz-일반-띠-구조"><span class="header-section-number">6</span> § 7.2.4 Toeplitz — 일반 띠 구조</h2>
<section id="정의" class="level3" data-number="6.1">
<h3 data-number="6.1" class="anchored" data-anchor-id="정의"><span class="header-section-number">6.1</span> 정의</h3>
<p>각 시차 <img src="https://latex.codecogs.com/png.latex?s%20=%201,%20%5Cldots,%20n-1"> 에 별도의 <img src="https://latex.codecogs.com/png.latex?%5Crho_s"> 모수:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Csigma%5E2%20%5COmega%20=%20%5Csigma%5E2%20%5Cbegin%7Bpmatrix%7D%0A1%20&amp;%20%5Crho_1%20&amp;%20%5Crho_2%20&amp;%20%5Ccdots%20&amp;%20%5Crho_%7Bn-1%7D%20%5C%5C%0A%5Crho_1%20&amp;%201%20&amp;%20%5Crho_1%20&amp;%20%5Ccdots%20&amp;%20%5Crho_%7Bn-2%7D%20%5C%5C%0A%5Crho_2%20&amp;%20%5Crho_1%20&amp;%201%20&amp;%20%5Ccdots%20&amp;%20%5Crho_%7Bn-3%7D%20%5C%5C%0A%5Cvdots%20&amp;%20&amp;%20&amp;%20%5Cddots%20&amp;%20%5Cvdots%20%5C%5C%0A%5Crho_%7Bn-1%7D%20&amp;%20%5Crho_%7Bn-2%7D%20&amp;%20%5Crho_%7Bn-3%7D%20&amp;%20%5Ccdots%20&amp;%201%0A%5Cend%7Bpmatrix%7D%20.%20"></p>
<p>자유 모수: <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2%20+%20(n-1)"> 개 <img src="https://latex.codecogs.com/png.latex?%5Crho_s"> = <strong><img src="https://latex.codecogs.com/png.latex?n"> 모수</strong>.</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — “모든 lag 가 자기 자신의 상관을 가짐”
</div>
</div>
<div class="callout-body-container callout-body">
<p>AR(1) 은 lag-<img src="https://latex.codecogs.com/png.latex?s"> 상관이 <img src="https://latex.codecogs.com/png.latex?%5Crho%5Es"> 로 강제. Toeplitz 는 각 lag 가 <strong>독립적으로 추정</strong> — 자유도 높지만 모수도 많음.</p>
<p><strong>언제 적합한가</strong>: - 시차에 따라 상관이 비단조 (예: lag-1 상관 강 → lag-2 약 → lag-3 다시 강) 일 때. - 주기적 패턴 (week 단위, monthly 등).</p>
<p><strong>자유 모수</strong>: AR(1) 의 2 개 → Toeplitz 의 <img src="https://latex.codecogs.com/png.latex?n"> 개. <strong><img src="https://latex.codecogs.com/png.latex?n%20=%205"> 면 5 모수, <img src="https://latex.codecogs.com/png.latex?n%20=%2010"> 이면 10 모수</strong>. 시점 수가 많아질수록 모수 폭발.</p>
<p><strong><img src="https://latex.codecogs.com/png.latex?s">-차 Toeplitz</strong>: 처음 <img src="https://latex.codecogs.com/png.latex?s"> 개 lag 만 비zero, 나머지는 0. 모수 절약.</p>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
CPM Toeplitz 와의 동치 — 두 절약 형식의 만남
</div>
</div>
<div class="callout-body-container callout-body">
<p>3 시점의 경우, <strong>MRM 의 random intercept + Toeplitz(1) 오차</strong> 와 <strong>CPM 의 full Toeplitz(3)</strong> 가 동치이다.</p>
<pre><code>CPM:        [θ₁ θ₂ θ₃]      Random Intercept + Toeplitz(1):
            [θ₂ θ₁ θ₂]   =  σ²_v · J + σ²[1   ρ₁  0]
            [θ₃ θ₂ θ₁]                  [ρ₁  1   ρ₁]
                                         [0   ρ₁  1]</code></pre>
<p>여기서 <img src="https://latex.codecogs.com/png.latex?J"> 는 모두 1 인 행렬.</p>
<p><strong>관계</strong>: - <img src="https://latex.codecogs.com/png.latex?%5Ctheta_1%20=%20%5Csigma_v%5E2%20+%20%5Csigma%5E2"> (대각: 랜덤 절편 분산 + 오차 분산) - <img src="https://latex.codecogs.com/png.latex?%5Ctheta_2%20=%20%5Csigma_v%5E2%20+%20%5Crho_1%20%5Csigma%5E2"> (lag-1: 랜덤 절편 + AR 첫 항) - <img src="https://latex.codecogs.com/png.latex?%5Ctheta_3%20=%20%5Csigma_v%5E2"> (lag-2: 랜덤 절편만)</p>
<p>두 모형은 <strong>재모수화 (reparameterization)</strong> 일 뿐. 동일 fitted values + likelihood. 따라서 CPM 과 MRM-AC 가 같은 데이터 적합도를 줄 수 있고, 어느 쪽 표현이 자연스러운지가 선택 기준.</p>
</div>
</div>
</section>
</section>
<section id="비정상-nonstationary-ar1" class="level2" data-number="7">
<h2 data-number="7" class="anchored" data-anchor-id="비정상-nonstationary-ar1"><span class="header-section-number">7</span> § 7.2.5 비정상 (Nonstationary) AR(1)</h2>
<section id="정의-식-7.18-7.19" class="level3" data-number="7.1">
<h3 data-number="7.1" class="anchored" data-anchor-id="정의-식-7.18-7.19"><span class="header-section-number">7.1</span> 정의 — 식 (7.18)-(7.19)</h3>
<p>식 (7.9) 와 같지만 정상성 가정 풀고 <img src="https://latex.codecogs.com/png.latex?V(%5Cvarepsilon_0)%20=%200">:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20V(%5Cvarepsilon_j)%20=%20%5Crho%5E2%20V(%5Cvarepsilon_%7Bj-1%7D)%20+%20%5Csigma%5E2%20,%20%5Ctag%7B%EC%8B%9D%207.18%7D%20"></p>
<p>이로부터:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20V(%5Cvarepsilon_1)%20=%20%5Csigma%5E2%20,%20%5Cquad%20V(%5Cvarepsilon_2)%20=%20(1%20+%20%5Crho%5E2)%20%5Csigma%5E2%20,%20%5Cquad%20V(%5Cvarepsilon_3)%20=%20(1%20+%20%5Crho%5E2%20+%20%5Crho%5E4)%20%5Csigma%5E2%20,%20%5Cldots%20"></p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 시간이 갈수록 분산 증가
</div>
</div>
<div class="callout-body-container callout-body">
<p>정상 AR(1) 은 모든 시점의 분산이 <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2/(1-%5Crho%5E2)"> 로 같음. NS-AR(1) 은:</p>
<ul>
<li>시점 1: <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2"> (작음)</li>
<li>시점 <img src="https://latex.codecogs.com/png.latex?j">: <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2%20%5Csum_%7Bk=0%7D%5E%7Bj-1%7D%20%5Crho%5E%7B2k%7D"> (증가)</li>
<li><img src="https://latex.codecogs.com/png.latex?j%20%5Cto%20%5Cinfty">: <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2/(1-%5Crho%5E2)"> 로 수렴 (정상 AR(1) 의 분산)</li>
</ul>
<p>즉 <strong>NS-AR(1) 은 시작 시점의 분산이 작고 시간에 따라 정상 AR(1) 의 분산으로 수렴</strong>하는 transition.</p>
<p><strong>언제 적합한가</strong>: - 임상 시험의 baseline 측정 직후 (분산이 점차 증가). - 학습 효과 (시간이 지날수록 개인 차이가 누적). - 처치 시작 후 효과 누적의 분산이 점차 커지는 패턴.</p>
</div>
</div>
</section>
<section id="cholesky-인수분해-식-7.19" class="level3" data-number="7.2">
<h3 data-number="7.2" class="anchored" data-anchor-id="cholesky-인수분해-식-7.19"><span class="header-section-number">7.2</span> Cholesky 인수분해 — 식 (7.19)</h3>
<p><img src="https://latex.codecogs.com/png.latex?%5COmega%20=%20%5CUpsilon%20%5CUpsilon'"> 로 분해:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5CUpsilon%20=%20%5Cbegin%7Bpmatrix%7D%0A1%20&amp;%200%20&amp;%200%20&amp;%20%5Ccdots%20&amp;%200%20%5C%5C%0A%5Crho%20&amp;%201%20&amp;%200%20&amp;%20%5Ccdots%20&amp;%200%20%5C%5C%0A%5Crho%5E2%20&amp;%20%5Crho%20&amp;%201%20&amp;%20%5Ccdots%20&amp;%200%20%5C%5C%0A%5Cvdots%20&amp;%20%5Cvdots%20&amp;%20%5Cvdots%20&amp;%20%5Cddots%20&amp;%20%5Cvdots%20%5C%5C%0A%5Crho%5E%7Bn-1%7D%20&amp;%20%5Crho%5E%7Bn-2%7D%20&amp;%20%5Crho%5E%7Bn-3%7D%20&amp;%20%5Ccdots%20&amp;%201%0A%5Cend%7Bpmatrix%7D%20.%20%5Ctag%7B%EC%8B%9D%207.19%7D%20"></p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Cholesky 의 실용적 가치
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?%5COmega"> 직접 계산 대신 lower triangular <img src="https://latex.codecogs.com/png.latex?%5CUpsilon"> 만 다루면 됨:</p>
<ul>
<li>역수 <img src="https://latex.codecogs.com/png.latex?%5COmega%5E%7B-1%7D%20=%20(%5CUpsilon')%5E%7B-1%7D%20%5CUpsilon%5E%7B-1%7D">, <img src="https://latex.codecogs.com/png.latex?%5CUpsilon"> 의 역수가 또 lower triangular 라 빠름.</li>
<li>우도 계산에서 <img src="https://latex.codecogs.com/png.latex?%5Clog%20%5Cdet%20%5COmega%20=%202%20%5Clog%20%5Cdet%20%5CUpsilon%20=%200"> (<img src="https://latex.codecogs.com/png.latex?%5CUpsilon"> 의 대각이 모두 1 이므로!).</li>
</ul>
<p>따라서 NS-AR(1) 은 <strong>계산상 매우 효율적</strong>. MIXREG 등의 소프트웨어 (Hedeker &amp; Gibbons, 1996b) 가 Cholesky 형태로 직접 구현.</p>
<p><strong>자유 모수</strong>: <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2%20+%20%5Crho"> = <strong>2 모수</strong> (정상 AR(1) 과 같음).</p>
</div>
</div>
</section>
</section>
<section id="다섯-구조-비교-자유-모수와-적합-시점" class="level2" data-number="8">
<h2 data-number="8" class="anchored" data-anchor-id="다섯-구조-비교-자유-모수와-적합-시점"><span class="header-section-number">8</span> 다섯 구조 비교 — 자유 모수와 적합 시점</h2>
<table class="table">
<colgroup>
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
</colgroup>
<thead>
<tr class="header">
<th>구조</th>
<th>자유 모수</th>
<th>핵심 가정</th>
<th>적합한 패턴</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><strong>AR(1)</strong></td>
<td>2 (<img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2,%20%5Crho">)</td>
<td>정상성, 지수 감쇠</td>
<td>인접 시점 강한 상관, 그 이후 빠른 감쇠</td>
</tr>
<tr class="even">
<td><strong>MA(1)</strong></td>
<td>2 (<img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2,%20%5Ctheta">)</td>
<td>정상성, lag-1 만 상관</td>
<td>Hard cutoff, 단기 momentum 만</td>
</tr>
<tr class="odd">
<td><strong>ARMA(1,1)</strong></td>
<td>3 (<img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2,%20%5Crho,%20%5Ctheta">)</td>
<td>정상성, lag-1 강 + 후속 지수</td>
<td>복약 carryover 등</td>
</tr>
<tr class="even">
<td><strong>Toeplitz</strong></td>
<td><img src="https://latex.codecogs.com/png.latex?n"> (<img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2%20+%20(n-1)%20%5Crho_s">)</td>
<td>정상성, lag 별 독립 추정</td>
<td>비단조·주기적 상관</td>
</tr>
<tr class="odd">
<td><strong>NS-AR(1)</strong></td>
<td>2 (<img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2,%20%5Crho">)</td>
<td>비정상, 시간 따라 분산 증가</td>
<td>Baseline → 효과 누적</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
모형 선택 가이드
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>1. AR(1) 가 default</strong>: 시계열 분석에서 검증된 표준. 자유 모수 절약 (2개), 해석 직관적.</p>
<p><strong>2. lag-1 매우 강 + 빠른 감쇠 → ARMA(1,1)</strong>: lag-1 의 hump 가 보일 때.</p>
<p><strong>3. lag-1 만 상관, 그 외 0 → MA(1)</strong>: 거의 드물지만 short-memory 가 명확할 때.</p>
<p><strong>4. 비단조 패턴 → Toeplitz</strong>: 데이터 탐색 후 자유 모수가 충분할 때 (큰 표본).</p>
<p><strong>5. 분산 증가 → NS-AR(1)</strong>: 학습/누적 효과가 명확.</p>
<p><strong>진단 절차</strong>: 1. 표준 MRM 적합 → 잔차 시계열 검토. 2. 잔차의 ACF/PACF 도표로 패턴 확인. 3. 후보 구조 1-2개 적합 → AIC/BIC 또는 LRT 비교. 4. fixed effects 추정의 변화 검토 (구조에 강건한지).</p>
</div>
</div>
</section>
<section id="자기상관-모수-검정-lrt" class="level2" data-number="9">
<h2 data-number="9" class="anchored" data-anchor-id="자기상관-모수-검정-lrt"><span class="header-section-number">9</span> 자기상관 모수 검정 — LRT</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<img src="https://latex.codecogs.com/png.latex?H_0:%20%5Crho%20=%200"> 의 LRT
</div>
</div>
<div class="callout-body-container callout-body">
<p>표준 MRM (without AC) 와 MRM + AC 의 LRT:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cchi%5E2_%7BLR%7D%20=%20-2%5B%5Clog%20L_%7B%5Ctext%7BMRM%7D%7D%20-%20%5Clog%20L_%7B%5Ctext%7BMRM+AC%7D%7D%5D%20.%20"></p>
<p>자유도 = AC 모수 수 (AR(1) 은 1, ARMA(1,1) 은 2).</p>
<p><strong>경계 문제 주의</strong>: <img src="https://latex.codecogs.com/png.latex?%5Crho%20=%200"> 이 모수공간 경계 (<img src="https://latex.codecogs.com/png.latex?%7C%5Crho%7C%20%3C%201">) 와 멀어 일반적으로 standard <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2"> 적용 OK. 그러나 <img src="https://latex.codecogs.com/png.latex?%5Csigma_v%5E2%20=%200"> 같은 경계 문제는 별도 (mixture <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2">).</p>
</div>
</div>
</section>
<section id="코드-예시" class="level2" data-number="10">
<h2 data-number="10" class="anchored" data-anchor-id="코드-예시"><span class="header-section-number">10</span> 코드 예시</h2>
<section id="step-1-r-nlme-의-corar1-corarma-corcompsymm" class="level3" data-number="10.1">
<h3 data-number="10.1" class="anchored" data-anchor-id="step-1-r-nlme-의-corar1-corarma-corcompsymm"><span class="header-section-number">10.1</span> Step 1 — R: nlme 의 corAR1 / corARMA / corCompSymm</h3>
<div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(nlme)</span>
<span id="cb2-2"></span>
<span id="cb2-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 데이터: depression 점수 longitudinal</span></span>
<span id="cb2-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># subject, time, score, treatment</span></span>
<span id="cb2-5"></span>
<span id="cb2-6"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 1. 표준 MRM (random intercept + slope, 조건부 독립 오차)</span></span>
<span id="cb2-7">fit_mrm <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lme</span>(score <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> time <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> treatment,</span>
<span id="cb2-8">               <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">random =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> time <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> subject,</span>
<span id="cb2-9">               <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> dep)</span>
<span id="cb2-10"></span>
<span id="cb2-11"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 2. MRM + AR(1) 오차</span></span>
<span id="cb2-12">fit_ar1 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lme</span>(score <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> time <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> treatment,</span>
<span id="cb2-13">               <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">random =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> time <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> subject,</span>
<span id="cb2-14">               <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">correlation =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">corAR1</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">form =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> time <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> subject),</span>
<span id="cb2-15">               <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> dep)</span>
<span id="cb2-16"></span>
<span id="cb2-17"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 3. MRM + ARMA(1,1)</span></span>
<span id="cb2-18">fit_arma <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lme</span>(score <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> time <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> treatment,</span>
<span id="cb2-19">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">random =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> time <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> subject,</span>
<span id="cb2-20">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">correlation =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">corARMA</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">form =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> time <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> subject,</span>
<span id="cb2-21">                                      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">p =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">q =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>),</span>
<span id="cb2-22">                <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> dep)</span>
<span id="cb2-23"></span>
<span id="cb2-24"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 4. MRM + Toeplitz (lag s=2)</span></span>
<span id="cb2-25"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># nlme 는 Toeplitz 직접 안 지원, gls 의 corSymm 또는 SAS 사용 권장</span></span>
<span id="cb2-26"></span>
<span id="cb2-27"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 5. LRT 비교</span></span>
<span id="cb2-28"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">anova</span>(fit_mrm, fit_ar1)</span>
<span id="cb2-29"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">anova</span>(fit_ar1, fit_arma)</span>
<span id="cb2-30"></span>
<span id="cb2-31"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># AIC 비교</span></span>
<span id="cb2-32"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">AIC</span>(fit_mrm, fit_ar1, fit_arma)</span>
<span id="cb2-33"></span>
<span id="cb2-34"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># AR(1) 모수 추출</span></span>
<span id="cb2-35">fit_ar1<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>modelStruct<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>corStruct</span>
<span id="cb2-36"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># rho 값 출력</span></span></code></pre></div>
</section>
<section id="step-2-python-statsmodels-mixedlm-제한적" class="level3" data-number="10.2">
<h3 data-number="10.2" class="anchored" data-anchor-id="step-2-python-statsmodels-mixedlm-제한적"><span class="header-section-number">10.2</span> Step 2 — Python: statsmodels MixedLM (제한적)</h3>
<div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb3-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> statsmodels.api <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> sm</span>
<span id="cb3-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> statsmodels.formula.api <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> smf</span>
<span id="cb3-3"></span>
<span id="cb3-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># statsmodels 의 MixedLM 은 random effect + 표준 오차만 지원.</span></span>
<span id="cb3-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># AR(1) 등 자기상관 오차는 직접 지원 안 함.</span></span>
<span id="cb3-6"></span>
<span id="cb3-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 표준 MRM</span></span>
<span id="cb3-8">model_mrm <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> smf.mixedlm(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"score ~ time * treatment"</span>, data<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>df,</span>
<span id="cb3-9">                         groups<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>df[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"subject"</span>], re_formula<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"~time"</span>)</span>
<span id="cb3-10">fit_mrm <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> model_mrm.fit(method<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"lbfgs"</span>)</span>
<span id="cb3-11"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(fit_mrm.summary())</span>
<span id="cb3-12"></span>
<span id="cb3-13"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># AC 오차를 원하면 R 의 nlme 또는 lme4 + lmerTest 추천.</span></span>
<span id="cb3-14"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 또는 statsmodels 의 GLSAR (단순 AR(1) 회귀, random effects 없음).</span></span></code></pre></div>
</section>
<section id="step-3-sas-proc-mixed-참고" class="level3" data-number="10.3">
<h3 data-number="10.3" class="anchored" data-anchor-id="step-3-sas-proc-mixed-참고"><span class="header-section-number">10.3</span> Step 3 — SAS PROC MIXED (참고)</h3>
<div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode numberSource sas number-lines code-with-copy"><code class="sourceCode"><span id="cb4-1">PROC MIXED DATA=dep METHOD=REML;</span>
<span id="cb4-2">  CLASS subject treatment;</span>
<span id="cb4-3">  MODEL score = time treatment time*treatment / SOLUTION;</span>
<span id="cb4-4">  RANDOM intercept time / SUBJECT=subject TYPE=UN;</span>
<span id="cb4-5">  REPEATED / SUBJECT=subject TYPE=AR(1);</span>
<span id="cb4-6">RUN;</span>
<span id="cb4-7"></span>
<span id="cb4-8">* TYPE=AR(1) → AR(1) 오차;</span>
<span id="cb4-9">* TYPE=ARMA(1,1) → ARMA(1,1);</span>
<span id="cb4-10">* TYPE=TOEP(s) → s-차 Toeplitz;</span>
<span id="cb4-11">* TYPE=AR(1)(NS) → 비정상 AR(1) (Hedeker MIXREG);</span></code></pre></div>
</section>
</section>
<section id="핵심-요약" class="level2" data-number="11">
<h2 data-number="11" class="anchored" data-anchor-id="핵심-요약"><span class="header-section-number">11</span> 핵심 요약</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
§ 7.2 한 줄 요약
</div>
</div>
<div class="callout-body-container callout-body">
<blockquote class="blockquote">
<p>표준 MRM 의 조건부 독립 가정 (<img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon_i%20%5Csim%20N(0,%20%5Csigma%5E2%20I)">) 을 풀어 <img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon_i%20%5Csim%20N(0,%20%5Csigma%5E2%20%5COmega_i)"> 로 일반화하면 <strong><img src="https://latex.codecogs.com/png.latex?V(y_i)%20=%20Z_i%20%5CSigma_v%20Z_i'%20+%20%5Csigma%5E2%20%5COmega_i"></strong> (식 7.3) — 피험자 간 이질성 (random effect) 과 시간적 자기상관 (Ω) 의 두 성분이 결합된다. 다섯 자기상관 구조 — <strong>AR(1)</strong> (식 7.7, 지수 감쇠, 2 모수), <strong>MA(1)</strong> (식 7.16, lag-1만, 2 모수), <strong>ARMA(1,1)</strong> (식 7.17, lag-1 강+후속 감쇠, 3 모수), <strong>Toeplitz</strong> (lag 별 독립, <img src="https://latex.codecogs.com/png.latex?n"> 모수), <strong>NS-AR(1)</strong> (식 7.18-7.19, 비정상 분산 증가, 2 모수) — 가 자유 모수와 패턴의 trade-off 를 제공한다. EB estimator (식 7.5) 와 posterior covariance (식 7.6) 는 표준 MRM 의 식에서 <strong>단위 행렬 <img src="https://latex.codecogs.com/png.latex?I"> 를 <img src="https://latex.codecogs.com/png.latex?%5COmega"> 로 바꾼 형태</strong> 로 깔끔히 일반화된다.</p>
</blockquote>
</div>
</div>
<table class="table">
<thead>
<tr class="header">
<th>구조</th>
<th>식</th>
<th>자유 모수</th>
<th>적합 시점</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>AR(1)</td>
<td>(7.7)</td>
<td>2</td>
<td>인접 강한 상관 + 지수 감쇠</td>
</tr>
<tr class="even">
<td>MA(1)</td>
<td>(7.16)</td>
<td>2</td>
<td>lag-1 만 상관</td>
</tr>
<tr class="odd">
<td>ARMA(1,1)</td>
<td>(7.17)</td>
<td>3</td>
<td>lag-1 강 + 후속 감쇠</td>
</tr>
<tr class="even">
<td>Toeplitz</td>
<td>—</td>
<td><img src="https://latex.codecogs.com/png.latex?n"></td>
<td>비단조·주기적</td>
</tr>
<tr class="odd">
<td>NS-AR(1)</td>
<td>(7.18-7.19)</td>
<td>2</td>
<td>분산 시간 따라 증가</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
5 가지 실무 권고
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>1. AR(1) 가 default</strong>: 자유 모수 2 개, 해석 명확. 시계열·계량경제 표준.</p>
<p><strong>2. 잔차 ACF/PACF 로 후보 선정</strong>: 표준 MRM 적합 후 잔차의 자기상관 패턴 검토 → AR / MA / ARMA / Toeplitz 중 선택.</p>
<p><strong>3. AIC vs BIC 차이 인식</strong>: BIC 가 Toeplitz 같은 모수 많은 모형을 더 강하게 페널라이즈. 보고 시 둘 다 제시.</p>
<p><strong>4. Fixed effects 의 강건성 점검</strong>: 자기상관 구조 변경 시 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"> 도 변하는지 확인. 큰 변화 → 자기상관 모형이 추정에 결정적 → 신중한 선택.</p>
<p><strong>5. CPM 과의 동치 인식</strong>: Toeplitz, AR(1) 등은 CPM 으로도 표현 가능. MRM-AC 표현이 random effect 분리 해석 유리, CPM 표현이 분산 직접 모형화 명확. 같은 모형의 두 시각.</p>
</div>
</div>
</section>
<section id="관련-주제" class="level2" data-number="12">
<h2 data-number="12" class="anchored" data-anchor-id="관련-주제"><span class="header-section-number">12</span> 관련 주제</h2>
<p><strong>Hedeker 시리즈 (Ch.4-7)</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/04-0-2-mixed-effects-continuous-overview.html">§ 30 — 혼합효과 회귀모형 개요</a> — Ch.4 도입</li>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/04-2-random-intercept-mrm.html">§ 32 — 랜덤 절편 MRM</a> — Ch.4 random intercept</li>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/04-3-random-intercept-trend-mrm.html">§ 33 — 랜덤 절편·추세 MRM</a> — Ch.5</li>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/04-4-matrix-formulation-mrm.html">§ 34 — 행렬 공식화</a> — Ch.6 matrix formulation</li>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/04-5-1-mrm-estimation.html">§ 35 — MRM 추정론</a> — ML/REML/EM/Fisher Scoring</li>
</ul>
<p><strong>관련 개념</strong></p>
<ul>
<li>Ch.6 — 공분산 패턴 모형 (CPM, 미작성) — 본 포스트의 한 측면 (시간 구조) 만 사용</li>
<li><a href="./08-mixed-model-gee-intro.qmd">Ch.8 — GEE</a> — Marginal 접근의 또 다른 길</li>
<li><a href="https://en.wikipedia.org/wiki/Generalized_estimating_equation">Generalized Estimating Equations</a></li>
</ul>
<p><strong>시계열 / 계량경제 응용</strong></p>
<ul>
<li><a href="https://en.wikipedia.org/wiki/Autoregressive%E2%80%93moving-average_model">AR/MA/ARMA 모형 일반</a></li>
<li><a href="https://en.wikipedia.org/wiki/Cholesky_decomposition">Cholesky decomposition 응용</a></li>
</ul>
</section>
<section id="참고-문헌" class="level2" data-number="13">
<h2 data-number="13" class="anchored" data-anchor-id="참고-문헌"><span class="header-section-number">13</span> 참고 문헌</h2>
<ul>
<li>Hedeker, D., &amp; Gibbons, R. D. (2006). <em>Longitudinal Data Analysis</em>. Wiley. <strong>§ 7.2</strong>.</li>
<li>Chi, E. M., &amp; Reinsel, G. C. (1989). Models for longitudinal data with random effects and AR(1) errors. <em>JASA</em>, 84(406), 452-459. (MRM + AR(1) 의 핵심 reference)</li>
<li>Mansour, H., Nordheim, E. V., &amp; Rutledge, J. J. (1985). Maximum likelihood estimation of variance components in repeated measures designs assuming autoregressive errors. <em>Biometrics</em>, 41(1), 287-294. (NS-AR(1) 의 원전)</li>
<li>Hedeker, D., &amp; Gibbons, R. D. (1996b). MIXREG: A computer program for mixed-effects regression analysis with autocorrelated errors. <em>Computer Methods and Programs in Biomedicine</em>, 49(3), 229-252. (NS-AR(1) Cholesky 구현)</li>
<li>Jones, R. H., &amp; Boadi-Boateng, F. (1991). Unequally spaced longitudinal data with AR(1) serial correlation. <em>Biometrics</em>, 47(1), 161-175. (불균등 시점 확장)</li>
<li>Verbeke, G., &amp; Molenberghs, G. (2000). <em>Linear Mixed Models for Longitudinal Data</em>. Springer. (대안 reference)</li>
</ul>


</section>

 ]]></description>
  <category>Statistics</category>
  <category>Longitudinal Data Analysis</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Statistics/LDA/07-1-mrm-autocorrelated-errors.html</guid>
  <pubDate>Thu, 14 May 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Ch.7 Overview — MRM with Autocorrelated Errors</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Statistics/LDA/07-0-mrm-autocorrelated-overview.html</link>
  <description><![CDATA[ 





<section id="들어가며-ch.7-의-위치" class="level1" data-number="1">
<h1 data-number="1"><span class="header-section-number">1</span> 들어가며 — Ch.7 의 위치</h1>
<p>Hedeker 책의 Ch.4 부터 Ch.7 까지의 흐름:</p>
<table class="table">
<colgroup>
<col style="width: 23%">
<col style="width: 15%">
<col style="width: 35%">
<col style="width: 25%">
</colgroup>
<thead>
<tr class="header">
<th>Chapter</th>
<th>내용</th>
<th><img src="https://latex.codecogs.com/png.latex?V(y_i)"> 형태</th>
<th>핵심 가정</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Ch.4</td>
<td>MRM (랜덤 절편)</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Csigma_%5Cupsilon%5E2%20%5Cmathbf%7B1%7D%5Cmathbf%7B1%7D%5E%5Ctop%20+%20%5Csigma%5E2%20I"></td>
<td>조건부 독립</td>
</tr>
<tr class="even">
<td>Ch.5</td>
<td>MRM (랜덤 절편 + 추세)</td>
<td><img src="https://latex.codecogs.com/png.latex?Z_i%5CSigma_%5Cupsilon%20Z_i%5E%5Ctop%20+%20%5Csigma%5E2%20I"></td>
<td>조건부 독립</td>
</tr>
<tr class="odd">
<td>Ch.6</td>
<td>CPM (공분산 패턴)</td>
<td><img src="https://latex.codecogs.com/png.latex?%5CSigma_i"> 직접 명세</td>
<td>랜덤 효과 없음</td>
</tr>
<tr class="even">
<td><strong>Ch.7</strong></td>
<td><strong>MRM + AC 오차</strong></td>
<td><img src="https://latex.codecogs.com/png.latex?Z_i%5CSigma_%5Cupsilon%20Z_i%5E%5Ctop%20+%20%5Csigma%5E2%20%5COmega_i"></td>
<td><strong>조건부 독립 가정 완화</strong></td>
</tr>
</tbody>
</table>
<p>Ch.7 은 Ch.4-5 의 MRM 과 Ch.6 의 CPM 을 결합한다. 두 chapter 의 핵심 도구를 하나의 모형으로 통합:</p>
<ul>
<li><strong>Ch.4-5 의 도구</strong>: 랜덤 효과 <img src="https://latex.codecogs.com/png.latex?Z_i%5Cupsilon_i"> — 피험자별 절편·기울기 차이 모형화.</li>
<li><strong>Ch.6 의 도구</strong>: 자기상관 오차 행렬 <img src="https://latex.codecogs.com/png.latex?%5COmega_i"> — 시간적 의존 모형화.</li>
<li><strong>Ch.7 의 통합</strong>: 두 도구가 같은 모형 안에서 동시 작동.</li>
</ul>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
두 종류의 의존성 — 왜 둘 다 필요한가
</div>
</div>
<div class="callout-body-container callout-body">
<p>종단 임상 데이터는 두 가지 통로로 시점들이 의존한다.</p>
<ol type="1">
<li><p><strong>피험자 차이</strong> — 환자 A 의 baseline WPSS 가 5, 환자 B 가 2 라면, A 의 모든 시점이 B 보다 일관되게 높음. 이 의존성은 <strong>피험자별 랜덤 효과</strong> (<img src="https://latex.codecogs.com/png.latex?%5Cupsilon_i">) 로 자연스럽게 잡힌다.</p></li>
<li><p><strong>시간 momentum</strong> — 같은 환자에서 어제 우울했으면 오늘도 우울할 경향. 이 의존성은 <strong>자기상관 오차</strong> (<img src="https://latex.codecogs.com/png.latex?%5COmega_i">) 로 잡힌다.</p></li>
</ol>
<p>표준 MRM (Ch.4-5) 만으로는 시간 momentum 을 못 잡고, CPM (Ch.6) 만으로는 피험자 차이를 분리 못한다. <strong>Ch.7 의 결합 모형이 두 종류 의존성을 동시 표현하는 가장 자연스러운 길</strong>.</p>
</div>
</div>
<p>본 overview 는 Ch.7 의 4 개 절을 차례로 정리한다.</p>
<ul>
<li>§ 7.1 Introduction — 자기상관 오차의 도입 동기</li>
<li>§ 7.2 MRMs with AC Errors — 일반 framework + 5 자기상관 구조 (상세는 <a href="../../../../../docs/blog/posts/Statistics/LDA/07-1-mrm-autocorrelated-errors.html">§ 7.2 sub-post</a>)</li>
<li>§ 7.3 Model Selection — LR 검정·AIC·BIC + CPM vs MRM vs MRM-AC 비교</li>
<li>§ 7.4 Example — Bock 항우울제 데이터의 적합 패턴</li>
</ul>
</section>
<section id="introduction-왜-자기상관-오차인가" class="level1" data-number="2">
<h1 data-number="2"><span class="header-section-number">2</span> § 7.1 — Introduction: 왜 자기상관 오차인가</h1>
<section id="표준-mrm-의-가정-점검" class="level2" data-number="2.1">
<h2 data-number="2.1" class="anchored" data-anchor-id="표준-mrm-의-가정-점검"><span class="header-section-number">2.1</span> 표준 MRM 의 가정 점검</h2>
<p>Ch.4-5 에서 정의한 MRM (식 7.1):</p>
<p><img src="https://latex.codecogs.com/png.latex?%0Ay_i%20=%20X_i%5Cbeta%20+%20Z_i%5Cupsilon_i%20+%20%5Cvarepsilon_i,%20%5Cqquad%20%5Cvarepsilon_i%20%5Csim%20%5Cmathcal%7BN%7D_%7Bn_i%7D(0,%20%5Csigma%5E2%20I_%7Bn_i%7D)%0A%5Ctag%7B7.1%7D%0A"></p>
<p>마진 분산-공분산:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0AV(y_i)%20=%20Z_i%5CSigma_%5Cupsilon%20Z_i%5E%5Ctop%20+%20%5Csigma%5E2%20I_%7Bn_i%7D%0A%5Ctag%7B7.2%7D%0A"></p>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
식 (7.2) 가 가정하는 것 — 조건부 독립
</div>
</div>
<div class="callout-body-container callout-body">
<p>오차 분산-공분산 <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2%20I"> 가 단위 행렬이라는 것이 의미하는 두 가지:</p>
<ol type="1">
<li><strong>시점 간 동일 분산</strong>: <img src="https://latex.codecogs.com/png.latex?V(%5Cvarepsilon_%7Bij%7D)%20=%20%5Csigma%5E2"> — 모든 시점에서 같은 분산.</li>
<li><strong>시점 간 독립</strong>: <img src="https://latex.codecogs.com/png.latex?%5Ctext%7BCov%7D(%5Cvarepsilon_%7Bij%7D,%20%5Cvarepsilon_%7Bik%7D)%20=%200"> (<img src="https://latex.codecogs.com/png.latex?j%20%5Cneq%20k">).</li>
</ol>
<p>즉 <strong>랜덤 효과 <img src="https://latex.codecogs.com/png.latex?%5Cupsilon_i"> 가 주어지면 같은 피험자의 시점들이 서로 독립</strong> 이라는 강한 가정.</p>
<p>이 가정이 자주 위반되는 임상 시나리오:</p>
<ul>
<li>우울증 점수: 어제 우울 → 오늘도 우울 (단기 momentum).</li>
<li>혈압 측정: 어제 높음 → 오늘도 높음 (생리적 안정성).</li>
<li>학습 곡선: 어제 잘함 → 오늘도 잘함 (skill carryover).</li>
</ul>
<p>→ 이 시간적 의존이 <strong>랜덤 효과만으로는 잡히지 않는</strong> 부분.</p>
</div>
</div>
</section>
<section id="figure-7.1-vs-figure-7.2-시각적-비교" class="level2" data-number="2.2">
<h2 data-number="2.2" class="anchored" data-anchor-id="figure-7.1-vs-figure-7.2-시각적-비교"><span class="header-section-number">2.2</span> Figure 7.1 vs Figure 7.2 — 시각적 비교</h2>
<p>Hedeker 책의 두 그림이 핵심 차이를 직관적으로 보여준다.</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
ASCII 재현 — 두 그림의 의미
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>Figure 7.1 (조건부 독립 오차)</strong> — 환자 2 명, 50 시점:</p>
<pre><code>관측: ●  ●●  ●  ●●●  ●  ●●  ●  ●●●  ●●  ●  ●  ●●  ●●● ...
trend line ─────────────────────────────────────────</code></pre>
<p>관측이 trend line 주위에 <strong>무작위로 흩어짐</strong>. 한 시점이 위에 있다고 다음 시점도 위에 있을 이유 없음.</p>
<p><strong>Figure 7.2 (AR(1) 오차, <img src="https://latex.codecogs.com/png.latex?%5Crho%20=%200.75">)</strong>:</p>
<pre><code>관측: ●●●●●▲▲▲▲▲●●●●●▼▼▼▼▼●●●●●▲▲▲▲▲●●●●●▼▼▼▼▼ ...
trend line ─────────────────────────────────────────</code></pre>
<p>관측이 <strong>연속된 위/아래 streaks</strong> 로 그룹화. 한 시점이 위에 있으면 다음 몇 시점도 위에 있을 가능성이 높음.</p>
<p>→ Streaks 가 <strong>자기상관의 시각적 시그너처</strong>. AR(1) 모수 <img src="https://latex.codecogs.com/png.latex?%5Crho%20=%200.75"> 가 강해 streaks 가 명확하지만, 실제 데이터에서는 보통 <img src="https://latex.codecogs.com/png.latex?%5Crho%20%5Capprox%200.2%20%5Csim%200.5"> 범위로 더 미묘.</p>
<p><strong>진단 도구</strong>: 표준 MRM 적합 후 잔차의 ACF/PACF 도표. lag-1 이상의 상관이 있으면 자기상관 모형 (Ch.7) 으로 확장.</p>
</div>
</div>
</section>
<section id="역사적-배경" class="level2" data-number="2.3">
<h2 data-number="2.3" class="anchored" data-anchor-id="역사적-배경"><span class="header-section-number">2.3</span> 역사적 배경</h2>
<p>자기상관 오차를 회귀 모형에 포함하는 아이디어는 계량경제학 문헌 (MaCurdy 1982, 종단 소득 데이터) 에 잘 정립되어 있다. MRM 의 자기상관 확장에 대한 핵심 참고문헌:</p>
<ul>
<li><strong>Chi &amp; Reinsel (1989)</strong> — MRM with AR(1) 오차의 표준 reference.</li>
<li>Mansour et al.&nbsp;(1985), Hedeker (1989), Jones &amp; Boadi-Boateng (1991), Rochon (1992).</li>
</ul>
<p>Ch.7 은 이 흐름을 종단 데이터 분석의 일반 framework 로 정리한다.</p>
</section>
</section>
<section id="mrm-with-ac-errors-일반-framework" class="level1" data-number="3">
<h1 data-number="3"><span class="header-section-number">3</span> § 7.2 — MRM with AC Errors: 일반 Framework</h1>
<section id="모형-정의" class="level2" data-number="3.1">
<h2 data-number="3.1" class="anchored" data-anchor-id="모형-정의"><span class="header-section-number">3.1</span> 모형 정의</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
정의: MRM with Autocorrelated Errors
</div>
</div>
<div class="callout-body-container callout-body">
<p>오차 분포를 <img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon_i%20%5Csim%20%5Cmathcal%7BN%7D(0,%20%5Csigma%5E2%20%5COmega_i)"> 로 일반화 (단위 행렬 <img src="https://latex.codecogs.com/png.latex?I"> 를 자기상관 행렬 <img src="https://latex.codecogs.com/png.latex?%5COmega_i"> 로 대체):</p>
<p><img src="https://latex.codecogs.com/png.latex?%0Ay_i%20=%20X_i%5Cbeta%20+%20Z_i%5Cupsilon_i%20+%20%5Cvarepsilon_i,%20%5Cquad%20%5Cupsilon_i%20%5Csim%20%5Cmathcal%7BN%7D(0,%20%5CSigma_%5Cupsilon),%20%5Cquad%20%5Cvarepsilon_i%20%5Csim%20%5Cmathcal%7BN%7D(0,%20%5Csigma%5E2%20%5COmega_i)%0A"></p>
<p>마진 분산-공분산:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0AV(y_i)%20=%20Z_i%5CSigma_%5Cupsilon%20Z_i%5E%5Ctop%20+%20%5Csigma%5E2%20%5COmega_i%0A%5Ctag%7B7.3%7D%0A"></p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?Z_i%5CSigma_%5Cupsilon%20Z_i%5E%5Ctop">: <strong>피험자 간 이질성</strong> (Ch.4-5 의 랜덤 효과 부분).</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2%20%5COmega_i">: <strong>시간적 자기상관</strong> (모든 피험자에 공통인 오차 구조).</li>
<li><img src="https://latex.codecogs.com/png.latex?%5COmega_i"> 는 <img src="https://latex.codecogs.com/png.latex?q"> 개 자기상관 모수의 함수, 형태는 5 가지 중 선택.</li>
</ul>
<p>특수 경우:</p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?%5COmega_i%20=%20I_i"> → 표준 MRM (Ch.4-5, 식 7.2).</li>
<li><img src="https://latex.codecogs.com/png.latex?Z_i%20=%200"> → CPM (Ch.6).</li>
<li>둘 다 비단순 → MRM-AC (Ch.7).</li>
</ul>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<img src="https://latex.codecogs.com/png.latex?I%20%5Cto%20%5COmega"> — 우아한 일반화
</div>
</div>
<div class="callout-body-container callout-body">
<p>식 (7.3) 의 형태가 식 (7.2) 와 정확히 같고 <strong>단위 행렬 <img src="https://latex.codecogs.com/png.latex?I"> 자리에 <img src="https://latex.codecogs.com/png.latex?%5COmega"> 만 들어간 것</strong> 이다. 이 한 줄 일반화의 결과:</p>
<ol type="1">
<li><strong>추정 알고리즘 그대로</strong>: Ch.4 의 EM·Fisher Scoring 등이 그대로 적용. 행렬 연산만 확장.</li>
<li><strong>모든 직관 transfer</strong>: Ch.4 의 EB (Empirical Bayes) 추정·BLUP·고정 효과 추정 직관이 AC 모형에서도 동일한 형태.</li>
<li><strong>소프트웨어 구현 단순</strong>: 기존 MRM 코드에 <img src="https://latex.codecogs.com/png.latex?%5COmega"> 행렬 인자만 추가.</li>
</ol>
<p>이 우아함이 Ch.7 의 수학적 매력 — 새로운 추정 이론을 짓지 않고 기존 framework 의 자연 확장.</p>
</div>
</div>
</section>
<section id="eb-추정과-사후-공분산" class="level2" data-number="3.2">
<h2 data-number="3.2" class="anchored" data-anchor-id="eb-추정과-사후-공분산"><span class="header-section-number">3.2</span> EB 추정과 사후 공분산</h2>
<p>식 (7.5)-(7.6) 의 형태가 Ch.4 과 정확히 같다 (단 <img src="https://latex.codecogs.com/png.latex?I%20%5Cto%20%5COmega">):</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Chat%5Cupsilon_i%20=%20%5BZ_i%5E%5Ctop%20(%5Csigma%5E2%20%5COmega_i)%5E%7B-1%7D%20Z_i%20+%20%5CSigma_%5Cupsilon%5E%7B-1%7D%5D%5E%7B-1%7D%20Z_i%5E%5Ctop%20(%5Csigma%5E2%20%5COmega_i)%5E%7B-1%7D%20(y_i%20-%20X_i%5Cbeta)%0A%5Ctag%7B7.5%7D%0A"></p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5CSigma_%7B%5Cupsilon%20%5Cmid%20y_i%7D%20=%20%5BZ_i%5E%5Ctop%20(%5Csigma%5E2%20%5COmega_i)%5E%7B-1%7D%20Z_i%20+%20%5CSigma_%5Cupsilon%5E%7B-1%7D%5D%5E%7B-1%7D%0A%5Ctag%7B7.6%7D%0A"></p>
<p>이는 <a href="../../../../../docs/blog/posts/Statistics/LDA/04-5-mrm-estimation.html">§ 4.5 MRM 추정론</a> 의 EB 추정 식과 정확히 같은 구조다. 모든 직관과 알고리즘이 그대로 transfer.</p>
</section>
</section>
<section id="의-5-자기상관-구조-한-페이지-요약" class="level1" data-number="4">
<h1 data-number="4"><span class="header-section-number">4</span> § 7.2 의 5 자기상관 구조 — 한 페이지 요약</h1>
<p>이 5 구조의 자세한 식·매트릭스·직관·코드는 <a href="../../../../../docs/blog/posts/Statistics/LDA/07-1-mrm-autocorrelated-errors.html">§ 7.2 sub-post</a> 에서 다룬다. 본 overview 에서는 핵심 요약.</p>
<section id="구조-비교-표" class="level2" data-number="4.1">
<h2 data-number="4.1" class="anchored" data-anchor-id="구조-비교-표"><span class="header-section-number">4.1</span> 5 구조 비교 표</h2>
<table class="table">
<colgroup>
<col style="width: 15%">
<col style="width: 33%">
<col style="width: 25%">
<col style="width: 25%">
</colgroup>
<thead>
<tr class="header">
<th>구조</th>
<th>자유 모수 <img src="https://latex.codecogs.com/png.latex?q"></th>
<th>핵심 가정</th>
<th>적합 패턴</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>AR(1)</td>
<td>2 (<img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2,%20%5Crho">)</td>
<td>정상성, 지수 감쇠</td>
<td>시계열 표준, 단기 momentum</td>
</tr>
<tr class="even">
<td>MA(1)</td>
<td>2 (<img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2,%20%5Ctheta">)</td>
<td>정상성, lag-1 만 상관</td>
<td>hard cutoff, 매우 단기 의존</td>
</tr>
<tr class="odd">
<td>ARMA(1,1)</td>
<td>3 (<img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2,%20%5Crho,%20%5Ctheta">)</td>
<td>정상성, lag-1 강 + 후속 감쇠</td>
<td>약물 carryover, 인접 강</td>
</tr>
<tr class="even">
<td>Toeplitz</td>
<td><img src="https://latex.codecogs.com/png.latex?n"></td>
<td>정상성, lag 별 자유</td>
<td>비단조 패턴, 주기성</td>
</tr>
<tr class="odd">
<td>NS-AR(1)</td>
<td>2 + 추가</td>
<td><strong>비정상성</strong>, 분산 시간 증가</td>
<td>학습 효과, 분산 누적</td>
</tr>
</tbody>
</table>
</section>
<section id="ar1-가장-흔한-default" class="level2" data-number="4.2">
<h2 data-number="4.2" class="anchored" data-anchor-id="ar1-가장-흔한-default"><span class="header-section-number">4.2</span> AR(1) — 가장 흔한 default</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
AR(1) 정의 (식 7.7-7.13)
</div>
</div>
<div class="callout-body-container callout-body">
<p>오차의 1차 자기회귀:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cvarepsilon_j%20=%20%5Crho%20%5Cvarepsilon_%7Bj-1%7D%20+%20%5Cxi_j,%20%5Cquad%20%5Cxi_j%20%5Csim%20%5Cmathcal%7BN%7D(0,%20%5Csigma%5E2)%20%5Ctext%7B%20i.i.d.%7D%0A%5Ctag%7B7.7%7D%0A"></p>
<p>정상성 가정 하에서 분산:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0AV(%5Cvarepsilon_j)%20=%20%5Cfrac%7B%5Csigma%5E2%7D%7B1%20-%20%5Crho%5E2%7D%0A%5Ctag%7B7.10%7D%0A"></p>
<p>lag-<img src="https://latex.codecogs.com/png.latex?s"> 공분산:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Ctext%7BCov%7D(%5Cvarepsilon_j,%20%5Cvarepsilon_%7Bj-s%7D)%20=%20%5Cfrac%7B%5Crho%5Es%20%5Csigma%5E2%7D%7B1%20-%20%5Crho%5E2%7D%0A%5Ctag%7B7.12%7D%0A"></p>
<p>분산-공분산 행렬:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Csigma%5E2%20%5COmega%20=%20%5Cfrac%7B%5Csigma%5E2%7D%7B1%20-%20%5Crho%5E2%7D%0A%5Cbegin%7Bbmatrix%7D%0A1%20&amp;%20%5Crho%20&amp;%20%5Crho%5E2%20&amp;%20%5Ccdots%20&amp;%20%5Crho%5E%7Bn-1%7D%20%5C%5C%0A%5Crho%20&amp;%201%20&amp;%20%5Crho%20&amp;%20%5Ccdots%20&amp;%20%5Crho%5E%7Bn-2%7D%20%5C%5C%0A%5Crho%5E2%20&amp;%20%5Crho%20&amp;%201%20&amp;%20%5Ccdots%20&amp;%20%5Crho%5E%7Bn-3%7D%20%5C%5C%0A%5Cvdots%20&amp;%20%5Cvdots%20&amp;%20%5Cvdots%20&amp;%20%5Cddots%20&amp;%20%5Cvdots%20%5C%5C%0A%5Crho%5E%7Bn-1%7D%20&amp;%20%5Crho%5E%7Bn-2%7D%20&amp;%20%5Crho%5E%7Bn-3%7D%20&amp;%20%5Ccdots%20&amp;%201%0A%5Cend%7Bbmatrix%7D%0A%5Ctag%7B7.13%7D%0A"></p>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Ch.6 § 6.2.2 의 AR(1) 과 차이 — 표기만 다름
</div>
</div>
<div class="callout-body-container callout-body">
<p><a href="../../../../../docs/blog/posts/Statistics/LDA/06-2-cpm-cs-ar1.html">Ch.6 § 6.2.2 의 AR(1) 식 (6.4)</a> 와 본 식 (7.13) 을 비교하면 <strong>분산 항만 다르다</strong>.</p>
<ul>
<li>식 (6.4): <img src="https://latex.codecogs.com/png.latex?%5Csigma_%7B(6.4)%7D%5E%7B*2%7D%20%5Ccdot%20%5Crho%5E%7B%7Cj-j'%7C%7D"> (분산 = <img src="https://latex.codecogs.com/png.latex?%5Csigma_%7B(6.4)%7D%5E%7B*2%7D">)</li>
<li>식 (7.13): <img src="https://latex.codecogs.com/png.latex?%5Cfrac%7B%5Csigma%5E2%7D%7B1-%5Crho%5E2%7D%20%5Ccdot%20%5Crho%5E%7B%7Cj-j'%7C%7D"> (분산 = <img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2/(1-%5Crho%5E2)">)</li>
</ul>
<p>두 표기의 관계: <img src="https://latex.codecogs.com/png.latex?%5Csigma_%7B(6.4)%7D%5E%7B*2%7D%20=%20(1-%5Crho%5E2)%5Csigma%5E2">.</p>
<p>식 (6.4) 는 생물통계 문헌의 표기 (분산이 직접), 식 (7.13) 은 시계열·계량경제 표기 (<img src="https://latex.codecogs.com/png.latex?%5Cxi_j"> 의 분산이 직접). <strong>데이터 분석 결과는 동일</strong> — 표기 문제일 뿐.</p>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
AR(1) 의 직관 — “기억의 지수적 망각”
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?%5Crho%20=%200.5"> 일 때 lag 별 상관:</p>
<ul>
<li>lag 1: <img src="https://latex.codecogs.com/png.latex?%5Crho%20=%200.5"></li>
<li>lag 2: <img src="https://latex.codecogs.com/png.latex?%5Crho%5E2%20=%200.25"></li>
<li>lag 3: <img src="https://latex.codecogs.com/png.latex?%5Crho%5E3%20=%200.125"></li>
<li>lag 5: 0.031 (거의 무관)</li>
</ul>
<p><strong>기억이 등비수열로 사라진다</strong> — Markov 1단계 성질.</p>
<p>식 (7.7) 의 점화식이 의미하는 바: “오늘의 오차는 어제 오차의 일부 (<img src="https://latex.codecogs.com/png.latex?%5Crho"> 배) + 새 잡음.” 어제만으로 미래 충분 정보 (mean-square sense).</p>
</div>
</div>
</section>
<section id="ma1-hard-cutoff" class="level2" data-number="4.3">
<h2 data-number="4.3" class="anchored" data-anchor-id="ma1-hard-cutoff"><span class="header-section-number">4.3</span> MA(1) — Hard Cutoff</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
MA(1) 정의 (식 7.16)
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cvarepsilon_j%20=%20%5Cxi_j%20-%20%5Ctheta%20%5Cxi_%7Bj-1%7D,%20%5Cquad%20%5Cxi_j%20%5Csim%20%5Cmathcal%7BN%7D(0,%20%5Csigma%5E2)%0A%5Ctag%7B7.16%7D%0A"></p>
<p>정상성 분산-공분산:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Csigma%5E2%20%5COmega%20=%20%5Csigma%5E2%0A%5Cbegin%7Bbmatrix%7D%0A1%20+%20%5Ctheta%5E2%20&amp;%20-%5Ctheta%20&amp;%200%20&amp;%20%5Ccdots%20&amp;%200%20%5C%5C%0A-%5Ctheta%20&amp;%201%20+%20%5Ctheta%5E2%20&amp;%20-%5Ctheta%20&amp;%20%5Ccdots%20&amp;%200%20%5C%5C%0A0%20&amp;%20-%5Ctheta%20&amp;%201%20+%20%5Ctheta%5E2%20&amp;%20%5Ccdots%20&amp;%200%20%5C%5C%0A%5Cvdots%20&amp;%20%5Cvdots%20&amp;%20%5Cvdots%20&amp;%20%5Cddots%20&amp;%20%5Cvdots%20%5C%5C%0A0%20&amp;%200%20&amp;%200%20&amp;%20%5Ccdots%20&amp;%201%20+%20%5Ctheta%5E2%0A%5Cend%7Bbmatrix%7D%0A"></p>
<p>대각: <img src="https://latex.codecogs.com/png.latex?(1+%5Ctheta%5E2)%5Csigma%5E2">, lag-1: <img src="https://latex.codecogs.com/png.latex?-%5Ctheta%5Csigma%5E2">, lag <img src="https://latex.codecogs.com/png.latex?%5Cgeq%202">: 0.</p>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
MA(1) 의 직관 — “hard cutoff”
</div>
</div>
<div class="callout-body-container callout-body">
<p>lag-1 만 상관 있고 그 이상은 정확히 0. AR(1) 의 점진적 감쇠와 대비.</p>
<p><strong>왜 CPM 에는 안 쓰고 MRM-AC 에만 쓰는가</strong>:</p>
<ul>
<li>CPM 의 marginal <img src="https://latex.codecogs.com/png.latex?V(y)"> 에 hard cutoff 는 <strong>부자연</strong> — 임상 데이터에서 lag-2 의 상관이 정확히 0 이라는 가정이 비현실적.</li>
<li>MRM-AC 의 conditional <img src="https://latex.codecogs.com/png.latex?V(%5Cvarepsilon)"> 에서는 <strong>합리</strong> — 랜덤 효과 (<img src="https://latex.codecogs.com/png.latex?%5Cupsilon_i">) 를 빼고 남은 잔차에서 단 lag-1 의존만 있을 수 있음.</li>
</ul>
<p>이런 차이가 CPM 의 5 구조에는 MA(1) 가 없고 MRM-AC 의 5 구조에 포함된 이유.</p>
</div>
</div>
</section>
<section id="arma11-lag-1-강조-후속-감쇠" class="level2" data-number="4.4">
<h2 data-number="4.4" class="anchored" data-anchor-id="arma11-lag-1-강조-후속-감쇠"><span class="header-section-number">4.4</span> ARMA(1,1) — lag-1 강조 + 후속 감쇠</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
ARMA(1,1) 정의 (식 7.17)
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cvarepsilon_j%20=%20%5Crho%20%5Cvarepsilon_%7Bj-1%7D%20+%20%5Cxi_j%20-%20%5Ctheta%20%5Cxi_%7Bj-1%7D%0A%5Ctag%7B7.17%7D%0A"></p>
<p>3 모수 (<img src="https://latex.codecogs.com/png.latex?%5Csigma%5E2,%20%5Crho,%20%5Ctheta">). AR(1) 보다 <strong>lag-1 의 hump 가 강조</strong>.</p>
<p>행렬 형태 (간략화):</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Csigma%5E2%20%5COmega%20%5Capprox%0A%5Cbegin%7Bbmatrix%7D%0A%5Cgamma_0%20&amp;%20%5Cgamma_1%20&amp;%20%5Crho%20%5Cgamma_1%20&amp;%20%5Ccdots%20&amp;%20%5Crho%5E%7Bn-2%7D%20%5Cgamma_1%20%5C%5C%0A%5Cgamma_1%20&amp;%20%5Cgamma_0%20&amp;%20%5Cgamma_1%20&amp;%20%5Ccdots%20&amp;%20%5Crho%5E%7Bn-3%7D%20%5Cgamma_1%20%5C%5C%0A%5Cvdots%20&amp;%20&amp;%20&amp;%20%5Cddots%20&amp;%20%5C%5C%0A%5Crho%5E%7Bn-2%7D%5Cgamma_1%20&amp;%20%5Crho%5E%7Bn-3%7D%5Cgamma_1%20&amp;%20&amp;%20&amp;%20%5Cgamma_0%0A%5Cend%7Bbmatrix%7D%0A"></p>
<p>여기서 <img src="https://latex.codecogs.com/png.latex?%5Cgamma_0%20=%201%20+%20%5Ctheta%5E2%20-%202%5Crho%5Ctheta">, <img src="https://latex.codecogs.com/png.latex?%5Cgamma_1%20=%20(1%20-%20%5Crho%5Ctheta)(%5Crho%20-%20%5Ctheta)"> — Hedeker 책의 식 (7.17) 다음.</p>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
ARMA(1,1) 의 직관 — 약물 carryover 패턴
</div>
</div>
<div class="callout-body-container callout-body">
<p>AR(1) 와 MA(1) 를 결합 → lag-1 에서 <strong>추가 hump</strong>, 그 이후 AR(1) 처럼 지수 감쇠.</p>
<p><strong>적합 시나리오</strong>: 약물 단기 carryover 효과처럼 인접 시점에 매우 강한 상관이 있고 이후 빠르게 감쇠. AR(1) 만으로는 lag-1 의 강도를 잡지 못하는 경우.</p>
</div>
</div>
</section>
<section id="toeplitz-lag-별-자유" class="level2" data-number="4.5">
<h2 data-number="4.5" class="anchored" data-anchor-id="toeplitz-lag-별-자유"><span class="header-section-number">4.5</span> Toeplitz — lag 별 자유</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Toeplitz 자기상관 (식 7.13 다음)
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Csigma%5E2%20%5COmega%20=%20%5Csigma%5E2%0A%5Cbegin%7Bbmatrix%7D%0A1%20&amp;%20%5Crho_1%20&amp;%20%5Crho_2%20&amp;%20%5Ccdots%20&amp;%20%5Crho_%7Bn-1%7D%20%5C%5C%0A%5Crho_1%20&amp;%201%20&amp;%20%5Crho_1%20&amp;%20%5Ccdots%20&amp;%20%5Crho_%7Bn-2%7D%20%5C%5C%0A%5Crho_2%20&amp;%20%5Crho_1%20&amp;%201%20&amp;%20%5Ccdots%20&amp;%20%5Crho_%7Bn-3%7D%20%5C%5C%0A%5Cvdots%20&amp;%20%5Cvdots%20&amp;%20%5Cvdots%20&amp;%20%5Cddots%20&amp;%20%5Cvdots%20%5C%5C%0A%5Crho_%7Bn-1%7D%20&amp;%20%5Crho_%7Bn-2%7D%20&amp;%20%5Crho_%7Bn-3%7D%20&amp;%20%5Ccdots%20&amp;%201%0A%5Cend%7Bbmatrix%7D%0A"></p>
<p>각 lag 의 상관 <img src="https://latex.codecogs.com/png.latex?%5Crho_s"> 가 자유 모수. 모수 수: <img src="https://latex.codecogs.com/png.latex?n%20-%201"> (또는 절약 Toeplitz <img src="https://latex.codecogs.com/png.latex?s"> 개).</p>
<p>higher-order lag 를 0 으로 묶어 모수 수 감소: <img src="https://latex.codecogs.com/png.latex?%5Crho_1,%20%5Cldots,%20%5Crho_s,%200,%200,%20%5Cldots,%200">.</p>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Toeplitz 의 직관 — 비단조 패턴
</div>
</div>
<div class="callout-body-container callout-body">
<p>AR(1) 의 지수 감쇠 강제, MA(1) 의 hard cutoff 모두 부족할 때.</p>
<p><strong>적합 시나리오</strong>: lag 별 상관이 비단조 (예: 주기적, 세번째 시점에서 다시 강해지는 패턴). 시계열 분석에서 ACF 그림이 단순하지 않을 때.</p>
</div>
</div>
</section>
<section id="ns-ar1-비정상" class="level2" data-number="4.6">
<h2 data-number="4.6" class="anchored" data-anchor-id="ns-ar1-비정상"><span class="header-section-number">4.6</span> NS-AR(1) — 비정상</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Non-Stationary AR(1)
</div>
</div>
<div class="callout-body-container callout-body">
<p>기본 AR(1) 의 정상성 가정 (분산 시점 무관) 을 풀어 분산이 시점에 따라 변동.</p>
<p>Cholesky factorization 으로 구현 (식 7.19 등). 분산이 시간에 따라 단조 증가하는 형태.</p>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
NS-AR(1) 의 직관 — 학습 효과 누적
</div>
</div>
<div class="callout-body-container callout-body">
<p>처치 효과 누적, baseline 으로부터 멀어질수록 분산이 커지는 패턴 (Bock WPSS 데이터의 fan-out 패턴과 유사).</p>
<p>기본 AR(1) 의 정상성을 깨면서도 lag 의 지수 감쇠 구조는 유지하는 절충.</p>
</div>
</div>
</section>
</section>
<section id="모형-선택-lr-검정aicbic" class="level1" data-number="5">
<h1 data-number="5"><span class="header-section-number">5</span> § 7.3 — 모형 선택: LR 검정·AIC·BIC</h1>
<section id="세-모형-패러다임의-비교" class="level2" data-number="5.1">
<h2 data-number="5.1" class="anchored" data-anchor-id="세-모형-패러다임의-비교"><span class="header-section-number">5.1</span> 세 모형 패러다임의 비교</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
CPM vs MRM vs MRM-AC
</div>
</div>
<div class="callout-body-container callout-body">
<p>같은 데이터에 세 종류의 분산-공분산 구조를 적합 가능:</p>
<table class="table">
<colgroup>
<col style="width: 19%">
<col style="width: 29%">
<col style="width: 32%">
<col style="width: 19%">
</colgroup>
<thead>
<tr class="header">
<th>모형</th>
<th><img src="https://latex.codecogs.com/png.latex?V(y_i)"></th>
<th>자유 모수</th>
<th>강점</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><strong>MRM</strong> (Ch.4-5)</td>
<td><img src="https://latex.codecogs.com/png.latex?Z_i%5CSigma_%5Cupsilon%20Z_i%5E%5Ctop%20+%20%5Csigma%5E2%20I"></td>
<td><img src="https://latex.codecogs.com/png.latex?r(r+1)/2%20+%201"></td>
<td>개인별 추론 (BLUP)</td>
</tr>
<tr class="even">
<td><strong>CPM</strong> (Ch.6)</td>
<td>5 구조 중 직접 명세</td>
<td>구조 의존</td>
<td>분산 구조 자체 모형화</td>
</tr>
<tr class="odd">
<td><strong>MRM + AC</strong> (Ch.7)</td>
<td><img src="https://latex.codecogs.com/png.latex?Z_i%5CSigma_%5Cupsilon%20Z_i%5E%5Ctop%20+%20%5Csigma%5E2%20%5COmega_i"></td>
<td>MRM + <img src="https://latex.codecogs.com/png.latex?%5COmega"> 모수</td>
<td>둘 다</td>
</tr>
</tbody>
</table>
<p><strong>핵심 통찰</strong>: 세 모형이 종종 <strong>비슷한 적합도</strong> 를 줄 수 있다. 예를 들어 Toeplitz CPM 과 MRM-AC(Toeplitz) 가 reparameterization 으로 동치일 수 있음 (랜덤 효과를 디자인에 흡수).</p>
<p>선택 기준은 통계적 적합도뿐 아니라 <strong>해석의 자연스러움</strong>:</p>
<ul>
<li>개인별 추세 해석이 본질이면 → MRM 또는 MRM-AC.</li>
<li>분산 구조 자체가 연구 질문이면 → CPM.</li>
<li>둘 다 필요하면 → MRM-AC.</li>
</ul>
</div>
</div>
</section>
<section id="lr-검정-식-7.22" class="level2" data-number="5.2">
<h2 data-number="5.2" class="anchored" data-anchor-id="lr-검정-식-7.22"><span class="header-section-number">5.2</span> LR 검정 (식 7.22)</h2>
<p>내포 (nested) 모형 비교:</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cchi%5E2%20=%20-2%5Clog%5Chat%20L_%7B%5Ctext%7Breduced%7D%7D%20-%20(-2%5Clog%5Chat%20L_%7B%5Ctext%7Bfull%7D%7D)%20=%202(%5Clog%5Chat%20L_%7B%5Ctext%7Bfull%7D%7D%20-%20%5Clog%5Chat%20L_%7B%5Ctext%7Breduced%7D%7D)%0A%5Ctag%7B7.22%7D%0A"></p>
<p>자유도 = full vs reduced 의 모수 수 차이.</p>
<section id="분산-모수-검정의-boundary-보정" class="level3" data-number="5.2.1">
<h3 data-number="5.2.1" class="anchored" data-anchor-id="분산-모수-검정의-boundary-보정"><span class="header-section-number">5.2.1</span> 분산 모수 검정의 boundary 보정</h3>
<p><a href="../../../../../docs/blog/posts/Statistics/LDA/06-5-cpm-model-selection.html">§ 6.3 모형 선택 sub-post</a> 에서 자세히 다룬 내용 — 본 chapter 에도 동일 적용.</p>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
p-value/2 보정
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?%5Crho%20=%200">, <img src="https://latex.codecogs.com/png.latex?%5Csigma_%5Cupsilon%5E2%20=%200"> 같은 분산 모수 검정은 모수 공간 경계 (boundary) 가설. 표준 <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2"> 점근 분포가 부정확 → mixture 분포.</p>
<p><strong>실용 보정 (Snijders &amp; Bosker, 1999; Berkhof &amp; Snijders, 2001)</strong>: 일반 LR p-value 를 <strong>2 로 나눔</strong>.</p>
<ul>
<li>적용: <img src="https://latex.codecogs.com/png.latex?%5Crho%20=%200"> (AC 추가 검정), <img src="https://latex.codecogs.com/png.latex?%5Csigma_%5Cupsilon%5E2%20=%200"> (랜덤 효과 추가 검정).</li>
<li>적용 제외: 회귀 계수 검정 (모수 공간 경계 아님).</li>
</ul>
</div>
</div>
</section>
</section>
<section id="aic-bic-식-7.23-7.24" class="level2" data-number="5.3">
<h2 data-number="5.3" class="anchored" data-anchor-id="aic-bic-식-7.23-7.24"><span class="header-section-number">5.3</span> AIC, BIC (식 7.23-7.24)</h2>
<p>내포되지 않은 모형 비교 (예: MRM-AR(1) vs CPM-Toeplitz):</p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Ctext%7BAIC%7D%20=%20-2%5Clog%5Chat%20L%20+%202p%0A%5Ctag%7B7.23%7D%0A"></p>
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Ctext%7BBIC%7D%20=%20-2%5Clog%5Chat%20L%20+%20p%20%5Clog%20N%0A%5Ctag%7B7.24%7D%0A"></p>
<p><img src="https://latex.codecogs.com/png.latex?p">: 모수 수, <img src="https://latex.codecogs.com/png.latex?N">: 표본 크기 (level-2 = 피험자 수가 표준 — Raftery 1995 권장).</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
AIC vs BIC — 분산 구조 선택에 어느 것?
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?N%20%5Cgeq%208"> 이면 (보통 성립) BIC 의 페널티 (<img src="https://latex.codecogs.com/png.latex?p%20%5Clog%20N">) 가 AIC 의 페널티 (<img src="https://latex.codecogs.com/png.latex?2p">) 보다 큼 → BIC 가 더 절약적 모형 선호.</p>
<p><strong>Fitzmaurice et al.&nbsp;(2004) 의 권고</strong>: 분산-공분산 구조 선택에 BIC 사용 자제. Toeplitz 등 자유도 큰 구조를 과도하게 페널라이즈해 정보 손실. AIC 가 더 균형적.</p>
<p><strong>실무</strong>: 둘 다 보고하되 결정은 데이터 적합도 + 해석 용이성 종합.</p>
</div>
</div>
</section>
<section id="모형-비교-시-주의-같은-데이터셋" class="level2" data-number="5.4">
<h2 data-number="5.4" class="anchored" data-anchor-id="모형-비교-시-주의-같은-데이터셋"><span class="header-section-number">5.4</span> 모형 비교 시 주의 — 같은 데이터셋</h2>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
결측 처리의 함정
</div>
</div>
<div class="callout-body-container callout-body">
<p>LR, AIC, BIC 모두 <strong>같은 데이터셋</strong> 에서 비교해야 의미.</p>
<p><strong>위반 사례</strong>: 두 모형이 다른 공변량 포함 + 그 공변량의 일부가 결측 → 두 모형이 다른 표본 크기 (결측 행 제외) 로 적합 → 우도 직접 비교 무의미.</p>
<p><strong>해결</strong>:</p>
<ul>
<li>공통 공변량만 사용.</li>
<li>또는 결측 imputation 후 비교.</li>
<li>또는 결측 없는 부분집합으로 제한.</li>
</ul>
</div>
</div>
</section>
</section>
<section id="bock-항우울제-데이터-적합-패턴" class="level1" data-number="6">
<h1 data-number="6"><span class="header-section-number">6</span> § 7.4 — Bock 항우울제 데이터 적합 패턴</h1>
<section id="데이터-ch.6-6.4-와-동일" class="level2" data-number="6.1">
<h2 data-number="6.1" class="anchored" data-anchor-id="데이터-ch.6-6.4-와-동일"><span class="header-section-number">6.1</span> 데이터 (Ch.6 § 6.4 와 동일)</h2>
<p><a href="../../../../../docs/blog/posts/Statistics/LDA/06-6-cpm-bock-example.html">Bock (1983b) WPSS 데이터</a>:</p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?N%20=%2075"> 우울증 환자, 6 주 추적, cross-over 설계.</li>
<li>TCA-None (<img src="https://latex.codecogs.com/png.latex?n%20=%2046">): 첫 3 주 약물 → 다음 3 주 무약물.</li>
<li>None-TCA (<img src="https://latex.codecogs.com/png.latex?n%20=%2029">): 첫 3 주 무약물 → 다음 3 주 약물.</li>
</ul>
<p><a href="../../../../../docs/blog/posts/Statistics/LDA/06-6-cpm-bock-example.html">직교 대비</a> (Linear trend, Change of slope) 코딩.</p>
</section>
<section id="비교한-모형들" class="level2" data-number="6.2">
<h2 data-number="6.2" class="anchored" data-anchor-id="비교한-모형들"><span class="header-section-number">6.2</span> 비교한 모형들</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Hedeker 본문에서 적합한 모형 패턴
</div>
</div>
<div class="callout-body-container callout-body">
<table class="table">
<colgroup>
<col style="width: 22%">
<col style="width: 48%">
<col style="width: 29%">
</colgroup>
<thead>
<tr class="header">
<th>모형</th>
<th>분산-공분산</th>
<th>모수 수</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Random intercept + slope (Ch.5)</td>
<td><img src="https://latex.codecogs.com/png.latex?Z%5CSigma_%5Cupsilon%20Z%5E%5Ctop%20+%20%5Csigma%5E2%20I"></td>
<td>4 (= 3 + 1)</td>
</tr>
<tr class="even">
<td>MRM + AR(1)</td>
<td><img src="https://latex.codecogs.com/png.latex?Z%5CSigma_%5Cupsilon%20Z%5E%5Ctop%20+%20%5Csigma%5E2%20%5COmega_%7B%5Ctext%7BAR(1)%7D%7D"></td>
<td>5 (= 4 + 1)</td>
</tr>
<tr class="odd">
<td>MRM + ARMA(1,1)</td>
<td><img src="https://latex.codecogs.com/png.latex?Z%5CSigma_%5Cupsilon%20Z%5E%5Ctop%20+%20%5Csigma%5E2%20%5COmega_%7B%5Ctext%7BARMA%7D%7D"></td>
<td>6</td>
</tr>
<tr class="even">
<td>MRM + Toeplitz</td>
<td><img src="https://latex.codecogs.com/png.latex?Z%5CSigma_%5Cupsilon%20Z%5E%5Ctop%20+%20%5Csigma%5E2%20%5COmega_%7B%5Ctext%7BToep%7D%7D"></td>
<td><img src="https://latex.codecogs.com/png.latex?4%20+%20n"></td>
</tr>
</tbody>
</table>
<p>(정확한 deviance 수치는 § 7.4 sub-post 가 작성되면 거기서 다룸 — Bock 데이터의 정밀 재현은 본 overview 의 범위를 넘음.)</p>
</div>
</div>
</section>
<section id="일반적-결과-패턴" class="level2" data-number="6.3">
<h2 data-number="6.3" class="anchored" data-anchor-id="일반적-결과-패턴"><span class="header-section-number">6.3</span> 일반적 결과 패턴</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Bock 데이터에서 흔히 관찰되는 패턴
</div>
</div>
<div class="callout-body-container callout-body">
<p>Hedeker 본문 + 후속 분석들에서:</p>
<ul>
<li><strong>Random intercept + slope 만 (Ch.5)</strong>: baseline 적합. 6 주 우울증 추적의 큰 부분 (개인별 변동) 잡음.</li>
<li><strong>+ AR(1)</strong>: <img src="https://latex.codecogs.com/png.latex?%5Chat%5Crho%20%5Capprox%200.2%20%5Csim%200.3">, LR <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_1%20%5Capprox%202%20%5Csim%205">, p-value 약간 유의. 모수 1 추가로 적합도 약간 개선.</li>
<li><strong>+ ARMA(1,1)</strong>: AR(1) 와 거의 차이 없음 (lag-1 의 추가 분리가 데이터에서 잡히지 않음).</li>
<li><strong>+ Toeplitz</strong>: 자유도 많아 적합도 가장 높지만 AIC 페널티로 손해.</li>
</ul>
<p><strong>최종 모형 선택</strong>: AIC 기준 보통 AR(1) 가 우위. 해석도 가장 단순.</p>
<p><strong>Fixed effects 의 강건성</strong>: Linear, Change of slope 의 추정값이 분산 구조에 거의 무관하게 안정적 — <strong>회귀 계수의 점추정은 분산 구조 선택에 강건</strong>. 단 SE 와 검정 결과는 영향.</p>
</div>
</div>
</section>
<section id="자기상관-모수의-임상-의미" class="level2" data-number="6.4">
<h2 data-number="6.4" class="anchored" data-anchor-id="자기상관-모수의-임상-의미"><span class="header-section-number">6.4</span> 자기상관 모수의 임상 의미</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<img src="https://latex.codecogs.com/png.latex?%5Chat%5Crho"> 가 의미하는 것 — Bock 데이터 예
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?%5Chat%5Crho%20%5Capprox%200.25"> 라면:</p>
<ul>
<li>어제 오차의 25% 만큼이 오늘 오차에 carry over.</li>
<li>즉 <strong>랜덤 효과 (피험자별 trend) 를 제거하고 남은 잔차에서, 인접 주차 간 상관이 약 0.25</strong>.</li>
<li>2 주 간격: <img src="https://latex.codecogs.com/png.latex?0.25%5E2%20%5Capprox%200.06"> (거의 무관).</li>
<li>3 주 이상: 사실상 0.</li>
</ul>
<p><strong>임상 해석</strong>: 주 단위 측정에서 단기 momentum 은 약함 — 일별 측정이었다면 더 강한 자기상관 예상. 주별 임상 평가에서는 <strong>랜덤 효과가 더 큰 의존성 통로</strong>.</p>
<p><strong>검정</strong>: <img src="https://latex.codecogs.com/png.latex?H_0:%20%5Crho%20=%200"> (표준 MRM) vs <img src="https://latex.codecogs.com/png.latex?H_1:%20%5Crho%20%5Cneq%200"> (MRM + AR(1)). LR <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_1">, p-value/2 보정 적용. 유의하면 AC 추가 정당화.</p>
</div>
</div>
</section>
</section>
<section id="통합-워크플로-5-단계" class="level1" data-number="7">
<h1 data-number="7"><span class="header-section-number">7</span> 통합 워크플로 — 5 단계</h1>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
자기상관 검토를 포함한 종단 분석 절차
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>1. 표준 MRM 적합</strong> — 랜덤 절편 (필요 시 + 기울기). Ch.4-5 절차.</p>
<p><strong>2. 잔차 진단</strong> — 잔차의 ACF/PACF 도표 + Ljung-Box 검정. 유의한 자기상관 여부 확인.</p>
<p><strong>3. 자기상관 구조 후보</strong> — ACF/PACF 패턴으로:</p>
<ul>
<li>지수 감쇠 → AR(1)</li>
<li>lag-1 만 → MA(1)</li>
<li>lag-1 강 + 빠른 감쇠 → ARMA(1,1)</li>
<li>비단조 → Toeplitz</li>
<li>분산 시간 증가 → NS-AR(1)</li>
</ul>
<p><strong>4. 후보 모형 적합 + 비교</strong> — AIC + LR. 구조 1-2 개로 좁힘.</p>
<p><strong>5. 최종 보고</strong>:</p>
<ul>
<li>분산-공분산 구조 명시.</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Chat%5Crho"> (또는 다른 AC 모수) 와 SE.</li>
<li>Fixed effects 의 robust 검증 (분산 구조 변경 시 변화 비교).</li>
</ul>
</div>
</div>
</section>
<section id="코드-예시" class="level1" data-number="8">
<h1 data-number="8"><span class="header-section-number">8</span> 코드 예시</h1>
<section id="r-nlme-표준-도구" class="level2" data-number="8.1">
<h2 data-number="8.1" class="anchored" data-anchor-id="r-nlme-표준-도구"><span class="header-section-number">8.1</span> R <code>nlme</code> — 표준 도구</h2>
<div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb3-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(nlme)</span>
<span id="cb3-2"></span>
<span id="cb3-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 1. 표준 MRM (랜덤 절편 + 기울기, 조건부 독립)</span></span>
<span id="cb3-4">fit_mrm <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">lme</span>(score <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> Linear <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> SlopeChange,</span>
<span id="cb3-5">               <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">random =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> Linear <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> subject,</span>
<span id="cb3-6">               <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> bock,</span>
<span id="cb3-7">               <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">method =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"ML"</span>)</span>
<span id="cb3-8"></span>
<span id="cb3-9"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 2. + AR(1) 오차</span></span>
<span id="cb3-10">fit_ar1 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">update</span>(fit_mrm,</span>
<span id="cb3-11">                  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">correlation =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">corAR1</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">form =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> week <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> subject))</span>
<span id="cb3-12"></span>
<span id="cb3-13"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 3. + MA(1) 오차 (corARMA p=0, q=1)</span></span>
<span id="cb3-14">fit_ma1 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">update</span>(fit_mrm,</span>
<span id="cb3-15">                  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">correlation =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">corARMA</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">form =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> week <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> subject, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">p =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">q =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>))</span>
<span id="cb3-16"></span>
<span id="cb3-17"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 4. + ARMA(1,1)</span></span>
<span id="cb3-18">fit_arma <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">update</span>(fit_mrm,</span>
<span id="cb3-19">                   <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">correlation =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">corARMA</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">form =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> week <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> subject, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">p =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">q =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>))</span>
<span id="cb3-20"></span>
<span id="cb3-21"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 5. + Toeplitz (corARMA p=0, q=n-1)</span></span>
<span id="cb3-22">fit_toep <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">update</span>(fit_mrm,</span>
<span id="cb3-23">                   <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">correlation =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">corARMA</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">form =</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> week <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> subject, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">p =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">q =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>))</span>
<span id="cb3-24"></span>
<span id="cb3-25"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># AIC + LR 비교</span></span>
<span id="cb3-26"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">AIC</span>(fit_mrm, fit_ar1, fit_ma1, fit_arma, fit_toep)</span>
<span id="cb3-27"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">anova</span>(fit_mrm, fit_ar1)        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># LR for AR(1) vs no-AC</span></span>
<span id="cb3-28"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">anova</span>(fit_ar1, fit_arma)       <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># LR for ARMA vs AR(1) (nested)</span></span>
<span id="cb3-29"></span>
<span id="cb3-30"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># AR(1) 모수 추출</span></span>
<span id="cb3-31"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coef</span>(fit_ar1<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>modelStruct<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>corStruct, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">unconstrained =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span>)</span>
<span id="cb3-32"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Phi = rho_hat</span></span>
<span id="cb3-33"></span>
<span id="cb3-34"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 잔차 ACF (자기상관 진단)</span></span>
<span id="cb3-35"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">plot</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ACF</span>(fit_mrm, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">resType =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"normalized"</span>))</span></code></pre></div>
</section>
<section id="python-statsmodels-제한적" class="level2" data-number="8.2">
<h2 data-number="8.2" class="anchored" data-anchor-id="python-statsmodels-제한적"><span class="header-section-number">8.2</span> Python <code>statsmodels</code> — 제한적</h2>
<p>statsmodels <code>MixedLM</code> 은 랜덤 효과만 지원, AC 오차 직접 지원 안 함. 우회 옵션:</p>
<div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb4-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> statsmodels.api <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> sm</span>
<span id="cb4-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> statsmodels.formula.api <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> smf</span>
<span id="cb4-3"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> statsmodels.tsa.stattools <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> acf</span>
<span id="cb4-4"></span>
<span id="cb4-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 표준 MRM 적합</span></span>
<span id="cb4-6">model <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> smf.mixedlm(</span>
<span id="cb4-7">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"score ~ Linear + SlopeChange"</span>,</span>
<span id="cb4-8">    data<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>df,</span>
<span id="cb4-9">    groups<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>df[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"subject"</span>],</span>
<span id="cb4-10">    re_formula<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"~Linear"</span>,</span>
<span id="cb4-11">)</span>
<span id="cb4-12">result <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> model.fit()</span>
<span id="cb4-13"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(result.summary())</span>
<span id="cb4-14"></span>
<span id="cb4-15"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 잔차 ACF 진단</span></span>
<span id="cb4-16">residuals <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> result.resid</span>
<span id="cb4-17">acf_values <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> acf(residuals, nlags<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>)</span>
<span id="cb4-18"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"ACF (lag 1-10): </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>acf_values[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>:<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">11</span>]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb4-19"></span>
<span id="cb4-20"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># AC 가 있어 보이면 R nlme/lme4 또는 SAS PROC MIXED 로 이전 권장</span></span></code></pre></div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
도구 선택 가이드
</div>
</div>
<div class="callout-body-container callout-body">
<table class="table">
<thead>
<tr class="header">
<th>도구</th>
<th>AC 오차 지원</th>
<th>추천</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>R <code>nlme::lme</code></td>
<td>강력 (corAR1, corARMA, corCAR1 등)</td>
<td>권장</td>
</tr>
<tr class="even">
<td>R <code>lme4::lmer</code></td>
<td>직접 지원 안 함 (랜덤 효과만)</td>
<td>AC 시 nlme</td>
</tr>
<tr class="odd">
<td>R <code>glmmTMB</code></td>
<td>일부 지원 (AR1, OU 등)</td>
<td>비정규 반응 시</td>
</tr>
<tr class="even">
<td>SAS <code>PROC MIXED</code></td>
<td>강력 (<code>repeated /type=</code> 다양)</td>
<td>임상 표준</td>
</tr>
<tr class="odd">
<td>Python <code>statsmodels</code></td>
<td>직접 지원 안 함</td>
<td>진단만</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
</section>
<section id="핵심-정리" class="level1" data-number="9">
<h1 data-number="9"><span class="header-section-number">9</span> 핵심 정리</h1>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Ch.7 한 페이지 요약
</div>
</div>
<div class="callout-body-container callout-body">
<ol type="1">
<li><strong>출발점</strong>: Ch.4-5 의 MRM 은 조건부 독립 가정 (<img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon%20%5Csim%20%5Cmathcal%7BN%7D(0,%20%5Csigma%5E2%20I)">). 임상에서 자주 위반.</li>
<li><strong>확장</strong>: 단위 행렬 <img src="https://latex.codecogs.com/png.latex?I"> 를 자기상관 행렬 <img src="https://latex.codecogs.com/png.latex?%5COmega"> 로 대체 → <img src="https://latex.codecogs.com/png.latex?%5Cvarepsilon%20%5Csim%20%5Cmathcal%7BN%7D(0,%20%5Csigma%5E2%20%5COmega)">.</li>
<li><strong>결합 모형</strong>: <img src="https://latex.codecogs.com/png.latex?V(y_i)%20=%20Z_i%5CSigma_%5Cupsilon%20Z_i%5E%5Ctop%20+%20%5Csigma%5E2%20%5COmega_i"> — 두 의존성 통로 (피험자 차이 + 시간 momentum) 동시 모형화.</li>
<li><strong>5 자기상관 구조</strong>: AR(1), MA(1), ARMA(1,1), Toeplitz, NS-AR(1). 각각 적합 패턴 다름.</li>
<li><strong><img src="https://latex.codecogs.com/png.latex?I%20%5Cto%20%5COmega"> 일반화</strong>: Ch.4 의 추정 식 그대로 transfer (<img src="https://latex.codecogs.com/png.latex?I"> 를 <img src="https://latex.codecogs.com/png.latex?%5COmega"> 로 대체). 새 이론 불필요.</li>
<li><strong>CPM 과의 관계</strong>: MRM-AC = CPM (Ch.6) 에 랜덤 효과 추가. 두 패러다임의 일반 결합.</li>
<li><strong>모형 선택</strong>: LR (분산 모수는 p-value/2 보정), AIC (BIC 보다 권장 — Fitzmaurice et al.&nbsp;2004).</li>
<li><strong>세 패러다임 비교</strong>: MRM (Ch.4-5), CPM (Ch.6), MRM-AC (Ch.7) — 종종 비슷한 적합도. 해석 자연스러움이 선택 기준.</li>
<li><strong>Fixed effects 강건성</strong>: 회귀 계수 점추정은 분산 구조에 거의 무관, SE 와 검정 결과는 영향.</li>
<li><strong>Bock 패턴</strong>: AR(1) 가 default 우위, <img src="https://latex.codecogs.com/png.latex?%5Chat%5Crho%20%5Capprox%200.2%20%5Csim%200.3"> 범위 흔함. 주 단위 임상 측정에서 자기상관 약함.</li>
</ol>
<p>Ch.7 의 핵심 통찰: <strong><img src="https://latex.codecogs.com/png.latex?I%20%5Cto%20%5COmega"> 의 우아한 일반화로 종단 데이터의 두 의존성 통로 (랜덤 효과 + 자기상관) 를 한 모형에 결합</strong>. 가장 유연한 분산-공분산 구조.</p>
</div>
</div>
<table class="table">
<thead>
<tr class="header">
<th>절</th>
<th>내용</th>
<th>핵심 식</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>§ 7.1</td>
<td>Introduction — 자기상관 동기</td>
<td>(7.1)-(7.2)</td>
</tr>
<tr class="even">
<td>§ 7.2</td>
<td>MRM with AC errors + 5 구조</td>
<td>(7.3)</td>
</tr>
<tr class="odd">
<td>§ 7.3</td>
<td>Model selection (LR/AIC/BIC)</td>
<td>(7.22)-(7.24)</td>
</tr>
<tr class="even">
<td>§ 7.4</td>
<td>Bock antidepressant 예제</td>
<td>—</td>
</tr>
</tbody>
</table>
</section>
<section id="다음-단계-ch.7-시리즈" class="level1" data-number="10">
<h1 data-number="10"><span class="header-section-number">10</span> 다음 단계 — Ch.7 시리즈</h1>
<table class="table">
<thead>
<tr class="header">
<th>주제</th>
<th>위치</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Ch.7 § 7.1 도입</td>
<td>본 overview 흡수</td>
</tr>
<tr class="even">
<td>Ch.7 § 7.2 — 5 구조 상세</td>
<td><a href="../../../../../docs/blog/posts/Statistics/LDA/07-1-mrm-autocorrelated-errors.html">§ 7.2 sub-post</a> (작성됨)</td>
</tr>
<tr class="odd">
<td>Ch.7 § 7.3 — 모형 선택</td>
<td><a href="../../../../../docs/blog/posts/Statistics/LDA/06-5-cpm-model-selection.html">§ 6.3 모형 선택 sub-post</a> 와 통합 가능 (Ch.6·7 공통 절차)</td>
</tr>
<tr class="even">
<td>Ch.7 § 7.4 — Bock 분석 sub-post</td>
<td>작성 예정 (<code>07-2-cpm-bock-ac-example.qmd</code>)</td>
</tr>
<tr class="odd">
<td>Ch.8 GEE</td>
<td>미작성 — CPM 의 비정규 일반화</td>
</tr>
</tbody>
</table>
</section>
<section id="관련-주제" class="level1" data-number="11">
<h1 data-number="11"><span class="header-section-number">11</span> 관련 주제</h1>
<p><strong>선행 지식</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/04-2-random-intercept-mrm.html">§ 4.2 — 랜덤 절편 MRM</a> — Ch.4 출발점</li>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/04-3-random-intercept-trend-mrm.html">§ 4.3 — 랜덤 절편·추세 MRM</a> — Ch.5 일반화</li>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/04-4-matrix-formulation-mrm.html">§ 4.4 — MRM 행렬 공식화</a> — 마진 분산</li>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/04-5-mrm-estimation.html">§ 4.5 — MRM 추정론</a> — ML/REML/EM/Fisher Scoring</li>
</ul>
<p><strong>Ch.6 시리즈</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/06-0-mrm-covariance-pattern-overview.html">Ch.6 Overview — CPM</a></li>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/06-2-cpm-cs-ar1.html">§ 6.2.1-6.2.2 — CS·AR(1)</a> — Ch.6 의 AR(1) (생물통계 표기)</li>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/06-3-cpm-toeplitz-un.html">§ 6.2.3-6.2.4 — Toeplitz·UN</a></li>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/06-4-cpm-re-structure.html">§ 6.2.5 — RE 구조</a> — MRM 등가</li>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/06-5-cpm-model-selection.html">§ 6.3 — 모형 선택</a> — 본 chapter § 7.3 과 공유</li>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/06-6-cpm-bock-example.html">§ 6.4 — Bock 예시</a> — 본 chapter § 7.4 와 같은 데이터</li>
</ul>
<p><strong>후속 주제</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/LDA/07-1-mrm-autocorrelated-errors.html">§ 7.2 — AR(1)·MA(1)·ARMA(1,1)·Toeplitz·NS-AR(1)</a> — 5 구조 상세</li>
<li>Ch.8 GEE (미작성) — 비정규 marginal 모형</li>
<li>mm-08 GEE intro — <a href="../../../../../docs/blog/posts/Statistics/LDA/mm-08-mixed-model-gee-intro.html">GEE 개요</a></li>
<li>mm-05 GLMM intro — <a href="../../../../../docs/blog/posts/Statistics/LDA/mm-05-mixed-model-glmm-intro.html">GLMM 개요</a></li>
</ul>
<p><strong>교재</strong></p>
<ul>
<li>Hedeker, D. &amp; Gibbons, R. D. (2006). <em>Longitudinal Data Analysis</em>, Wiley, Ch.7 (pp.&nbsp;113-129)</li>
<li>Chi, E. M. &amp; Reinsel, G. C. (1989). “Models for longitudinal data with random effects and AR(1) errors”, <em>JASA</em> 84, 452-459 — MRM-AR(1) 의 표준 reference</li>
<li>MaCurdy, T. E. (1982). “The use of time series processes to model the error structure of earnings in a longitudinal data analysis”, <em>Journal of Econometrics</em> 18, 83-114 — 계량경제 출처</li>
<li>Verbeke, G. &amp; Molenberghs, G. (2000). <em>Linear Mixed Models for Longitudinal Data</em>, Springer — boundary 분포 표준 reference</li>
<li>Berkhof, J. &amp; Snijders, T. A. B. (2001). “Variance component testing in multilevel models”, <em>Journal of Educational and Behavioral Statistics</em> 26, 133-152 — p-value/2 보정 분석</li>
<li>Fitzmaurice, G. M., Laird, N. M. &amp; Ware, J. H. (2004). <em>Applied Longitudinal Analysis</em>, Wiley — AIC vs BIC 권고</li>
<li>Akaike, H. (1973). “Information theory and an extension of the maximum likelihood principle”, <em>2nd International Symposium on Information Theory</em>, 267-281</li>
<li>Schwarz, G. (1978). “Estimating the dimension of a model”, <em>Annals of Statistics</em> 6, 461-464</li>
<li>Raftery, A. E. (1995). “Bayesian model selection in social research”, <em>Sociological Methodology</em> 25, 111-163 — BIC 의 <img src="https://latex.codecogs.com/png.latex?N"> = level-2 권장</li>
<li>Jones, R. H. &amp; Boadi-Boateng, F. (1991). “Unequally spaced longitudinal data with AR(1) serial correlation”, <em>Biometrics</em> 47, 161-175 — 불등간격 확장</li>
</ul>


</section>

 ]]></description>
  <category>Statistics</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Statistics/LDA/07-0-mrm-autocorrelated-overview.html</guid>
  <pubDate>Wed, 13 May 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Klein Appendix B — Large-Sample Tests Based on Likelihood Theory</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Statistics/survival/15-klein-appendix-b-likelihood-tests.html</link>
  <description><![CDATA[ 





<section id="도입-같은-가설을-보는-세-가지-시선" class="level2" data-number="1">
<h2 data-number="1" class="anchored" data-anchor-id="도입-같은-가설을-보는-세-가지-시선"><span class="header-section-number">1</span> 도입 — 같은 가설을 보는 세 가지 시선</h2>
<p>귀무가설 <img src="https://latex.codecogs.com/png.latex?H_0:%20%5Ctheta%20=%20%5Ctheta_0"> 을 검정할 때 가능도 이론은 세 가지 통계량을 제공한다 — Likelihood Ratio (LR), Wald, Rao Score. 셋 다 <img src="https://latex.codecogs.com/png.latex?H_0"> 하에서 점근적으로 <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_p"> 분포를 따라 같은 결정을 주지만, <strong>각자 다른 양을 측정</strong> 한다.</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 세 검정의 기하학
</div>
</div>
<div class="callout-body-container callout-body">
<p>우도 함수 <img src="https://latex.codecogs.com/png.latex?%5Cell(%5Ctheta)%20=%20%5Clog%20L(%5Ctheta)"> 의 그래프를 떠올린다. 최대값 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Ctheta%7D"> 와 가설값 <img src="https://latex.codecogs.com/png.latex?%5Ctheta_0"> 가 표시되어 있다.</p>
<p><strong>1. Likelihood Ratio (LR)</strong>: “MLE 의 우도와 가설값의 우도 차이를 본다.” 우도 곡선의 <strong>세로 방향</strong> 거리. <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_%7BLR%7D%20=%20-2%5B%5Cell(%5Ctheta_0)%20-%20%5Cell(%5Chat%7B%5Ctheta%7D)%5D">. 두 점의 높이 차이.</p>
<p><strong>2. Wald</strong>: “MLE 가 가설값에서 얼마나 멀리 떨어졌나.” 우도 곡선의 <strong>가로 방향</strong> 거리. <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_W%20=%20(%5Chat%7B%5Ctheta%7D%20-%20%5Ctheta_0)%5Et%20I(%5Chat%7B%5Ctheta%7D)%20(%5Chat%7B%5Ctheta%7D%20-%20%5Ctheta_0)">. 정보 행렬로 정규화한 거리.</p>
<p><strong>3. Score (Rao)</strong>: “가설값에서 우도의 기울기가 0 에서 얼마나 벗어났나.” 우도 곡선의 <strong>기울기</strong>. <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_S%20=%20U(%5Ctheta_0)%5Et%20I%5E%7B-1%7D(%5Ctheta_0)%20U(%5Ctheta_0)">. 가설값의 score 노름.</p>
<p>세 양은 우도 곡선의 다른 측면을 본다:</p>
<pre><code>ℓ(θ)
 │     ●  ← ℓ(θ̂) (MLE)
 │   ╱
 │  ╱
 │ ╱   ← LR = 2(높이 차이)
 │╱   /
 │   /
 ●  ●  ← ℓ(θ₀) (귀무가설 점)
 │   ↑
 │   기울기 = U(θ₀)  ← Score
 │
 └────●─────●──→ θ
     θ₀    θ̂
        ↑
        Wald = (θ̂ - θ₀) × 곡률</code></pre>
<p><strong>우도가 정확히 quadratic 이면 셋이 같은 값</strong>. 비대칭 또는 곡률 변화가 있으면 다른 값. 작은 표본에서 차이가 클 수 있고, 큰 표본에서 점근적으로 일치.</p>
</div>
</div>
<p>본 포스트는 식 B.1-B.6 (단순 가설) 과 식 B.10-B.14 (복합 가설) 을 직관과 함께 풀이하고, Klein 의 두 지수 분포 예제로 수치 결과를 확인한다.</p>
</section>
<section id="표기-score-fisher-information-observed-information" class="level2" data-number="2">
<h2 data-number="2" class="anchored" data-anchor-id="표기-score-fisher-information-observed-information"><span class="header-section-number">2</span> 표기 — Score, Fisher Information, Observed Information</h2>
<section id="efficient-score-vector-식-b.1" class="level3" data-number="2.1">
<h3 data-number="2.1" class="anchored" data-anchor-id="efficient-score-vector-식-b.1"><span class="header-section-number">2.1</span> Efficient Score Vector — 식 (B.1)</h3>
<p>데이터 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BY%7D"> 와 모수 <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Ctheta%7D%20=%20(%5Ctheta_1,%20%5Cldots,%20%5Ctheta_p)">. 로그 우도 <img src="https://latex.codecogs.com/png.latex?%5Cell(%5Cboldsymbol%7B%5Ctheta%7D;%20%5Cmathbf%7BY%7D)%20=%20%5Clog%20L(%5Cboldsymbol%7B%5Ctheta%7D;%20%5Cmathbf%7BY%7D)">.</p>
<p>Efficient score (또는 score function):</p>
<p><img src="https://latex.codecogs.com/png.latex?%20U_j(%5Cboldsymbol%7B%5Ctheta%7D)%20=%20%5Cfrac%7B%5Cpartial%20%5Cell(%5Cboldsymbol%7B%5Ctheta%7D;%20%5Cmathbf%7BY%7D)%7D%7B%5Cpartial%20%5Ctheta_j%7D%20,%20%5Cquad%20j%20=%201,%20%5Cldots,%20p%20.%20%5Ctag%7B%EC%8B%9D%20B.1%7D%20"></p>
<p>벡터 형태: <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BU%7D(%5Cboldsymbol%7B%5Ctheta%7D)%20=%20(U_1,%20%5Cldots,%20U_p)%5Et">.</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — Score 가 측정하는 것
</div>
</div>
<div class="callout-body-container callout-body">
<p>Score <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BU%7D(%5Cboldsymbol%7B%5Ctheta%7D)"> 는 <strong>우도 함수의 기울기</strong>. <img src="https://latex.codecogs.com/png.latex?%5Ctheta_j"> 를 약간 늘리면 로그 우도가 얼마나 변하는지를 알려준다.</p>
<p><strong>핵심 성질</strong> (정칙 조건 하):</p>
<p><img src="https://latex.codecogs.com/png.latex?%20E_%7B%5Cboldsymbol%7B%5Ctheta%7D%7D%5B%5Cmathbf%7BU%7D(%5Cboldsymbol%7B%5Ctheta%7D)%5D%20=%20%5Cmathbf%7B0%7D%20.%20"></p>
<p>즉 진짜 모수 값 <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Ctheta%7D"> 에서 score 의 기댓값은 0. <strong>이게 MLE 의 출발점</strong> — score 영점이 진짜 모수의 자연스러운 추정량.</p>
<p>MLE 의 정의: <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BU%7D(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D)%20=%20%5Cmathbf%7B0%7D"> 의 해 (정칙 조건 하). <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D"> 는 식 B.1 영점 찾기 — 정확히 부록 A 의 수치 최적화 문제.</p>
</div>
</div>
</section>
<section id="fisher-information-matrix-식-b.2" class="level3" data-number="2.2">
<h3 data-number="2.2" class="anchored" data-anchor-id="fisher-information-matrix-식-b.2"><span class="header-section-number">2.2</span> Fisher Information Matrix — 식 (B.2)</h3>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7Bi%7D(%5Cboldsymbol%7B%5Ctheta%7D)%20=%20E_%7B%5Cboldsymbol%7B%5Ctheta%7D%7D%5C!%5Cleft%5B%5Cmathbf%7BU%7D(%5Cboldsymbol%7B%5Ctheta%7D)%20%5Cmathbf%7BU%7D(%5Cboldsymbol%7B%5Ctheta%7D)%5Et%5Cright%5D%20=%20-E_%7B%5Cboldsymbol%7B%5Ctheta%7D%7D%5C!%5Cleft%5B%5Cfrac%7B%5Cpartial%20%5Cmathbf%7BU%7D(%5Cboldsymbol%7B%5Ctheta%7D)%7D%7B%5Cpartial%20%5Cboldsymbol%7B%5Ctheta%7D%7D%5Cright%5D%20=%20%5Cleft%5C%7B-E_%7B%5Cboldsymbol%7B%5Ctheta%7D%7D%5C!%5Cleft%5B%5Cfrac%7B%5Cpartial%5E2%20%5Cell%7D%7B%5Cpartial%20%5Ctheta_j%20%5Cpartial%20%5Ctheta_k%7D%5Cright%5D%5Cright%5C%7D_%7Bj,k%7D%20.%20%5Ctag%7B%EC%8B%9D%20B.2%7D%20"></p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Fisher information 의 두 동치 정의
</div>
</div>
<div class="callout-body-container callout-body">
<p>식 (B.2) 에 두 가지 동치 표현이 있다:</p>
<p><strong>Outer-product 형식</strong>: <img src="https://latex.codecogs.com/png.latex?E%5B%5Cmathbf%7BU%7D%20%5Cmathbf%7BU%7D%5Et%5D"> — score 의 분산.</p>
<p><strong>Hessian 형식</strong>: <img src="https://latex.codecogs.com/png.latex?-E%5B%5Cpartial%5E2%20%5Cell%20/%20%5Cpartial%20%5Cboldsymbol%7B%5Ctheta%7D%5E2%5D"> — 로그 우도의 음의 곡률 기댓값.</p>
<p>두 표현이 같음은 <strong>information identity</strong> (regularity 조건 하). 이 정체성은 score 가 평균 0 인 데서 출발 + 미분 가능 조건으로 나옴.</p>
<p><strong>왜 “정보” 인가</strong>: <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bi%7D(%5Cboldsymbol%7B%5Ctheta%7D)"> 가 클수록 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D"> 가 정확하게 추정 가능 — Cramér-Rao 부등식 <img src="https://latex.codecogs.com/png.latex?%5Ctext%7BVar%7D(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D)%20%5Cgeq%20%5Cmathbf%7Bi%7D%5E%7B-1%7D(%5Cboldsymbol%7B%5Ctheta%7D)">. 정보 행렬이 표본의 “정보량” 을 정량화.</p>
</div>
</div>
</section>
<section id="observed-information-식-b.3" class="level3" data-number="2.3">
<h3 data-number="2.3" class="anchored" data-anchor-id="observed-information-식-b.3"><span class="header-section-number">2.3</span> Observed Information — 식 (B.3)</h3>
<p>기댓값 계산이 어려우므로 (분포에 대한 적분 필요) 실용적으로는 <strong>관측 정보 행렬</strong> 사용:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20I_%7Bj,k%7D(%5Cboldsymbol%7B%5Ctheta%7D)%20=%20-%5Cfrac%7B%5Cpartial%5E2%20%5Cell(%5Cboldsymbol%7B%5Ctheta%7D;%20%5Cmathbf%7BY%7D)%7D%7B%5Cpartial%20%5Ctheta_j%20%5Cpartial%20%5Ctheta_k%7D%20,%20%5Cquad%20j,%20k%20=%201,%20%5Cldots,%20p%20.%20%5Ctag%7B%EC%8B%9D%20B.3%7D%20"></p>
<p>기댓값 없이 Hessian 의 음수만. 표본 의존이지만 <img src="https://latex.codecogs.com/png.latex?n%20%5Cto%20%5Cinfty"> 에서 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bi%7D(%5Cboldsymbol%7B%5Ctheta%7D)"> 의 일치 추정량.</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bi%7D(%5Ctheta)"> vs <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BI%7D(%5Ctheta)"> — 언제 무엇을 쓰나
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>Fisher (expected)</strong>: 분포 가정이 정확한 경우 분석적 결과 좋음. 그러나 기댓값 계산이 거의 항상 어려움.</p>
<p><strong>Observed</strong>: 표본만으로 계산 가능. 점근적으로 같은 결과. <strong>실무 표준</strong>.</p>
<p>특히 검열 데이터 (생존 분석) 에서는 Fisher information 의 기댓값이 검열 분포에 의존해 매우 복잡 — observed information 이 거의 항상 사용된다.</p>
</div>
</div>
</section>
</section>
<section id="단순-가설-h_0-boldsymboltheta-boldsymboltheta_0" class="level2" data-number="3">
<h2 data-number="3" class="anchored" data-anchor-id="단순-가설-h_0-boldsymboltheta-boldsymboltheta_0"><span class="header-section-number">3</span> 단순 가설 — <img src="https://latex.codecogs.com/png.latex?H_0:%20%5Cboldsymbol%7B%5Ctheta%7D%20=%20%5Cboldsymbol%7B%5Ctheta%7D_0"></h2>
<section id="likelihood-ratio-test-식-b.4" class="level3" data-number="3.1">
<h3 data-number="3.1" class="anchored" data-anchor-id="likelihood-ratio-test-식-b.4"><span class="header-section-number">3.1</span> Likelihood Ratio Test — 식 (B.4)</h3>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cchi%5E2_%7BLR%7D%20=%20-2%5B%5Cell(%5Cboldsymbol%7B%5Ctheta%7D_0;%20%5Cmathbf%7BY%7D)%20-%20%5Cell(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D;%20%5Cmathbf%7BY%7D)%5D%20.%20%5Ctag%7B%EC%8B%9D%20B.4%7D%20"></p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 우도의 세로 비교
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?%5Cell(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D)"> 는 데이터에 가장 잘 맞는 모형의 로그 우도 (최대값). <img src="https://latex.codecogs.com/png.latex?%5Cell(%5Cboldsymbol%7B%5Ctheta%7D_0)"> 는 가설이 옳다는 가정 하의 로그 우도.</p>
<p>차이 <img src="https://latex.codecogs.com/png.latex?%5Cell(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D)%20-%20%5Cell(%5Cboldsymbol%7B%5Ctheta%7D_0)%20%5Cgeq%200"> 가 항상 음이 아님 (MLE 가 가장 큰 우도를 줌).</p>
<p><strong>이 차이가 클수록 가설이 의심스럽다</strong>. <img src="https://latex.codecogs.com/png.latex?-2%20%5Ctimes"> 차이가 자연스럽게 <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2"> 분포로 수렴 (Wilks 정리).</p>
<p><strong>해석</strong>: “데이터를 (가설 모형 vs 일반 모형) 으로 설명할 때 우도가 얼마나 다른가?”</p>
</div>
</div>
</section>
<section id="wald-test-식-b.5" class="level3" data-number="3.2">
<h3 data-number="3.2" class="anchored" data-anchor-id="wald-test-식-b.5"><span class="header-section-number">3.2</span> Wald Test — 식 (B.5)</h3>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cchi%5E2_W%20=%20(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D%20-%20%5Cboldsymbol%7B%5Ctheta%7D_0)%5Et%20%5Cmathbf%7BI%7D(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D)%20(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D%20-%20%5Cboldsymbol%7B%5Ctheta%7D_0)%20.%20%5Ctag%7B%EC%8B%9D%20B.5%7D%20"></p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 가로 거리, 정보로 정규화
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D%20-%20%5Cboldsymbol%7B%5Ctheta%7D_0)"> 는 MLE 가 가설값에서 얼마나 떨어졌나의 <strong>벡터 거리</strong>.</p>
<p>이 거리를 그냥 쓰면 모수의 척도에 의존. <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BI%7D(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D)"> 로 정규화하면 <strong>표준편차 단위의 거리</strong> 가 된다 (정보 = 분산의 역수).</p>
<p>$^2_W = $ “MLE 와 가설값 사이의 정규화된 거리 제곱”. 큰 값 → 가설 기각.</p>
<p><strong>스칼라 <img src="https://latex.codecogs.com/png.latex?p%20=%201"> 의 경우</strong>: <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_W%20=%20(%5Chat%7B%5Ctheta%7D%20-%20%5Ctheta_0)%5E2%20/%20%5Cwidehat%7B%5Ctext%7BVar%7D%7D(%5Chat%7B%5Ctheta%7D)%20=%20z%5E2">, 일반 <img src="https://latex.codecogs.com/png.latex?z">-test 와 동치.</p>
</div>
</div>
</section>
<section id="score-test-rao-식-b.6" class="level3" data-number="3.3">
<h3 data-number="3.3" class="anchored" data-anchor-id="score-test-rao-식-b.6"><span class="header-section-number">3.3</span> Score Test (Rao) — 식 (B.6)</h3>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cchi%5E2_S%20=%20%5Cmathbf%7BU%7D(%5Cboldsymbol%7B%5Ctheta%7D_0)%5Et%20%5Cmathbf%7BI%7D%5E%7B-1%7D(%5Cboldsymbol%7B%5Ctheta%7D_0)%20%5Cmathbf%7BU%7D(%5Cboldsymbol%7B%5Ctheta%7D_0)%20.%20%5Ctag%7B%EC%8B%9D%20B.6%7D%20"></p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 가설값의 score 가 0 에서 얼마나 떨어졌나
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BU%7D(%5Cboldsymbol%7B%5Ctheta%7D_0)"> 는 “가설값에서의 우도 기울기”. 가설이 옳으면 score 가 0 근처여야 함 (MLE 정의에 의해 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BU%7D(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D)%20=%20%5Cmathbf%7B0%7D">).</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BU%7D(%5Cboldsymbol%7B%5Ctheta%7D_0)"> 가 0 에서 멀면 → 가설값이 데이터의 우도 최대점에서 떨어져 있다는 신호 → 가설 기각.</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BI%7D%5E%7B-1%7D(%5Cboldsymbol%7B%5Ctheta%7D_0)"> 로 정규화 — score 의 분산이 정보 행렬이라 정규화에 그 역수 사용 (<img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BU%7D%20%5Csim%20N(%5Cmathbf%7B0%7D,%20%5Cmathbf%7BI%7D)"> 가설 하).</p>
<p><strong>실무 큰 장점</strong>: <strong>MLE <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D"> 를 계산할 필요가 없다</strong>. 가설값 <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Ctheta%7D_0"> 만 있으면 OK. EM 같은 무거운 최적화를 피할 수 있어 매력적.</p>
<p>이 점이 § 13.2 Commenges-Andersen score test 의 매력 — frailty 모형 적합 없이 검정 가능했던 이유.</p>
</div>
</div>
</section>
<section id="점근-동등성-wilks-정리" class="level3" data-number="3.4">
<h3 data-number="3.4" class="anchored" data-anchor-id="점근-동등성-wilks-정리"><span class="header-section-number">3.4</span> 점근 동등성 — Wilks 정리</h3>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
세 통계량은 점근적으로 같다
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?H_0"> 가 옳을 때:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cchi%5E2_%7BLR%7D,%20%5Cchi%5E2_W,%20%5Cchi%5E2_S%20%5Cxrightarrow%7Bd%7D%20%5Cchi%5E2_p%20%5Cquad%20(n%20%5Cto%20%5Cinfty)%20.%20"></p>
<p>$p = $ 검정되는 모수 차원.</p>
<p><strong>증명 스케치</strong> (Wilks 정리):</p>
<ol type="1">
<li><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D"> 의 점근 분포: <img src="https://latex.codecogs.com/png.latex?%5Csqrt%7Bn%7D(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D%20-%20%5Cboldsymbol%7B%5Ctheta%7D_0)%20%5Cxrightarrow%7Bd%7D%20N(%5Cmathbf%7B0%7D,%20%5Cmathbf%7Bi%7D%5E%7B-1%7D(%5Cboldsymbol%7B%5Ctheta%7D_0))"> (MLE 점근 정규성).</li>
<li>Taylor 전개로 <img src="https://latex.codecogs.com/png.latex?%5Cell(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D)%20-%20%5Cell(%5Cboldsymbol%7B%5Ctheta%7D_0)%20%5Capprox%20%5Cfrac%7B1%7D%7B2%7D%20(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D%20-%20%5Cboldsymbol%7B%5Ctheta%7D_0)%5Et%20%5Cmathbf%7BI%7D(%5Cboldsymbol%7B%5Ctheta%7D_0)%20(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D%20-%20%5Cboldsymbol%7B%5Ctheta%7D_0)"> → <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_%7BLR%7D%20%5Capprox%20%5Cchi%5E2_W">.</li>
<li>Score 의 점근: <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BU%7D(%5Cboldsymbol%7B%5Ctheta%7D_0)%20%5Cxrightarrow%7Bd%7D%20N(%5Cmathbf%7B0%7D,%20%5Cmathbf%7Bi%7D(%5Cboldsymbol%7B%5Ctheta%7D_0))"> → <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_S%20%5Cxrightarrow%7Bd%7D%20%5Cchi%5E2_p">.</li>
<li>Taylor 전개로 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BU%7D(%5Cboldsymbol%7B%5Ctheta%7D_0)%20%5Capprox%20-%5Cmathbf%7BI%7D(%5Cboldsymbol%7B%5Ctheta%7D_0)(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D%20-%20%5Cboldsymbol%7B%5Ctheta%7D_0)"> → 점근적으로 <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_W%20=%20%5Cchi%5E2_S">.</li>
</ol>
<p><strong>결론</strong>: 큰 표본에서 셋 다 같은 결정. 작은 표본에서는 다를 수 있고, 어느 것이 더 정확한지는 우도 함수의 모양에 의존.</p>
</div>
</div>
</section>
<section id="작은-표본에서의-차이" class="level3" data-number="3.5">
<h3 data-number="3.5" class="anchored" data-anchor-id="작은-표본에서의-차이"><span class="header-section-number">3.5</span> 작은 표본에서의 차이</h3>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
우도의 비대칭이 결과를 가른다
</div>
</div>
<div class="callout-body-container callout-body">
<p>우도 함수가 정확히 quadratic 이면 세 통계량이 정확히 같다. 비대칭이거나 곡률이 모수에 따라 변하면 다르다.</p>
<table class="table">
<colgroup>
<col style="width: 33%">
<col style="width: 33%">
<col style="width: 33%">
</colgroup>
<thead>
<tr class="header">
<th>통계량</th>
<th>강점</th>
<th>약점</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><strong>LR</strong></td>
<td>변환 불변 (parametrization-invariant)</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D"> + <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Ctheta%7D_0"> 두 우도 모두 평가</td>
</tr>
<tr class="even">
<td><strong>Wald</strong></td>
<td><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D"> 만 사용 (계산 간단)</td>
<td>변환 불변 X (모수화 의존)</td>
</tr>
<tr class="odd">
<td><strong>Score</strong></td>
<td><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D"> 불필요 (가설값만)</td>
<td>신뢰구간 구성 어려움</td>
</tr>
</tbody>
</table>
<p><strong>LR 의 변환 불변성</strong>: <img src="https://latex.codecogs.com/png.latex?%5Ctheta"> 대신 <img src="https://latex.codecogs.com/png.latex?%5Ceta%20=%20g(%5Ctheta)"> 로 다시 모수화해도 같은 통계량 값 — 자연스러운 성질. Wald 는 그렇지 않음 (예: <img src="https://latex.codecogs.com/png.latex?%5Ctheta%20=%200.5"> vs <img src="https://latex.codecogs.com/png.latex?%5Ceta%20=%20%5Cln(%5Ctheta/(1-%5Ctheta))%20=%200"> 이 같은 모형이지만 Wald 통계량은 다름).</p>
<p><strong>일반적 권고</strong>: <strong>LR 가 작은 표본에서 가장 신뢰할 만함</strong>. Wald 는 계산 편의 (signed sqrt 가 z-test) 로 자주 쓰임. Score 는 nuisance 모수가 있는 경우 매력 (다음 절).</p>
</div>
</div>
</section>
<section id="example-b.1-지수-분포-단순-가설" class="level3" data-number="3.6">
<h3 data-number="3.6" class="anchored" data-anchor-id="example-b.1-지수-분포-단순-가설"><span class="header-section-number">3.6</span> Example B.1 — 지수 분포 단순 가설</h3>
<section id="셋업" class="level4" data-number="3.6.1">
<h4 data-number="3.6.1" class="anchored" data-anchor-id="셋업"><span class="header-section-number">3.6.1</span> 셋업</h4>
<p>지수 분포 <img src="https://latex.codecogs.com/png.latex?f(t)%20=%20%5Clambda%20e%5E%7B-%5Clambda%20t%7D"> 의 검열 표본 <img src="https://latex.codecogs.com/png.latex?(T_i,%20%5Cdelta_i)">, <img src="https://latex.codecogs.com/png.latex?i%20=%201,%20%5Cldots,%20n">. 검정 <img src="https://latex.codecogs.com/png.latex?H_0:%20%5Clambda%20=%201">.</p>
<p>핵심 양:</p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?D%20=%20%5Csum%20%5Cdelta_i">: 사건 수</li>
<li><img src="https://latex.codecogs.com/png.latex?S%20=%20%5Csum%20T_i">: total time on test (Ch.3.5)</li>
</ul>
<p>우도 (검열 데이터):</p>
<p><img src="https://latex.codecogs.com/png.latex?%20L(%5Clambda)%20=%20%5Cprod_i%20%5Clambda%5E%7B%5Cdelta_i%7D%20e%5E%7B-%5Clambda%20T_i%7D%20=%20%5Clambda%5ED%20e%5E%7B-%5Clambda%20S%7D%20.%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cell(%5Clambda)%20=%20D%20%5Cln%20%5Clambda%20-%20%5Clambda%20S%20.%20%5Ctag%7B%EC%8B%9D%20B.7%7D%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%20U(%5Clambda)%20=%20%5Cfrac%7BD%7D%7B%5Clambda%7D%20-%20S%20.%20%5Ctag%7B%EC%8B%9D%20B.8%7D%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%20I(%5Clambda)%20=%20-%5Cfrac%7Bd%5E2%20%5Cell%7D%7Bd%5Clambda%5E2%7D%20=%20%5Cfrac%7BD%7D%7B%5Clambda%5E2%7D%20.%20%5Ctag%7B%EC%8B%9D%20B.9%7D%20"></p>
<p>MLE: <img src="https://latex.codecogs.com/png.latex?U(%5Chat%7B%5Clambda%7D)%20=%200%20%5CRightarrow%20%5Chat%7B%5Clambda%7D%20=%20D/S">.</p>
</section>
<section id="세-통계량-계산" class="level4" data-number="3.6.2">
<h4 data-number="3.6.2" class="anchored" data-anchor-id="세-통계량-계산"><span class="header-section-number">3.6.2</span> 세 통계량 계산</h4>
<p><strong>Score</strong> (식 B.6): 가설값 <img src="https://latex.codecogs.com/png.latex?%5Clambda_0%20=%201">:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cchi%5E2_S%20=%20U(1)%5E2%20%5Ccdot%20I%5E%7B-1%7D(1)%20=%20(D%20-%20S)%5E2%20%5Ccdot%20%5Cfrac%7B1%5E2%7D%7BD%7D%20=%20%5Cfrac%7B(D%20-%20S)%5E2%7D%7BD%7D%20.%20"></p>
<p><strong>Wald</strong> (식 B.5): MLE <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Clambda%7D%20=%20D/S">:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cchi%5E2_W%20=%20(%5Chat%7B%5Clambda%7D%20-%201)%5E2%20%5Ccdot%20I(%5Chat%7B%5Clambda%7D)%20=%20(D/S%20-%201)%5E2%20%5Ccdot%20%5Cfrac%7BD%7D%7B(D/S)%5E2%7D%20=%20%5Cfrac%7B(D%20-%20S)%5E2%7D%7BD%7D%20.%20"></p>
<p><strong>LR</strong> (식 B.4):</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cchi%5E2_%7BLR%7D%20=%20-2%5C%7B%5Cell(1)%20-%20%5Cell(%5Chat%7B%5Clambda%7D)%5C%7D%20=%20-2%5C%7B(D%20%5Cln%201%20-%20S)%20-%20(D%20%5Cln(D/S)%20-%20D)%5C%7D%20=%202%5BS%20-%20D%20+%20D%20%5Cln(D/S)%5D%20.%20"></p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
결과 — Wald = Score, LR 다름
</div>
</div>
<div class="callout-body-container callout-body">
<p>이 단순 사례에서:</p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_W%20=%20%5Cchi%5E2_S%20=%20(D-S)%5E2%20/%20D"> — <strong>정확히 같다</strong>.</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_%7BLR%7D%20=%202%5BS%20-%20D%20+%20D%20%5Cln(D/S)%5D"> — 다른 형태이지만 점근적으로 같은 분포.</li>
</ul>
<p>세 통계량 모두 <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_1"> 점근.</p>
<p><strong>왜 W = S 가 나왔는가</strong>: 지수 분포는 single parameter, 우도가 거의 quadratic 형태 → 점근 동등성이 정확하게 성립. 대부분의 분포는 W ≠ S.</p>
<p>수치 예: <img src="https://latex.codecogs.com/png.latex?D%20=%2010,%20S%20=%2012"> → <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_W%20=%20%5Cchi%5E2_S%20=%20(10-12)%5E2/10%20=%200.4">. <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_%7BLR%7D%20=%202%5B12%20-%2010%20+%2010%20%5Cln(10/12)%5D%20=%202%5B2%20+%2010%20%5Ctimes%20(-0.182)%5D%20=%202%5B2%20-%201.82%5D%20=%200.36">. 비슷하지만 약간 다름. <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_1"> 임계값 3.84 와 비교 → 비유의.</p>
</div>
</div>
</section>
</section>
</section>
<section id="복합-가설-nuisance-모수-처리" class="level2" data-number="4">
<h2 data-number="4" class="anchored" data-anchor-id="복합-가설-nuisance-모수-처리"><span class="header-section-number">4</span> 복합 가설 — Nuisance 모수 처리</h2>
<section id="셋업-1" class="level3" data-number="4.1">
<h3 data-number="4.1" class="anchored" data-anchor-id="셋업-1"><span class="header-section-number">4.1</span> 셋업</h3>
<p>모수 <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Ctheta%7D%20=%20(%5Cboldsymbol%7B%5Cpsi%7D,%20%5Cboldsymbol%7B%5Cphi%7D)">, 여기서:</p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cpsi%7D%20%5Cin%20%5Cmathbb%7BR%7D%5E%7Bp_1%7D">: 검정 대상 모수</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cphi%7D%20%5Cin%20%5Cmathbb%7BR%7D%5E%7Bp_2%7D">: nuisance 모수 (검정 대상 아니지만 모형에 필요)</li>
</ul>
<p>가설: <img src="https://latex.codecogs.com/png.latex?H_0:%20%5Cboldsymbol%7B%5Cpsi%7D%20=%20%5Cboldsymbol%7B%5Cpsi%7D_0">, <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cphi%7D"> 는 자유.</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — Nuisance 의 처리
</div>
</div>
<div class="callout-body-container callout-body">
<p>전형적 사례:</p>
<ul>
<li><strong>Cox 회귀</strong>: 처치 효과 (<img src="https://latex.codecogs.com/png.latex?%5Cbeta_1">) 가 0 인지 검정. 다른 보정 변수 (<img src="https://latex.codecogs.com/png.latex?%5Cbeta_2,%20%5Cldots,%20%5Cbeta_p">) 는 nuisance.</li>
<li><strong>두 그룹 비교</strong>: 효과 차이 (<img src="https://latex.codecogs.com/png.latex?%5Cbeta%20=%200">) 검정. 베이스라인 위험 (<img src="https://latex.codecogs.com/png.latex?%5Clambda">) 은 nuisance.</li>
<li><strong>Frailty test</strong>: <img src="https://latex.codecogs.com/png.latex?%5Ctheta%20=%200"> 검정. 회귀 계수 <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cbeta%7D"> 는 nuisance.</li>
</ul>
<p>각 검정마다 nuisance 처리 방식이 다르다:</p>
<ul>
<li><strong>LR</strong>: <img src="https://latex.codecogs.com/png.latex?H_0"> 하 profile MLE <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%7B%5Cphi%7D%7D(%5Cboldsymbol%7B%5Cpsi%7D_0)"> + 일반 MLE <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D"> — 두 우도 비교.</li>
<li><strong>Wald</strong>: 일반 MLE <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D"> 만 + 정보 행렬 partition 의 <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cpsi%7D"> 부분.</li>
<li><strong>Score</strong>: <img src="https://latex.codecogs.com/png.latex?H_0"> 하 profile MLE 만 — 가장 가벼운 적합.</li>
</ul>
</div>
</div>
</section>
<section id="information-matrix-partition-식-b.10-b.11" class="level3" data-number="4.2">
<h3 data-number="4.2" class="anchored" data-anchor-id="information-matrix-partition-식-b.10-b.11"><span class="header-section-number">4.2</span> Information Matrix Partition — 식 (B.10), (B.11)</h3>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7BI%7D%20=%20%5Cbegin%7Bpmatrix%7D%20%5Cmathbf%7BI%7D_%7B%5Cpsi%5Cpsi%7D%20&amp;%20%5Cmathbf%7BI%7D_%7B%5Cpsi%5Cphi%7D%20%5C%5C%20%5Cmathbf%7BI%7D_%7B%5Cphi%5Cpsi%7D%20&amp;%20%5Cmathbf%7BI%7D_%7B%5Cphi%5Cphi%7D%20%5Cend%7Bpmatrix%7D%20,%20%5Ctag%7B%EC%8B%9D%20B.10%7D%20"></p>
<p>블록 차원: <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BI%7D_%7B%5Cpsi%5Cpsi%7D"> 는 <img src="https://latex.codecogs.com/png.latex?p_1%20%5Ctimes%20p_1">, <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BI%7D_%7B%5Cphi%5Cphi%7D"> 는 <img src="https://latex.codecogs.com/png.latex?p_2%20%5Ctimes%20p_2">, <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BI%7D_%7B%5Cpsi%5Cphi%7D"> 는 <img src="https://latex.codecogs.com/png.latex?p_1%20%5Ctimes%20p_2">, <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BI%7D_%7B%5Cphi%5Cpsi%7D%20=%20%5Cmathbf%7BI%7D_%7B%5Cpsi%5Cphi%7D%5Et">.</p>
<p>역행렬도 partition:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7BI%7D%5E%7B-1%7D%20=%20%5Cbegin%7Bpmatrix%7D%20%5Cmathbf%7BI%7D%5E%7B%5Cpsi%5Cpsi%7D%20&amp;%20%5Cmathbf%7BI%7D%5E%7B%5Cpsi%5Cphi%7D%20%5C%5C%20%5Cmathbf%7BI%7D%5E%7B%5Cphi%5Cpsi%7D%20&amp;%20%5Cmathbf%7BI%7D%5E%7B%5Cphi%5Cphi%7D%20%5Cend%7Bpmatrix%7D%20.%20%5Ctag%7B%EC%8B%9D%20B.11%7D%20"></p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BI%7D%5E%7B%5Cpsi%5Cpsi%7D%20%5Cneq%20%5Cmathbf%7BI%7D_%7B%5Cpsi%5Cpsi%7D%5E%7B-1%7D"> — Schur 보수
</div>
</div>
<div class="callout-body-container callout-body">
<p>핵심 차이: <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BI%7D%5E%7B%5Cpsi%5Cpsi%7D"> (역행렬의 <img src="https://latex.codecogs.com/png.latex?(%5Cpsi,%20%5Cpsi)"> 블록) 는 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BI%7D_%7B%5Cpsi%5Cpsi%7D%5E%7B-1%7D"> (<img src="https://latex.codecogs.com/png.latex?(%5Cpsi,%20%5Cpsi)"> 블록의 역수) 와 다르다.</p>
<p><strong>Schur 보수 공식</strong>:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7BI%7D%5E%7B%5Cpsi%5Cpsi%7D%20=%20(%5Cmathbf%7BI%7D_%7B%5Cpsi%5Cpsi%7D%20-%20%5Cmathbf%7BI%7D_%7B%5Cpsi%5Cphi%7D%20%5Cmathbf%7BI%7D_%7B%5Cphi%5Cphi%7D%5E%7B-1%7D%20%5Cmathbf%7BI%7D_%7B%5Cphi%5Cpsi%7D)%5E%7B-1%7D%20.%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BI%7D%5E%7B%5Cpsi%5Cpsi%7D"> 가 <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cpsi%7D"> 의 marginal 분산 (nuisance 보정 후), <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BI%7D_%7B%5Cpsi%5Cpsi%7D%5E%7B-1%7D"> 는 <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cphi%7D"> 가 알려진 경우의 분산.</p>
<p><strong>왜 nuisance 보정이 필요한가</strong>: <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cphi%7D"> 도 추정해야 하므로 그 추정 오차가 <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cpsi%7D"> 의 분산을 부풀린다. Schur 보수가 이 부풀림을 정확히 반영.</p>
<p>생존 분석 본문에서 자주 등장 — Cox 모형의 단일 회귀 계수 SE 가 다른 계수의 추정 변동성을 포함한 형태.</p>
</div>
</div>
</section>
<section id="likelihood-ratio-test-식-b.12" class="level3" data-number="4.3">
<h3 data-number="4.3" class="anchored" data-anchor-id="likelihood-ratio-test-식-b.12"><span class="header-section-number">4.3</span> Likelihood Ratio Test — 식 (B.12)</h3>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cchi%5E2_%7BLR%7D%20=%20-2%5C%7B%5Cell%5B%5Cboldsymbol%7B%5Cpsi%7D_0,%20%5Chat%7B%5Cboldsymbol%7B%5Cphi%7D%7D(%5Cboldsymbol%7B%5Cpsi%7D_0);%20%5Cmathbf%7BY%7D%5D%20-%20%5Cell(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D;%20%5Cmathbf%7BY%7D)%5C%7D%20.%20%5Ctag%7B%EC%8B%9D%20B.12%7D%20"></p>
<p>여기서 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%7B%5Cphi%7D%7D(%5Cboldsymbol%7B%5Cpsi%7D_0)"> 는 <strong>profile MLE</strong> — <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cpsi%7D"> 를 <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cpsi%7D_0"> 로 고정한 채 <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cphi%7D"> 만 최대화한 추정.</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 두 모형의 우도 비교
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>제약 모형</strong> (<img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cpsi%7D%20=%20%5Cboldsymbol%7B%5Cpsi%7D_0"> 가설 하): <img src="https://latex.codecogs.com/png.latex?%5Cell%5B%5Cboldsymbol%7B%5Cpsi%7D_0,%20%5Chat%7B%5Cboldsymbol%7B%5Cphi%7D%7D(%5Cboldsymbol%7B%5Cpsi%7D_0)%5D">. 가설이 옳다고 가정하고 nuisance 만 최적화한 우도.</p>
<p><strong>일반 모형</strong> (제약 없음): <img src="https://latex.codecogs.com/png.latex?%5Cell(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D)">. 모든 모수 자유 추정.</p>
<p><strong>차이가 큼 → 제약 (가설) 이 데이터에 맞지 않음 → 가설 기각</strong>.</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_%7BLR%7D%20%5Cxrightarrow%7Bd%7D%20%5Cchi%5E2_%7Bp_1%7D">, 자유도 = 검정되는 모수 수.</p>
</div>
</div>
</section>
<section id="wald-test-식-b.13" class="level3" data-number="4.4">
<h3 data-number="4.4" class="anchored" data-anchor-id="wald-test-식-b.13"><span class="header-section-number">4.4</span> Wald Test — 식 (B.13)</h3>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cchi%5E2_W%20=%20(%5Chat%7B%5Cboldsymbol%7B%5Cpsi%7D%7D%20-%20%5Cboldsymbol%7B%5Cpsi%7D_0)%5Et%20%5B%5Cmathbf%7BI%7D%5E%7B%5Cpsi%5Cpsi%7D(%5Chat%7B%5Cboldsymbol%7B%5Cpsi%7D%7D,%20%5Chat%7B%5Cboldsymbol%7B%5Cphi%7D%7D)%5D%5E%7B-1%7D%20(%5Chat%7B%5Cboldsymbol%7B%5Cpsi%7D%7D%20-%20%5Cboldsymbol%7B%5Cpsi%7D_0)%20.%20%5Ctag%7B%EC%8B%9D%20B.13%7D%20"></p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — Marginal 분산 사용
</div>
</div>
<div class="callout-body-container callout-body">
<p>식 (B.13) 의 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BI%7D%5E%7B%5Cpsi%5Cpsi%7D"> 는 식 B.11 의 partition 역행렬의 <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cpsi%7D"> 블록 — <strong>nuisance 보정된 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%7B%5Cpsi%7D%7D"> 의 marginal 분산</strong>.</p>
<p>따라서 Wald 의 거리 정규화에 nuisance 의 추정 변동성이 자동 반영. 일반 MLE <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D"> 만 필요 (제약 모형 적합 X).</p>
<p><strong>실무 매력</strong>: Cox 회귀의 SE 출력에서 직접 통계량 계산. 한 변수 검정에 가장 자주 사용.</p>
</div>
</div>
</section>
<section id="score-test-rao-식-b.14" class="level3" data-number="4.5">
<h3 data-number="4.5" class="anchored" data-anchor-id="score-test-rao-식-b.14"><span class="header-section-number">4.5</span> Score Test (Rao) — 식 (B.14)</h3>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cchi%5E2_S%20=%20%5Cmathbf%7BU%7D_%5Cpsi%5B%5Cboldsymbol%7B%5Cpsi%7D_0,%20%5Chat%7B%5Cboldsymbol%7B%5Cphi%7D%7D(%5Cboldsymbol%7B%5Cpsi%7D_0)%5D%5Et%20%5Cmathbf%7BI%7D%5E%7B%5Cpsi%5Cpsi%7D%5B%5Cboldsymbol%7B%5Cpsi%7D_0,%20%5Chat%7B%5Cboldsymbol%7B%5Cphi%7D%7D(%5Cboldsymbol%7B%5Cpsi%7D_0)%5D%20%5Cmathbf%7BU%7D_%5Cpsi%5B%5Cboldsymbol%7B%5Cpsi%7D_0,%20%5Chat%7B%5Cboldsymbol%7B%5Cphi%7D%7D(%5Cboldsymbol%7B%5Cpsi%7D_0)%5D%20.%20%5Ctag%7B%EC%8B%9D%20B.14%7D%20"></p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 제약 모형만 적합
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BU%7D_%5Cpsi"> 는 score 벡터의 <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cpsi%7D"> 부분. 이를 <strong>제약 모형</strong> (<img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cpsi%7D%20=%20%5Cboldsymbol%7B%5Cpsi%7D_0"> 고정 + <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cphi%7D"> profile MLE) 에서 평가.</p>
<p>귀무 모형이 옳으면 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BU%7D_%5Cpsi%5B%5Cboldsymbol%7B%5Cpsi%7D_0,%20%5Chat%7B%5Cboldsymbol%7B%5Cphi%7D%7D(%5Cboldsymbol%7B%5Cpsi%7D_0)%5D%20%5Capprox%20%5Cmathbf%7B0%7D"> — 가설값에서 score 가 0 근처여야.</p>
<p>이 score 가 0 에서 멀면 → 가설값이 자료의 우도 최대점에서 떨어져 있다 → 기각.</p>
<p><strong>실무 큰 매력</strong>: <strong>일반 MLE <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D"> 불필요</strong>. 무거운 최적화 (예: frailty EM) 없이 검정 가능. § 13.2 Commenges-Andersen 가 이 패턴.</p>
<p><strong>주의</strong>: 식 (B.14) 의 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BI%7D%5E%7B%5Cpsi%5Cpsi%7D"> 는 inverse 가 아닌 <strong>그 자체</strong> (식 B.6 와 부호 다름). Score 의 분산이 정보 행렬의 역수의 역수 — 즉 정보 행렬 자체로 정규화. 식 (B.6) 의 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BI%7D%5E%7B-1%7D"> 와 형식 차이 주의.</p>
</div>
</div>
<p>세 통계량 모두 <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_%7BLR%7D,%20%5Cchi%5E2_W,%20%5Cchi%5E2_S%20%5Cxrightarrow%7Bd%7D%20%5Cchi%5E2_%7Bp_1%7D">.</p>
</section>
<section id="example-b.2-두-지수-그룹-비교" class="level3" data-number="4.6">
<h3 data-number="4.6" class="anchored" data-anchor-id="example-b.2-두-지수-그룹-비교"><span class="header-section-number">4.6</span> Example B.2 — 두 지수 그룹 비교</h3>
<section id="셋업-2" class="level4" data-number="4.6.1">
<h4 data-number="4.6.1" class="anchored" data-anchor-id="셋업-2"><span class="header-section-number">4.6.1</span> 셋업</h4>
<p>두 지수 분포 그룹:</p>
<ul>
<li>그룹 1: <img src="https://latex.codecogs.com/png.latex?h_1(t)%20=%20%5Clambda"></li>
<li>그룹 2: <img src="https://latex.codecogs.com/png.latex?h_2(t)%20=%20%5Clambda%20%5Cbeta"></li>
</ul>
<p><img src="https://latex.codecogs.com/png.latex?%5Cbeta"> 는 그룹 2 의 그룹 1 대비 위험비. 가설: <img src="https://latex.codecogs.com/png.latex?H_0:%20%5Cbeta%20=%201"> (두 그룹 같은 위험률), <img src="https://latex.codecogs.com/png.latex?%5Clambda"> 는 nuisance.</p>
<p>각 그룹의 사건 수 <img src="https://latex.codecogs.com/png.latex?D_i">, total time on test <img src="https://latex.codecogs.com/png.latex?S_i"> (<img src="https://latex.codecogs.com/png.latex?i%20=%201,%202">).</p>
</section>
<section id="우도" class="level4" data-number="4.6.2">
<h4 data-number="4.6.2" class="anchored" data-anchor-id="우도"><span class="header-section-number">4.6.2</span> 우도</h4>
<p><img src="https://latex.codecogs.com/png.latex?%20L(%5Clambda,%20%5Cbeta)%20=%20%5Clambda%5E%7BD_1%20+%20D_2%7D%20%5Cbeta%5E%7BD_2%7D%20%5Cexp(-%5Clambda%20S_1%20-%20%5Clambda%20%5Cbeta%20S_2)%20.%20%5Ctag%7B%EC%8B%9D%20B.15%7D%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cell(%5Cbeta,%20%5Clambda)%20=%20(D_1%20+%20D_2)%20%5Cln%20%5Clambda%20+%20D_2%20%5Cln%20%5Cbeta%20-%20%5Clambda%20S_1%20-%20%5Clambda%20%5Cbeta%20S_2%20.%20%5Ctag%7B%EC%8B%9D%20B.16%7D%20"></p>
</section>
<section id="score-와-information" class="level4" data-number="4.6.3">
<h4 data-number="4.6.3" class="anchored" data-anchor-id="score-와-information"><span class="header-section-number">4.6.3</span> Score 와 Information</h4>
<p><img src="https://latex.codecogs.com/png.latex?%20U_%5Cbeta%20=%20%5Cfrac%7BD_2%7D%7B%5Cbeta%7D%20-%20%5Clambda%20S_2%20,%20%5Cquad%20U_%5Clambda%20=%20%5Cfrac%7BD_1%20+%20D_2%7D%7B%5Clambda%7D%20-%20S_1%20-%20%5Cbeta%20S_2%20.%20%5Ctag%7B%EC%8B%9D%20B.17,%20B.18%7D%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%20I_%7B%5Cbeta%5Cbeta%7D%20=%20%5Cfrac%7BD_2%7D%7B%5Cbeta%5E2%7D%20,%20%5Cquad%20I_%7B%5Clambda%5Clambda%7D%20=%20%5Cfrac%7BD_1%20+%20D_2%7D%7B%5Clambda%5E2%7D%20,%20%5Cquad%20I_%7B%5Cbeta%5Clambda%7D%20=%20S_2%20.%20%5Ctag%7B%EC%8B%9D%20B.19,%20B.20,%20B.21%7D%20"></p>
</section>
<section id="mle" class="level4" data-number="4.6.4">
<h4 data-number="4.6.4" class="anchored" data-anchor-id="mle"><span class="header-section-number">4.6.4</span> MLE</h4>
<p><img src="https://latex.codecogs.com/png.latex?U_%5Cbeta%20=%200,%20U_%5Clambda%20=%200"> 에서:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Chat%7B%5Cbeta%7D%20=%20%5Cfrac%7BS_1%20D_2%7D%7BS_2%20D_1%7D%20,%20%5Cquad%20%5Chat%7B%5Clambda%7D%20=%20%5Cfrac%7BD_1%7D%7BS_1%7D%20.%20"></p>
<p>직관: <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Clambda%7D"> 는 그룹 1 의 단순 MLE (그룹 1 만 사용). <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"> 는 그룹 2 의 위험률 / 그룹 1 의 위험률 = <img src="https://latex.codecogs.com/png.latex?(D_2/S_2)%20/%20(D_1/S_1)">. 즉 <strong><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"> = 두 그룹 위험률의 비</strong>.</p>
</section>
<section id="profile-mle-제약-beta-1-하" class="level4" data-number="4.6.5">
<h4 data-number="4.6.5" class="anchored" data-anchor-id="profile-mle-제약-beta-1-하"><span class="header-section-number">4.6.5</span> Profile MLE — 제약 (<img src="https://latex.codecogs.com/png.latex?%5Cbeta%20=%201">) 하</h4>
<p><img src="https://latex.codecogs.com/png.latex?U_%5Clambda(%5Cbeta%20=%201)%20=%200"> 에서:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Chat%7B%5Clambda%7D(1)%20=%20%5Cfrac%7BD_1%20+%20D_2%7D%7BS_1%20+%20S_2%7D%20.%20"></p>
<p>직관: <img src="https://latex.codecogs.com/png.latex?%5Cbeta%20=%201"> (두 그룹 동일) 가설 하 모든 데이터를 합쳐 단일 지수 분포 추정 → <strong>pooled estimator</strong>.</p>
</section>
<section id="lr-test-식-b.12" class="level4" data-number="4.6.6">
<h4 data-number="4.6.6" class="anchored" data-anchor-id="lr-test-식-b.12"><span class="header-section-number">4.6.6</span> LR Test 식 (B.12)</h4>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cchi%5E2_%7BLR%7D%20=%202%20D_1%20%5Cln%5C!%5Cleft%5B%5Cfrac%7BD_1%20(S_1%20+%20S_2)%7D%7BS_1%20(D_1%20+%20D_2)%7D%5Cright%5D%20+%202%20D_2%20%5Cln%5C!%5Cleft%5B%5Cfrac%7BD_2%20(S_1%20+%20S_2)%7D%7BS_2%20(D_1%20+%20D_2)%7D%5Cright%5D%20.%20"></p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
LR 식의 직관 — 그룹별 관측-기대 비교
</div>
</div>
<div class="callout-body-container callout-body">
<p>각 그룹 <img src="https://latex.codecogs.com/png.latex?i"> 에 대해: - 관측 = <img src="https://latex.codecogs.com/png.latex?D_i"> (그 그룹의 실제 사건 수) - 기대 = <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Clambda%7D(1)%20S_i%20=%20(D_1%20+%20D_2)/(S_1%20+%20S_2)%20%5Ccdot%20S_i"> (pooled rate × 그 그룹의 노출)</p>
<p>비율 <img src="https://latex.codecogs.com/png.latex?%5Cfrac%7BD_i%7D%7B%5Chat%7B%5Clambda%7D(1)%20S_i%7D%20=%20%5Cfrac%7BD_i%20(S_1%20+%20S_2)%7D%7BS_i%20(D_1%20+%20D_2)%7D"> — log-rank 검정의 그룹별 관측/기대 비와 같은 형태.</p>
<p>LR 통계량은 두 그룹의 <img src="https://latex.codecogs.com/png.latex?D_i%20%5Cln(%5Ctext%7B%EA%B4%80%EC%B8%A1%7D/%5Ctext%7B%EA%B8%B0%EB%8C%80%7D)"> 합 — <strong>Poisson regression 의 deviance</strong> 형태와 동일.</p>
</div>
</div>
</section>
<section id="wald-test-식-b.13-1" class="level4" data-number="4.6.7">
<h4 data-number="4.6.7" class="anchored" data-anchor-id="wald-test-식-b.13-1"><span class="header-section-number">4.6.7</span> Wald Test 식 (B.13)</h4>
<p>식 B.11 의 partition 으로 <img src="https://latex.codecogs.com/png.latex?I%5E%7B%5Cbeta%5Cbeta%7D"> 계산:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cchi%5E2_W%20=%20%5Cfrac%7BD_1%5E2%20(S_1%20D_2%20-%20S_2%20D_1)%5E2%7D%7BD_2%20S_1%5E2%20(D_1%20+%20D_2)%7D%20.%20"></p>
</section>
<section id="score-test-식-b.14" class="level4" data-number="4.6.8">
<h4 data-number="4.6.8" class="anchored" data-anchor-id="score-test-식-b.14"><span class="header-section-number">4.6.8</span> Score Test 식 (B.14)</h4>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cchi%5E2_S%20=%20%5Cfrac%7B%5BD_2%20(S_1%20+%20S_2)%20-%20(D_1%20+%20D_2)%20S_2%5D%5E2%7D%7BD_2%20(S_1%20+%20S_2)%5E2%20-%20(D_1%20+%20D_2)%20S_1%5E2%7D%20.%20"></p>
<p>(분자가 <img src="https://latex.codecogs.com/png.latex?D_2%20S_1%20-%20D_1%20S_2"> 의 형태로 정리 가능 — 그룹 차이의 제곱.)</p>
</section>
<section id="수치-예-klein-본문" class="level4" data-number="4.6.9">
<h4 data-number="4.6.9" class="anchored" data-anchor-id="수치-예-klein-본문"><span class="header-section-number">4.6.9</span> 수치 예 — Klein 본문</h4>
<p><img src="https://latex.codecogs.com/png.latex?D_1%20=%2010,%20D_2%20=%2012,%20S_1%20=%2025,%20S_2%20=%2027"> 대입:</p>
<table class="table">
<thead>
<tr class="header">
<th>통계량</th>
<th>값</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_%7BLR%7D"></td>
<td><strong>0.0607</strong></td>
</tr>
<tr class="even">
<td><img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_W"></td>
<td><strong>0.0545</strong></td>
</tr>
<tr class="odd">
<td><img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_S"></td>
<td><strong>0.0448</strong></td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
결과 해석
</div>
</div>
<div class="callout-body-container callout-body">
<p>세 통계량 모두 <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_1"> 의 5 % 임계값 <img src="https://latex.codecogs.com/png.latex?3.841"> 보다 훨씬 작음 → 모두 비유의.</p>
<p><strong>결론</strong>: <img src="https://latex.codecogs.com/png.latex?H_0:%20%5Cbeta%20=%201"> 기각 안 함. 두 그룹의 위험률에 통계적으로 유의한 차이 없음.</p>
<p><strong>세 통계량의 차이</strong>:</p>
<ul>
<li>작은 표본에서 비대칭 우도로 인해 <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_%7BLR%7D%20=%200.0607%20%5Cneq%20%5Cchi%5E2_W%20=%200.0545%20%5Cneq%20%5Cchi%5E2_S%20=%200.0448">.</li>
<li>그러나 점근적으로 같은 결정 (모두 비유의).</li>
<li>일반적으로 <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_%7BLR%7D"> 이 가장 신뢰할 만하지만 (변환 불변), 이 사례에서는 모두 일관 결론.</li>
</ul>
<p><strong>직관</strong>: <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D%20=%20(S_1%20D_2)/(S_2%20D_1)%20=%20(25%20%5Ctimes%2012)/(27%20%5Ctimes%2010)%20=%20300/270%20=%201.111"> — <img src="https://latex.codecogs.com/png.latex?%5Cbeta%20=%201"> 에서 약 11 % 떨어졌지만 표본이 작아 (<img src="https://latex.codecogs.com/png.latex?D_1%20=%2010,%20D_2%20=%2012">) 유의 수준 도달 못함.</p>
</div>
</div>
</section>
</section>
</section>
<section id="세-검정의-실무-권고" class="level2" data-number="5">
<h2 data-number="5" class="anchored" data-anchor-id="세-검정의-실무-권고"><span class="header-section-number">5</span> 세 검정의 실무 권고</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
어느 검정을 언제 쓰나
</div>
</div>
<div class="callout-body-container callout-body">
<table class="table">
<colgroup>
<col style="width: 50%">
<col style="width: 50%">
</colgroup>
<thead>
<tr class="header">
<th>상황</th>
<th>권장</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>일반적, 큰 표본</td>
<td><strong>LR</strong> — 변환 불변, 가장 견고</td>
</tr>
<tr class="even">
<td>한 변수 t-test 형태</td>
<td><strong>Wald</strong> — <code>summary(fit)</code> 출력의 표준</td>
</tr>
<tr class="odd">
<td>MLE 비싼 모형 (frailty EM 등)</td>
<td><strong>Score</strong> — 제약 모형만 적합</td>
</tr>
<tr class="even">
<td>모수 공간 경계 가설 (<img src="https://latex.codecogs.com/png.latex?%5Ctheta%20=%200"> 등)</td>
<td><strong>Score</strong> — 점근 정칙 더 강건</td>
</tr>
<tr class="odd">
<td>신뢰구간 inversion</td>
<td><strong>LR</strong> — 가장 정확</td>
</tr>
<tr class="even">
<td>작은 표본</td>
<td><strong>LR</strong> &gt; Wald &gt; Score (일반적)</td>
</tr>
</tbody>
</table>
<p><strong>일관성</strong>: 가능하면 세 검정을 모두 계산하고 일관된 결론을 확인. 큰 차이가 나면 우도 함수의 비대칭 또는 점근 근사의 부정확을 의심.</p>
</div>
</div>
</section>
<section id="본문에서의-응용-klein-책의-검정들" class="level2" data-number="6">
<h2 data-number="6" class="anchored" data-anchor-id="본문에서의-응용-klein-책의-검정들"><span class="header-section-number">6</span> 본문에서의 응용 — Klein 책의 검정들</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Cox 모형 (Ch.8)
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>Wald test</strong>: <code>coxph()</code> 의 <code>summary(fit)</code> 출력의 z-test. <img src="https://latex.codecogs.com/png.latex?%5Cbeta_k"> 의 marginal 검정.</p>
<p><strong>LR test</strong>: 제약 모형 (변수 제거) 과 일반 모형의 우도 비교 — <code>anova(fit_null, fit_full)</code>. 변수 추가의 유의성.</p>
<p><strong>Score test</strong>: 변수 추가의 score-based 검정 — <code>anova(fit, scoretest = TRUE)</code> 또는 직접 계산. 큰 모형 적합 부담 회피.</p>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Frailty Models (Ch.13)
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>Score test for <img src="https://latex.codecogs.com/png.latex?%5Ctheta%20=%200"></strong> (Commenges-Andersen): § 13.2 의 핵심. 일반 Cox 만 적합하고 frailty 의 score 통계량 계산.</p>
<p><strong>Wald test for <img src="https://latex.codecogs.com/png.latex?%5Ctheta"></strong>: § 13.3 의 EM 후 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Ctheta%7D%20/%20SE(%5Chat%7B%5Ctheta%7D)">. 모수 경계 (<img src="https://latex.codecogs.com/png.latex?%5Ctheta%20%5Cgeq%200">) 라 점근 정칙 약함.</p>
<p><strong>LR test for <img src="https://latex.codecogs.com/png.latex?%5Ctheta%20=%200"></strong>: <img src="https://latex.codecogs.com/png.latex?-2%5B%5Cell_%7B%5Ctext%7BCox%7D%7D%20-%20%5Cell_%7B%5Ctext%7Bfrailty%7D%7D%5D">. 분포가 정확히 <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2"> 가 아니라 <img src="https://latex.codecogs.com/png.latex?0.5%20%5Cchi%5E2_0%20+%200.5%20%5Cchi%5E2_1"> — 모수 경계 효과.</p>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
모수 회귀 (Ch.12)
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>LR test for nested 분포</strong>: Weibull vs 지수 (<img src="https://latex.codecogs.com/png.latex?%5Csigma%20=%201">). <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_%7BLR%7D%20=%20-2%5B%5Cell_%7B%5Ctext%7Bexp%7D%7D%20-%20%5Cell_%7B%5Ctext%7BWei%7D%7D%5D">, <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_1">.</p>
<p><strong>Wald test for 분포 모수</strong>: <code>survreg()</code> 출력의 t-statistic.</p>
<p><strong>일반화 감마의 <img src="https://latex.codecogs.com/png.latex?%5Ctheta"></strong>: <img src="https://latex.codecogs.com/png.latex?%5Ctheta%20=%201"> (Weibull) 또는 <img src="https://latex.codecogs.com/png.latex?%5Ctheta%20=%200"> (로그정규) 의 LR/Wald — § 12.4.</p>
</div>
</div>
</section>
<section id="코드-예시" class="level2" data-number="7">
<h2 data-number="7" class="anchored" data-anchor-id="코드-예시"><span class="header-section-number">7</span> 코드 예시</h2>
<section id="step-1-r-세-검정의-직접-비교" class="level3" data-number="7.1">
<h3 data-number="7.1" class="anchored" data-anchor-id="step-1-r-세-검정의-직접-비교"><span class="header-section-number">7.1</span> Step 1 — R: 세 검정의 직접 비교</h3>
<div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(survival)</span>
<span id="cb2-2"></span>
<span id="cb2-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Example B.2 데이터: 두 그룹 지수 분포</span></span>
<span id="cb2-4">d <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data.frame</span>(</span>
<span id="cb2-5">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">time =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rep</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.5</span>), <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>), <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rep</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.25</span>), <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>)),  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 단순화 예</span></span>
<span id="cb2-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">event =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rep</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>), <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rep</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>)),</span>
<span id="cb2-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">group =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rep</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>), <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rep</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>))</span>
<span id="cb2-8">)</span>
<span id="cb2-9"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># D_1 = 10, D_2 = 12, S_1 = 25, S_2 = 27 가정</span></span>
<span id="cb2-10"></span>
<span id="cb2-11"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 1. LR test — 제약 vs 일반 모형</span></span>
<span id="cb2-12">fit_null <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">survreg</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Surv</span>(time, event) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">dist =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"exponential"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> d)</span>
<span id="cb2-13">fit_full <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">survreg</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Surv</span>(time, event) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> group, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">dist =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"exponential"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> d)</span>
<span id="cb2-14">chi_LR <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (fit_full<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>loglik[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>] <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> fit_null<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>loglik[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>])</span>
<span id="cb2-15"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"LR:"</span>, chi_LR, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"p ="</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">pchisq</span>(chi_LR, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">df =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>), <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb2-16"></span>
<span id="cb2-17"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 2. Wald test — 일반 모형의 z-statistic</span></span>
<span id="cb2-18"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summary</span>(fit_full)</span>
<span id="cb2-19"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># coef$z 의 제곱이 chi^2_W (df=1)</span></span>
<span id="cb2-20"></span>
<span id="cb2-21"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 3. Score test — 직접 구현 또는 anova()</span></span>
<span id="cb2-22"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># anova() 는 R 의 LRT 가 default</span></span>
<span id="cb2-23"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">anova</span>(fit_null, fit_full)</span></code></pre></div>
</section>
<section id="step-2-python-scipy.stats.chi2-로-직접" class="level3" data-number="7.2">
<h3 data-number="7.2" class="anchored" data-anchor-id="step-2-python-scipy.stats.chi2-로-직접"><span class="header-section-number">7.2</span> Step 2 — Python: scipy.stats.chi2 로 직접</h3>
<div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb3-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb3-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> scipy.stats <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> chi2</span>
<span id="cb3-3"></span>
<span id="cb3-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Klein Example B.2 의 직접 계산</span></span>
<span id="cb3-5">D1, D2, S1, S2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">27</span></span>
<span id="cb3-6"></span>
<span id="cb3-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Profile MLE under H_0: beta = 1</span></span>
<span id="cb3-8">lam_pooled <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (D1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> D2) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> (S1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> S2)</span>
<span id="cb3-9"></span>
<span id="cb3-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># General MLE</span></span>
<span id="cb3-11">beta_hat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (S1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> D2) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> (S2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> D1)</span>
<span id="cb3-12">lam_hat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> D1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> S1</span>
<span id="cb3-13"></span>
<span id="cb3-14"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 1. LR test (식 B.12)</span></span>
<span id="cb3-15">ll_null <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (D1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> D2) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.log(lam_pooled) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> lam_pooled <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (S1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> S2)</span>
<span id="cb3-16">ll_full <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (D1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> D2) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.log(lam_hat) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> D2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.log(beta_hat) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> lam_hat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> S1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> lam_hat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> beta_hat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> S2</span>
<span id="cb3-17">chi_LR <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (ll_null <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> ll_full)</span>
<span id="cb3-18"></span>
<span id="cb3-19"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 2. Wald test (식 B.13)</span></span>
<span id="cb3-20">chi_W <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> D1<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (S1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> D2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> S2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> D1)<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> (D2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> S1<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (D1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> D2))</span>
<span id="cb3-21"></span>
<span id="cb3-22"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 3. Score test (식 B.14)</span></span>
<span id="cb3-23">chi_S <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> ((D2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (S1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> S2) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> (D1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> D2) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> S2)<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span></span>
<span id="cb3-24">         <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> (D2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (S1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> S2)<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> (D1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> D2) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> S1<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>))</span>
<span id="cb3-25"></span>
<span id="cb3-26"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 모두 chi^2_1 임계 3.841 와 비교</span></span>
<span id="cb3-27"><span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">for</span> name, stat <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">in</span> [(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"LR"</span>, chi_LR), (<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Wald"</span>, chi_W), (<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Score"</span>, chi_S)]:</span>
<span id="cb3-28">    p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> chi2.cdf(stat, df<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb3-29">    <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>name<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">: chi^2 = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>stat<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, p = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>p<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb3-30"></span>
<span id="cb3-31"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 출력: LR: 0.0607, Wald: 0.0545, Score: 0.0448 (Klein 본문 값과 일치)</span></span></code></pre></div>
</section>
<section id="step-3-cox-모형의-세-검정-자동-출력" class="level3" data-number="7.3">
<h3 data-number="7.3" class="anchored" data-anchor-id="step-3-cox-모형의-세-검정-자동-출력"><span class="header-section-number">7.3</span> Step 3 — Cox 모형의 세 검정 자동 출력</h3>
<div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb4-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(survival)</span>
<span id="cb4-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(survminer)</span>
<span id="cb4-3"></span>
<span id="cb4-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Cox 모형 적합 후 세 검정 자동 비교</span></span>
<span id="cb4-5">fit <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coxph</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Surv</span>(time, status) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> x <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> z, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> mydata)</span>
<span id="cb4-6"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summary</span>(fit)</span>
<span id="cb4-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 출력:</span></span>
<span id="cb4-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#   - "Wald test = X on p df, p = ..."</span></span>
<span id="cb4-9"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#   - "Score (logrank) test = X on p df, p = ..."</span></span>
<span id="cb4-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#   - "Likelihood ratio test = X on p df, p = ..."</span></span>
<span id="cb4-11"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 세 검정 동시 출력 — Cox 의 default</span></span></code></pre></div>
</section>
</section>
<section id="핵심-요약" class="level2" data-number="8">
<h2 data-number="8" class="anchored" data-anchor-id="핵심-요약"><span class="header-section-number">8</span> 핵심 요약</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Appendix B 한 줄 요약
</div>
</div>
<div class="callout-body-container callout-body">
<blockquote class="blockquote">
<p>가능도 이론은 가설 <img src="https://latex.codecogs.com/png.latex?H_0:%20%5Cboldsymbol%7B%5Ctheta%7D%20=%20%5Cboldsymbol%7B%5Ctheta%7D_0"> 에 대해 세 가지 검정을 제공한다 — <strong>LR</strong> <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_%7BLR%7D%20=%20-2%5B%5Cell(%5Cboldsymbol%7B%5Ctheta%7D_0)%20-%20%5Cell(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D)%5D"> (식 B.4, 우도 세로 비교), <strong>Wald</strong> <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_W%20=%20(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D%20-%20%5Cboldsymbol%7B%5Ctheta%7D_0)%5Et%20%5Cmathbf%7BI%7D(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D)%20(%5Chat%7B%5Cboldsymbol%7B%5Ctheta%7D%7D%20-%20%5Cboldsymbol%7B%5Ctheta%7D_0)"> (식 B.5, 가로 거리 + 정보 정규화), <strong>Score</strong> <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_S%20=%20%5Cmathbf%7BU%7D(%5Cboldsymbol%7B%5Ctheta%7D_0)%5Et%20%5Cmathbf%7BI%7D%5E%7B-1%7D(%5Cboldsymbol%7B%5Ctheta%7D_0)%20%5Cmathbf%7BU%7D(%5Cboldsymbol%7B%5Ctheta%7D_0)"> (식 B.6, 가설값 score 의 0 으로부터 거리). 세 통계량 모두 <img src="https://latex.codecogs.com/png.latex?H_0"> 하 <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_p"> 점근 분포 (Wilks). Nuisance 모수 <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%7B%5Cphi%7D"> 가 있으면 식 B.10-B.14 의 partition 형태로 일반화 — Score 는 제약 모형만 (MLE 불필요), Wald 는 일반 모형만, LR 는 둘 다 필요. Klein Example B.2 의 두 지수 그룹 비교 (<img src="https://latex.codecogs.com/png.latex?D_1=10,%20D_2=12,%20S_1=25,%20S_2=27">) 결과: <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_%7BLR%7D=0.0607,%20%5Cchi%5E2_W=0.0545,%20%5Cchi%5E2_S=0.0448"> — 모두 비유의 (<img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_1"> 임계 3.84 미만).</p>
</blockquote>
</div>
</div>
<table class="table">
<colgroup>
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
</colgroup>
<thead>
<tr class="header">
<th>검정</th>
<th>식</th>
<th>직관</th>
<th>필요 모형</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>LR</td>
<td>식 (B.4), (B.12)</td>
<td>두 우도의 세로 차이</td>
<td>제약 + 일반 둘 다</td>
</tr>
<tr class="even">
<td>Wald</td>
<td>식 (B.5), (B.13)</td>
<td>MLE 의 가로 거리 (정보 정규화)</td>
<td>일반 MLE 만</td>
</tr>
<tr class="odd">
<td>Score</td>
<td>식 (B.6), (B.14)</td>
<td>가설값 score 의 0 으로부터 거리</td>
<td>제약 모형만 (MLE 불필요)</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
5 가지 실무 권고
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>1. 작은 표본은 LR</strong>: 변환 불변, 우도 비대칭에 강건. 작은 표본에서 가장 정확.</p>
<p><strong>2. 큰 표본은 모두 동등</strong>: <img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2_p"> 점근 분포로 수렴 (Wilks 정리). 어느 것이든 같은 결정.</p>
<p><strong>3. MLE 비싼 모형은 Score</strong>: Frailty EM, 일반화 감마 등에서 score test (Commenges-Andersen 등) 가 무거운 적합 회피.</p>
<p><strong>4. 신뢰구간은 LR-based</strong>: Wald CI 는 대칭 + 모수화 의존. LR-based CI (profile likelihood) 가 작은 표본에서 더 정확.</p>
<p><strong>5. 일관성 점검</strong>: 가능하면 세 검정 모두 계산, 큰 차이 시 우도의 비대칭 또는 점근 근사 부정확 의심.</p>
</div>
</div>
</section>
<section id="관련-주제" class="level2" data-number="9">
<h2 data-number="9" class="anchored" data-anchor-id="관련-주제"><span class="header-section-number">9</span> 관련 주제</h2>
<p><strong>Klein Appendix 시리즈</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/14-klein-appendix-a-numerical.html">Appendix A — Numerical Techniques for Maximization</a> — MLE 계산 도구 (LR/Wald/Score 의 공통 계산 기반)</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/14-1-univariate-methods.html">§ A.1 — Univariate Methods</a></li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/14-2-multivariate-methods.html">§ A.2 — Multivariate Methods</a></li>
</ul>
<p><strong>본문 검정 응용</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/08-klein-ch8-cox-ph.html">Ch.8 — Cox 비례위험 모형</a> — <code>summary(coxph)</code> 의 LR/Wald/Score 동시 출력</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/12-klein-ch12-parametric.html">Ch.12 — 모수적 회귀 모형</a> — 분포 비교 LR (Weibull vs exponential)</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/13-1-frailty-score-test.html">§ 13.1-13.2 — Frailty + Score Test</a> — Commenges-Andersen score test 의 본보기</li>
</ul>
<p><strong>관련 개념</strong></p>
<ul>
<li><a href="https://en.wikipedia.org/wiki/Wilks%27_theorem">Wilks’ theorem (Wikipedia)</a> — LR 의 점근 분포</li>
<li><a href="https://en.wikipedia.org/wiki/Cram%C3%A9r%E2%80%93Rao_bound">Cramér-Rao bound</a> — Fisher information 의 의미</li>
<li>Profile likelihood (다양한 통계 교재)</li>
</ul>
</section>
<section id="참고-문헌" class="level2" data-number="10">
<h2 data-number="10" class="anchored" data-anchor-id="참고-문헌"><span class="header-section-number">10</span> 참고 문헌</h2>
<ul>
<li>Klein, J. P., &amp; Moeschberger, M. L. (2003). <em>Survival Analysis: Techniques for Censored and Truncated Data</em> (2nd ed.). Springer. <strong>Appendix B</strong>.</li>
<li>Cox, D. R., &amp; Hinkley, D. V. (1974). <em>Theoretical Statistics</em>. Chapman and Hall. <strong>Chapter 9</strong>. (Klein 이 인용한 표준 reference)</li>
<li>Wilks, S. S. (1938). The large-sample distribution of the likelihood ratio for testing composite hypotheses. <em>Annals of Mathematical Statistics</em>, 9(1), 60-62. (LR 점근 분포의 원전)</li>
<li>Wald, A. (1943). Tests of statistical hypotheses concerning several parameters when the number of observations is large. <em>Trans. Amer. Math. Soc.</em>, 54(3), 426-482. (Wald test 의 원전)</li>
<li>Rao, C. R. (1948). Large sample tests of statistical hypotheses concerning several parameters with applications to problems of estimation. <em>Math. Proc. Cambridge Phil. Soc.</em>, 44(1), 50-57. (Score test 의 원전)</li>
<li>Casella, G., &amp; Berger, R. L. (2002). <em>Statistical Inference</em> (2nd ed.). Duxbury. <strong>Chapter 8-10</strong>. (수리통계 표준 — LR, Wald, Score 의 일반적 처리)</li>
</ul>


</section>

 ]]></description>
  <category>Statistics</category>
  <category>Survival Analysis</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Statistics/survival/15-klein-appendix-b-likelihood-tests.html</guid>
  <pubDate>Wed, 13 May 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Klein Appendix A.2 — Multivariate Methods for Maximization</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Statistics/survival/14-2-multivariate-methods.html</link>
  <description><![CDATA[ 





<section id="도입-다변수-최적화가-어디에-등장하는가" class="level2" data-number="1">
<h2 data-number="1" class="anchored" data-anchor-id="도입-다변수-최적화가-어디에-등장하는가"><span class="header-section-number">1</span> 도입 — 다변수 최적화가 어디에 등장하는가</h2>
<p>생존분석 본문에서 다변수 최적화가 등장하는 자리:</p>
<table class="table">
<colgroup>
<col style="width: 33%">
<col style="width: 33%">
<col style="width: 33%">
</colgroup>
<thead>
<tr class="header">
<th>위치</th>
<th>모수 차원</th>
<th>형태</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Ch.8 — Cox PH (다공변량)</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Cbeta%20%5Cin%20%5Cmathbb%7BR%7D%5Ep">, <img src="https://latex.codecogs.com/png.latex?p%20%5Cgeq%202"></td>
<td>부분우도 Newton-Raphson</td>
</tr>
<tr class="even">
<td>Ch.9 — 시간의존 공변량 + 층화</td>
<td>$+ $ 층 모수</td>
<td>동일 알고리즘 확장</td>
</tr>
<tr class="odd">
<td>Ch.10 Aalen</td>
<td>시점별 OLS — closed form</td>
<td>다변수지만 closed form</td>
</tr>
<tr class="even">
<td>Ch.10 Lin-Ying</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Calpha%20%5Cin%20%5Cmathbb%7BR%7D%5Ep"> — closed form</td>
<td>다변수지만 closed form</td>
</tr>
<tr class="odd">
<td>Ch.12 모수 회귀 (Weibull/LL/LN)</td>
<td><img src="https://latex.codecogs.com/png.latex?(%5Cmu,%20%5Csigma,%20%5Cgamma)%20%5Cin%20%5Cmathbb%7BR%7D%5E%7Bp+2%7D"></td>
<td>full 우도 NR</td>
</tr>
<tr class="even">
<td>Ch.12 일반화 감마</td>
<td><img src="https://latex.codecogs.com/png.latex?(%5Cmu,%20%5Csigma,%20%5Cgamma,%20%5Ctheta)%20%5Cin%20%5Cmathbb%7BR%7D%5E%7Bp+3%7D"></td>
<td>NR 또는 LM</td>
</tr>
<tr class="odd">
<td>Ch.13 Frailty MLE (모수적 baseline)</td>
<td><img src="https://latex.codecogs.com/png.latex?(%5Ctheta,%20%5Cbeta,%20%5Cmu,%20%5Csigma)%20%5Cin%20%5Cmathbb%7BR%7D%5E%7Bp+3%7D"></td>
<td>다변수 NR</td>
</tr>
<tr class="even">
<td>Ch.13 Frailty EM 의 분산 추정</td>
<td><img src="https://latex.codecogs.com/png.latex?D%20+%20p%20+%201"> 차</td>
<td>정보 행렬 역수</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
§ A.1 (1D) 와 § A.2 (다변수) 의 결정적 차이
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>1D 영점 찾기</strong>: <img src="https://latex.codecogs.com/png.latex?f'(x)%20=%200"> 의 해 — 한 차원의 값.</p>
<p><strong>다변수 영점 찾기</strong>: <img src="https://latex.codecogs.com/png.latex?%5Cnabla%20f(%5Cmathbf%7Bx%7D)%20=%20%5Cmathbf%7B0%7D"> 의 해 — <img src="https://latex.codecogs.com/png.latex?p"> 차원 벡터의 모든 성분이 0 인 점.</p>
<p><strong>왜 다변수가 더 어려운가</strong>:</p>
<ol type="1">
<li><strong>방향 선택</strong>: 1D 는 +/- 두 방향만. 다변수는 <img src="https://latex.codecogs.com/png.latex?p"> 차원 단위 구면의 모든 방향.</li>
<li><strong>Hessian 의 역할</strong>: 1D 의 <img src="https://latex.codecogs.com/png.latex?f''"> 는 스칼라. 다변수의 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 는 <img src="https://latex.codecogs.com/png.latex?p%20%5Ctimes%20p"> 행렬 — 역수 비용 <img src="https://latex.codecogs.com/png.latex?O(p%5E3)">.</li>
<li><strong>길쭉한 우도</strong>: 한 축의 곡률이 다른 축보다 훨씬 큰 경우 (예: Weibull 의 <img src="https://latex.codecogs.com/png.latex?%5Clambda"> 는 평탄, <img src="https://latex.codecogs.com/png.latex?%5Calpha"> 는 가파름). 단순 그래디언트 방향이 비효율.</li>
<li><strong>수렴 판정</strong>: 단일 기준이 부족, 4 가지 (함수값/gradient 노름/모수 변화/반복 한계) 조합.</li>
</ol>
<p>이 절은 다변수 최적화의 표준 도구 3 가지 (steepest ascent, Newton-Raphson 다변수, Marquardt) 를 알고리즘과 직관으로 다룬다.</p>
</div>
</div>
</section>
<section id="표기-gradient-와-hessian" class="level2" data-number="2">
<h2 data-number="2" class="anchored" data-anchor-id="표기-gradient-와-hessian"><span class="header-section-number">2</span> 표기 — Gradient 와 Hessian</h2>
<section id="gradient-1차-도함수-벡터-식-a.3" class="level3" data-number="2.1">
<h3 data-number="2.1" class="anchored" data-anchor-id="gradient-1차-도함수-벡터-식-a.3"><span class="header-section-number">2.1</span> Gradient (1차 도함수 벡터) — 식 (A.3)</h3>
<p><img src="https://latex.codecogs.com/png.latex?f:%20%5Cmathbb%7BR%7D%5Ep%20%5Cto%20%5Cmathbb%7BR%7D"> 의 점 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bx%7D"> 에서의 그래디언트:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D)%20=%20%5Bu_1(%5Cmathbf%7Bx%7D),%20%5Cldots,%20u_p(%5Cmathbf%7Bx%7D)%5D%5Et%20,%20%5Cquad%20u_j(%5Cmathbf%7Bx%7D)%20=%20%5Cfrac%7B%5Cpartial%20f(%5Cmathbf%7Bx%7D)%7D%7B%5Cpartial%20x_j%7D%20.%20%5Ctag%7B%EC%8B%9D%20A.3%7D%20"></p>
</section>
<section id="hessian-2차-도함수-행렬-식-a.4" class="level3" data-number="2.2">
<h3 data-number="2.2" class="anchored" data-anchor-id="hessian-2차-도함수-행렬-식-a.4"><span class="header-section-number">2.2</span> Hessian (2차 도함수 행렬) — 식 (A.4)</h3>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7BH%7D(%5Cmathbf%7Bx%7D)%20=%20(H_%7Bij%7D(%5Cmathbf%7Bx%7D))%20,%20%5Cquad%20H_%7Bij%7D(%5Cmathbf%7Bx%7D)%20=%20%5Cfrac%7B%5Cpartial%5E2%20f(%5Cmathbf%7Bx%7D)%7D%7B%5Cpartial%20x_i%20%5Cpartial%20x_j%7D%20.%20%5Ctag%7B%EC%8B%9D%20A.4%7D%20"></p>
<p>대칭 행렬 (<img src="https://latex.codecogs.com/png.latex?H_%7Bij%7D%20=%20H_%7Bji%7D">, Schwarz 정리). 최대값에서는 음의 정칙 (negative definite, 모든 eigenvalue &lt; 0).</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — Gradient 와 Hessian 의 기하적 의미
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>Gradient <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D)"></strong>: 점 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bx%7D"> 에서 <img src="https://latex.codecogs.com/png.latex?f"> 가 가장 빠르게 증가하는 방향을 가리키는 벡터. 길이는 그 증가율. 영점 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D%5E*)%20=%20%5Cmathbf%7B0%7D"> 인 점이 임계점 (최대/최소/안장점).</p>
<p><strong>Hessian <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D(%5Cmathbf%7Bx%7D)"></strong>: 점 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bx%7D"> 의 곡률 텐서. <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 의 eigenvector 들이 우도의 주축 (principal axes), eigenvalue 들이 각 축의 곡률.</p>
<p><strong>최대값의 기하</strong>: 모든 방향으로 곡률 음 (<img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 음의 정칙) → 우도가 그 점에서 모든 방향으로 감소 → 진정한 최대.</p>
<p><strong>길쭉한 우도</strong>: <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 의 eigenvalue 들이 크게 다르면 (예: 100 vs 1) 우도 등고선이 길쭉한 타원. 한 축으로는 가파르고 다른 축으로는 평탄.</p>
<p>이 길쭉함이 다변수 최적화의 <strong>핵심 도전</strong> — steepest ascent 가 비효율적이 되는 원인.</p>
</div>
</div>
</section>
<section id="quadratic-form-의-의미" class="level3" data-number="2.3">
<h3 data-number="2.3" class="anchored" data-anchor-id="quadratic-form-의-의미"><span class="header-section-number">2.3</span> Quadratic Form 의 의미</h3>
<p><img src="https://latex.codecogs.com/png.latex?f"> 의 점 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bx%7D_0"> 근처 Taylor 2 차 근사:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20f(%5Cmathbf%7Bx%7D)%20%5Capprox%20f(%5Cmathbf%7Bx%7D_0)%20+%20%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D_0)%5Et%20(%5Cmathbf%7Bx%7D%20-%20%5Cmathbf%7Bx%7D_0)%20+%20%5Cfrac%7B1%7D%7B2%7D%20(%5Cmathbf%7Bx%7D%20-%20%5Cmathbf%7Bx%7D_0)%5Et%20%5Cmathbf%7BH%7D(%5Cmathbf%7Bx%7D_0)%20(%5Cmathbf%7Bx%7D%20-%20%5Cmathbf%7Bx%7D_0)%20.%20"></p>
<p><strong>1차 항</strong>: 평면 (linear). <strong>2차 항</strong>: <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 가 음의 정칙이면 위로 볼록 (concave) 한 quadratic. 이 quadratic 의 최대점이 Newton 의 한 step 의 도착지.</p>
</section>
</section>
<section id="a.2.1-steepest-ascent-식-a.5" class="level2" data-number="3">
<h2 data-number="3" class="anchored" data-anchor-id="a.2.1-steepest-ascent-식-a.5"><span class="header-section-number">3</span> § A.2.1 Steepest Ascent — 식 (A.5)</h2>
<section id="알고리즘" class="level3" data-number="3.1">
<h3 data-number="3.1" class="anchored" data-anchor-id="알고리즘"><span class="header-section-number">3.1</span> 알고리즘</h3>
<p>각 step 에서 그래디언트 방향으로 직선 탐색 (line search):</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7Bx%7D_%7Bk+1%7D%20=%20%5Cmathbf%7Bx%7D_k%20+%20d_k%20%5C,%20%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D_k)%20,%20%5Ctag%7B%EC%8B%9D%20A.5%7D%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?d_k"> 는 그 방향에서 <img src="https://latex.codecogs.com/png.latex?f"> 를 최대화하는 step size. 즉:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20d_k%20=%20%5Carg%5Cmax_%7Bd%20%3E%200%7D%20f%5Cbig(%5Cmathbf%7Bx%7D_k%20+%20d%20%5C,%20%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D_k)%5Cbig)%20.%20"></p>
<p>이 1D 최대화는 § A.1 의 도구 (bisection, secant, Newton) 로 풀어낸다.</p>
<section id="의사코드" class="level4" data-number="3.1.1">
<h4 data-number="3.1.1" class="anchored" data-anchor-id="의사코드"><span class="header-section-number">3.1.1</span> 의사코드</h4>
<pre><code>INPUT: f, ∇f (gradient), x_0, tol, max_iter
x ← x_0
FOR k = 0, 1, ..., max_iter:
    g ← ∇f(x)                                   # gradient
    IF ||g|| &lt; tol: BREAK                        # 수렴
    # 1D line search: argmax_d f(x + d·g)
    d_star ← line_search(d → f(x + d·g))         # § A.1 도구 사용
    x ← x + d_star · g
RETURN x</code></pre>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — “현재 점에서 가장 가파른 오르막” 만 사용
</div>
</div>
<div class="callout-body-container callout-body">
<p>각 step 에서 <strong>gradient 방향만</strong> 본다. Hessian 정보는 사용 안 함.</p>
<p><strong>왜 gradient 방향이 가장 가파른가</strong>: 단위 벡터 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bv%7D"> 방향의 <img src="https://latex.codecogs.com/png.latex?f"> 증가율은 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bu%7D%5Et%20%5Cmathbf%7Bv%7D">. 코시-슈바르츠 부등식으로 이 양은 <img src="https://latex.codecogs.com/png.latex?%5C%7C%5Cmathbf%7Bu%7D%5C%7C"> 에서 최대 (<img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bv%7D%20=%20%5Cmathbf%7Bu%7D/%5C%7C%5Cmathbf%7Bu%7D%5C%7C"> 일 때). 따라서 <strong>gradient 방향이 가장 가파른 오르막</strong>.</p>
<p><strong>Step size <img src="https://latex.codecogs.com/png.latex?d_k"></strong>: 그 방향에서 무한히 멀리 갈 게 아니라 <strong>최적 거리</strong> 까지만. 1D 최적화로 결정.</p>
<p><strong>비유</strong>: 안개 낀 산에서 손으로 더듬어 가장 가파른 방향을 느끼고 (gradient), 그 방향으로 균형 잃지 않을 만큼 (line search) 한 발 디딤. 안개라 멀리 못 봐도 매번 오르막은 올라간다.</p>
</div>
</div>
</section>
</section>
<section id="길쭉한-우도와-지그재그-steepest-ascent-의-한계" class="level3" data-number="3.2">
<h3 data-number="3.2" class="anchored" data-anchor-id="길쭉한-우도와-지그재그-steepest-ascent-의-한계"><span class="header-section-number">3.2</span> 길쭉한 우도와 지그재그 — Steepest Ascent 의 한계</h3>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 왜 길쭉한 우도에서 지그재그가 생기는가
</div>
</div>
<div class="callout-body-container callout-body">
<p>우도 함수가 <strong>길쭉한 타원</strong> 형태라고 상상하자 (한 축의 곡률이 다른 축의 100 배). 다음 두 사례를 본다.</p>
<p><strong>사례 1: 원형 우도</strong> (Hessian 의 eigenvalue 모두 같음). 모든 방향의 곡률 동일. - 점 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bx%7D_0"> 의 gradient 는 정확히 최대점 방향을 가리킴. - 한 step 의 line search 로 최대점 도달 (1 step 수렴).</p>
<p><strong>사례 2: 길쭉한 우도</strong> (한 축 곡률 큰 경우). 등고선이 가늘고 긴 타원. - 점 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bx%7D_0"> 의 gradient 는 등고선에 수직 방향이지만, <strong>이는 최대점 방향이 아니다</strong> (가파른 축 쪽으로 치우침). - Line search 로 그 방향의 최대점에 도달 — <strong>타원의 짧은 축의 다른 끝</strong> 근처에 도달. - 새 점에서의 gradient 는 또 등고선에 수직, <strong>이전 방향과 거의 직교</strong>. - 이렇게 직교 방향으로 번갈아 <strong>지그재그</strong> 진행. - 길쭉할수록 지그재그가 심해 수렴이 매우 느림 (<img src="https://latex.codecogs.com/png.latex?O(1/k)"> 수렴 — bisection 보다도 느릴 수 있음).</p>
<p>이는 <strong>Rosenbrock banana 함수</strong> 등에서 극단적으로 보이는 현상 — Steepest ascent 는 이런 함수에서 수백~수천 step 이 필요할 수 있다.</p>
<p><strong>해결</strong>: Newton-Raphson 의 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D%5E%7B-1%7D"> 정규화 — 길쭉한 우도를 둥글게 펴서 본 후 진행.</p>
</div>
</div>
</section>
<section id="steepest-ascent-의-사용-시점" class="level3" data-number="3.3">
<h3 data-number="3.3" class="anchored" data-anchor-id="steepest-ascent-의-사용-시점"><span class="header-section-number">3.3</span> Steepest Ascent 의 사용 시점</h3>
<table class="table">
<colgroup>
<col style="width: 50%">
<col style="width: 50%">
</colgroup>
<thead>
<tr class="header">
<th>조건</th>
<th>적합성</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Hessian 계산 불가</td>
<td>O (BFGS 같은 quasi-Newton 도 후보)</td>
</tr>
<tr class="even">
<td>우도 단봉 + 거의 원형</td>
<td>O</td>
</tr>
<tr class="odd">
<td>큰 Hessian (<img src="https://latex.codecogs.com/png.latex?p%20%5Cgeq%201000">)</td>
<td>O (<img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D%5E%7B-1%7D"> 비용 <img src="https://latex.codecogs.com/png.latex?O(p%5E3)"> 회피)</td>
</tr>
<tr class="even">
<td>길쭉한 우도</td>
<td>X (지그재그)</td>
</tr>
<tr class="odd">
<td>좋은 시작값 + 빠른 수렴 원할 때</td>
<td>X (Newton 우위)</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
머신러닝의 SGD 와의 관계
</div>
</div>
<div class="callout-body-container callout-body">
<p>신경망 훈련의 <strong>확률적 경사 하강 (SGD)</strong> 가 사실상 steepest descent (최소화 버전). <img src="https://latex.codecogs.com/png.latex?p"> 가 매우 큼 (수백만~수십억) 이라 Hessian 비현실 → gradient 기반만 사용.</p>
<p>생존분석은 보통 <img src="https://latex.codecogs.com/png.latex?p"> 가 작아 (<img src="https://latex.codecogs.com/png.latex?p%20%3C%20100">) Newton 이 우위. ML 의 high-dim 문제와 정반대 영역. § A.2 의 이론은 둘 다 같지만 실무 default 가 다르다.</p>
</div>
</div>
</section>
</section>
<section id="a.2.2-newton-raphson-다변수-식-a.6" class="level2" data-number="4">
<h2 data-number="4" class="anchored" data-anchor-id="a.2.2-newton-raphson-다변수-식-a.6"><span class="header-section-number">4</span> § A.2.2 Newton-Raphson 다변수 — 식 (A.6)</h2>
<section id="알고리즘-1" class="level3" data-number="4.1">
<h3 data-number="4.1" class="anchored" data-anchor-id="알고리즘-1"><span class="header-section-number">4.1</span> 알고리즘</h3>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7Bx%7D_%7Bk+1%7D%20=%20%5Cmathbf%7Bx%7D_k%20-%20%5Cmathbf%7BH%7D(%5Cmathbf%7Bx%7D_k)%5E%7B-1%7D%20%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D_k)%20.%20%5Ctag%7B%EC%8B%9D%20A.6%7D%20"></p>
<section id="의사코드-1" class="level4" data-number="4.1.1">
<h4 data-number="4.1.1" class="anchored" data-anchor-id="의사코드-1"><span class="header-section-number">4.1.1</span> 의사코드</h4>
<pre><code>INPUT: f, ∇f, ∇²f (Hessian), x_0, tol, max_iter
x ← x_0
FOR k = 0, 1, ..., max_iter:
    g ← ∇f(x)
    IF ||g|| &lt; tol: BREAK
    H ← ∇²f(x)
    Δ ← solve(H, g)                               # H · Δ = g
    x_new ← x - Δ
    IF f(x_new) &lt; f(x):                           # step-halving
        Δ ← Δ / 2
        x_new ← x - Δ
    x ← x_new
RETURN x</code></pre>
<p>(<code>solve(H, g)</code> 은 LU 분해 등으로 선형 system 푸는 것 — explicit <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D%5E%7B-1%7D"> 계산 회피, 더 안정.)</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — Hessian 으로 좌표를 정규화한 후 Steepest Ascent
</div>
</div>
<div class="callout-body-container callout-body">
<p>식 (A.6) 의 <img src="https://latex.codecogs.com/png.latex?-%5Cmathbf%7BH%7D%5E%7B-1%7D%20%5Cmathbf%7Bu%7D"> 는 다음과 동치:</p>
<ol type="1">
<li><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7By%7D%20=%20%5Cmathbf%7BH%7D%5E%7B1/2%7D%20(%5Cmathbf%7Bx%7D%20-%20%5Cmathbf%7Bx%7D%5E*)"> 로 좌표 변환 (<img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D%5E%7B1/2%7D"> 는 양의 정칙 부분).</li>
<li>이 새 좌표에서 우도가 등방성 (isotropic) — 모든 방향의 곡률 같음.</li>
<li>등방성 좌표에서 steepest ascent 한 step.</li>
<li>원래 좌표로 역변환.</li>
</ol>
<p>즉 <strong>길쭉한 우도를 둥글게 편 다음 steepest ascent</strong>. 이것이 Newton 의 본질.</p>
<p><strong>기하적</strong>: 우도의 2차 Taylor 근사 <img src="https://latex.codecogs.com/png.latex?f(%5Cmathbf%7Bx%7D_0)%20+%20%5Cmathbf%7Bu%7D%5Et%20%5CDelta%20+%20%5Cfrac%7B1%7D%7B2%7D%20%5CDelta%5Et%20%5Cmathbf%7BH%7D%20%5CDelta"> 의 최대점이 정확히 <img src="https://latex.codecogs.com/png.latex?%5CDelta%20=%20-%5Cmathbf%7BH%7D%5E%7B-1%7D%20%5Cmathbf%7Bu%7D">. 즉 <strong>2차 근사의 최대점으로 한 번에 점프</strong>.</p>
<p>우도가 정확히 quadratic 이면 1 step 으로 도달. 일반 우도는 quadratic 근사가 점점 정확해져 quadratic 수렴.</p>
</div>
</div>
</section>
</section>
<section id="차-수렴" class="level3" data-number="4.2">
<h3 data-number="4.2" class="anchored" data-anchor-id="차-수렴"><span class="header-section-number">4.2</span> 2차 수렴</h3>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Quadratic 수렴의 정량적 의미
</div>
</div>
<div class="callout-body-container callout-body">
<p>오차 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Be%7D_k%20=%20%5Cmathbf%7Bx%7D_k%20-%20%5Chat%7B%5Cmathbf%7Bx%7D%7D"> 에 대해:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5C%7C%5Cmathbf%7Be%7D_%7Bk+1%7D%5C%7C%20%5Cleq%20C%20%5C%7C%5Cmathbf%7Be%7D_k%5C%7C%5E2%20,%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?C"> 는 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 의 third-order 도함수에 의존하는 상수.</p>
<table class="table">
<thead>
<tr class="header">
<th>Step</th>
<th><img src="https://latex.codecogs.com/png.latex?%5C%7C%5Cmathbf%7Be%7D_k%5C%7C"></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>0</td>
<td><img src="https://latex.codecogs.com/png.latex?10%5E%7B-2%7D"></td>
</tr>
<tr class="even">
<td>1</td>
<td><img src="https://latex.codecogs.com/png.latex?10%5E%7B-4%7D"> (가정 <img src="https://latex.codecogs.com/png.latex?C%20%5Capprox%201">)</td>
</tr>
<tr class="odd">
<td>2</td>
<td><img src="https://latex.codecogs.com/png.latex?10%5E%7B-8%7D"></td>
</tr>
<tr class="even">
<td>3</td>
<td><img src="https://latex.codecogs.com/png.latex?10%5E%7B-16%7D"> (기계 정밀도)</td>
</tr>
</tbody>
</table>
<p>3-4 step 만에 16 자리 정밀도 — 단변수 Newton 과 동일한 폭발적 가속. <strong>이것이 Newton 의 가장 큰 매력</strong>.</p>
</div>
</div>
</section>
<section id="발산-사례-newton-의-약점" class="level3" data-number="4.3">
<h3 data-number="4.3" class="anchored" data-anchor-id="발산-사례-newton-의-약점"><span class="header-section-number">4.3</span> 발산 사례 — Newton 의 약점</h3>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
다변수 Newton 이 실패하는 경우
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>1. <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 가 ill-conditioned 또는 singular</strong>: Eigenvalue 중 하나가 0 에 매우 가까우면 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D%5E%7B-1%7D"> 폭발. 모수 식별 불가능 또는 약한 식별성.</p>
<p><strong>2. <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 가 양의 정칙이 아님</strong>: 안장점 또는 최소값 근처. Newton 은 그런 점에서도 영점으로 인식해 잘못된 방향 진행.</p>
<p><strong>3. Overshoot</strong>: <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bx%7D_k"> 가 영점에서 멀고 quadratic 근사가 부정확하면 <img src="https://latex.codecogs.com/png.latex?%5C%7C%5CDelta%5C%7C"> 가 커 영점 너머로 점프 → 발산.</p>
<p><strong>4. 잘못된 방향 — <img src="https://latex.codecogs.com/png.latex?f"> 감소</strong>: <img src="https://latex.codecogs.com/png.latex?f(%5Cmathbf%7Bx%7D_%7Bk+1%7D)%20%3C%20f(%5Cmathbf%7Bx%7D_k)"> → 최대화에 반대 방향.</p>
<p><strong>대처 — Step-Halving (SAS Cox 의 표준)</strong>:</p>
<pre><code>Δ ← H⁻¹ u
x_new ← x - Δ
WHILE f(x_new) &lt; f(x) AND ||Δ|| &gt; eps:
    Δ ← Δ / 2
    x_new ← x - Δ</code></pre>
<p><img src="https://latex.codecogs.com/png.latex?f"> 가 증가할 때까지 step 을 절반씩 줄임. 작은 step 이라도 항상 증가 보장.</p>
<p><strong>대안 — Damped Newton 또는 trust region</strong>: Step 크기를 사전 제한 (<img src="https://latex.codecogs.com/png.latex?%5C%7C%5CDelta%5C%7C%20%5Cleq%20%5Cdelta_k">). Trust region 은 modern 표준.</p>
</div>
</div>
</section>
</section>
<section id="a.2.3-marquardts-method-steepest-와-newton-의-절충" class="level2" data-number="5">
<h2 data-number="5" class="anchored" data-anchor-id="a.2.3-marquardts-method-steepest-와-newton-의-절충"><span class="header-section-number">5</span> § A.2.3 Marquardt’s Method — Steepest 와 Newton 의 절충</h2>
<section id="알고리즘-2" class="level3" data-number="5.1">
<h3 data-number="5.1" class="anchored" data-anchor-id="알고리즘-2"><span class="header-section-number">5.1</span> 알고리즘</h3>
<p><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BS%7D_k"> 를 대각 스케일 행렬 (<img src="https://latex.codecogs.com/png.latex?S_%7Bii%7D%20=%20%7CH_%7Bii%7D(%5Cmathbf%7Bx%7D_k)%7C%5E%7B-1/2%7D">). <img src="https://latex.codecogs.com/png.latex?%5Cgamma%20%5Cgeq%200"> 을 blending 상수.</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7Bx%7D_%7Bk+1%7D%20=%20%5Cmathbf%7Bx%7D_k%20-%20%5Cmathbf%7BS%7D_k%20%5Cbig(%5Cmathbf%7BS%7D_k%20%5Cmathbf%7BH%7D(%5Cmathbf%7Bx%7D_k)%20%5Cmathbf%7BS%7D_k%20+%20%5Cgamma%20%5Cmathbf%7BI%7D%5Cbig)%5E%7B-1%7D%20%5Cmathbf%7BS%7D_k%20%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D_k)%20.%20"></p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — <img src="https://latex.codecogs.com/png.latex?%5Cgamma"> 가 두 방법을 잇는 다이얼
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong><img src="https://latex.codecogs.com/png.latex?%5Cgamma%20=%200"></strong>: <img src="https://latex.codecogs.com/png.latex?(%5Cmathbf%7BS%7D_k%20%5Cmathbf%7BH%7D%20%5Cmathbf%7BS%7D_k)%5E%7B-1%7D"> 만 남음 → 정규화된 Newton-Raphson (스케일 행렬은 단순 normalization).</p>
<p><strong><img src="https://latex.codecogs.com/png.latex?%5Cgamma%20%5Cto%20%5Cinfty"></strong>: 분모의 <img src="https://latex.codecogs.com/png.latex?%5Cgamma%20%5Cmathbf%7BI%7D"> 가 지배 → <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BS%7D_k%20%5Ccdot%20%5Cfrac%7B%5Cmathbf%7BS%7D_k%20%5Cmathbf%7Bu%7D%7D%7B%5Cgamma%7D"> → steepest ascent (Hessian 영향 사라짐).</p>
<p><strong>중간 <img src="https://latex.codecogs.com/png.latex?%5Cgamma"></strong>: 둘의 보간. <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 가 양의 정칙이 아닐 때도 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BS%7D_k%20%5Cmathbf%7BH%7D%20%5Cmathbf%7BS%7D_k%20+%20%5Cgamma%20%5Cmathbf%7BI%7D"> 가 양의 정칙이 되어 안정.</p>
<p><strong>핵심 통찰</strong> (Marquardt 1963): “<img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 가 신뢰할 만하면 Newton 쪽 (<img src="https://latex.codecogs.com/png.latex?%5Cgamma"> 작게), 못 믿겠으면 steepest 쪽 (<img src="https://latex.codecogs.com/png.latex?%5Cgamma"> 크게).”</p>
</div>
</div>
</section>
<section id="적응-절차-adaptive" class="level3" data-number="5.2">
<h3 data-number="5.2" class="anchored" data-anchor-id="적응-절차-adaptive"><span class="header-section-number">5.2</span> 적응 절차 (Adaptive)</h3>
<pre><code>INPUT: f, ∇f, ∇²f, x_0, γ_0 = 0.001, tol
x ← x_0
γ ← γ_0
FOR k = 0, 1, ...:
    g ← ∇f(x); H ← ∇²f(x); S ← diag(|H_ii|^(-1/2))
    M ← S·H·S + γ·I
    Δ ← S · solve(M, S·g)
    x_new ← x - Δ
    IF f(x_new) &gt; f(x):                        # 진전
        x ← x_new
        γ ← γ / 10                             # 다음에 더 Newton 쪽
    ELSE:                                       # 후퇴
        γ ← γ × 10                             # 더 steepest 쪽으로
        # x 는 그대로, γ 만 늘려 재시도
    IF ||g|| &lt; tol AND γ small: BREAK
    # 마지막 step 은 γ = 0 (순수 Newton) 으로 정확 마무리</code></pre>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
비유 — 운전 경험에 따라 액셀 강도 조절
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li>직선 도로 (Newton 신뢰): <img src="https://latex.codecogs.com/png.latex?%5Cgamma"> 작게 → 액셀 풀로 (빠름).</li>
<li>굽은 도로 (Newton 의심): <img src="https://latex.codecogs.com/png.latex?%5Cgamma"> 크게 → 안전 운전 (steepest, 느리지만 안전).</li>
</ul>
<p>이 적응이 <strong>단일 method 보다 거의 항상 빠름</strong> — 처음에는 안전, 끝에서는 빠르게.</p>
<p><strong>LM 의 다른 응용</strong>: 비선형 최소제곱 문제 (<code>nls()</code> in R, <code>scipy.optimize.least_squares(method='lm')</code>) 의 표준. 회귀 잔차 제곱합 최소화에서는 Hessian 이 이론상 양의 정칙이지만 작은 표본 / 모형 오설정에서 문제 발생 → LM 의 견고성이 결정적.</p>
</div>
</div>
</section>
</section>
<section id="수렴-판정-4-가지-기준" class="level2" data-number="6">
<h2 data-number="6" class="anchored" data-anchor-id="수렴-판정-4-가지-기준"><span class="header-section-number">6</span> 수렴 판정 — 4 가지 기준</h2>
<p>다변수 최적화에서는 단일 기준이 부족, 여러 기준 조합 사용:</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
수렴 판정 4 가지
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>1. 함수값 변화</strong> (<img src="https://latex.codecogs.com/png.latex?%5Cepsilon%20=%2010%5E%7B-6%7D"> 권장):</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%7Cf(%5Cmathbf%7Bx%7D_%7Bk+1%7D)%20-%20f(%5Cmathbf%7Bx%7D_k)%7C%20%3C%20%5Cepsilon%20%5Cquad%20%5Ctext%7B%EB%98%90%EB%8A%94%7D%20%5Cquad%20%5Cfrac%7B%7Cf(%5Cmathbf%7Bx%7D_%7Bk+1%7D)%20-%20f(%5Cmathbf%7Bx%7D_k)%7C%7D%7B%7Cf(%5Cmathbf%7Bx%7D_k)%7C%7D%20%3C%20%5Cepsilon%20.%20"></p>
<p><strong>2. Gradient 노름</strong>:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Csum_j%20u_j(%5Cmathbf%7Bx%7D_%7Bk+1%7D)%5E2%20%3C%20%5Cepsilon%20%5Cquad%20%5Ctext%7B%EB%98%90%EB%8A%94%7D%20%5Cquad%20%5Cmax_j%20%7Cu_j(%5Cmathbf%7Bx%7D_%7Bk+1%7D)%7C%20%3C%20%5Cepsilon%20.%20"></p>
<p><strong>3. 모수 변화</strong>:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Csum_j%20(x_%7Bk+1,%20j%7D%20-%20x_%7Bk,%20j%7D)%5E2%20%3C%20%5Cepsilon%20%5Cquad%20%5Ctext%7B%EB%98%90%EB%8A%94%7D%20%5Cquad%20%5Cmax_j%20%7Cx_%7Bk+1,%20j%7D%20-%20x_%7Bk,%20j%7D%7C%20%3C%20%5Cepsilon%20.%20"></p>
<p><strong>4. 반복 한계</strong> (안전장치):</p>
<p><img src="https://latex.codecogs.com/png.latex?%20k%20%5Cgeq%20k_%7B%5Cmax%7D%20%5Cquad%20(%5Ctext%7B%EB%B3%B4%ED%86%B5%20%7D%20100%20%5Ctext%7B%20%EB%98%90%EB%8A%94%20%7D%20500)%20.%20"></p>
<p><strong>실무</strong>: (1) + (2) 둘 다 점검. (3) 은 보조 — 함수가 평탄하면 모수가 변해도 진정한 최적이 아닐 수 있음. (4) 는 발산 방지.</p>
<p><strong>기준 충돌 사례</strong>: <img src="https://latex.codecogs.com/png.latex?%5C%7C%5Cmathbf%7Bu%7D%5C%7C"> 작은데 <img src="https://latex.codecogs.com/png.latex?%5C%7C%5CDelta%20%5Cmathbf%7Bx%7D%5C%7C"> 큼 → 평탄 영역에서 조심해야 함. 또는 <img src="https://latex.codecogs.com/png.latex?%7C%5CDelta%20f%7C"> 작은데 <img src="https://latex.codecogs.com/png.latex?%5C%7C%5Cmathbf%7Bu%7D%5C%7C"> 큼 → quadratic 근사 부정확.</p>
</div>
</div>
</section>
<section id="example-a.2-weibull-λ-α-mle" class="level2" data-number="7">
<h2 data-number="7" class="anchored" data-anchor-id="example-a.2-weibull-λ-α-mle"><span class="header-section-number">7</span> Example A.2 — Weibull (λ, α) MLE</h2>
<section id="데이터와-모형" class="level3" data-number="7.1">
<h3 data-number="7.1" class="anchored" data-anchor-id="데이터와-모형"><span class="header-section-number">7.1</span> 데이터와 모형</h3>
<p>§ A.1 의 Example A.1 과 같은 10 obs:</p>
<pre><code>t = (2.57, 0.58, 0.82, 1.02, 0.78, 0.46, 1.04, 0.43, 0.69, 1.37)</code></pre>
<p><img src="https://latex.codecogs.com/png.latex?n%20=%2010">, <img src="https://latex.codecogs.com/png.latex?%5Csum%20t_j%20%5Capprox%209.76">.</p>
<p>이번엔 두 모수 <img src="https://latex.codecogs.com/png.latex?S(t)%20=%20%5Cexp(-%5Clambda%20t%5E%5Calpha)"> 모두 추정.</p>
<section id="log-likelihood-score-hessian" class="level4" data-number="7.1.1">
<h4 data-number="7.1.1" class="anchored" data-anchor-id="log-likelihood-score-hessian"><span class="header-section-number">7.1.1</span> Log-likelihood, Score, Hessian</h4>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cell(%5Clambda,%20%5Calpha)%20=%20n%20%5Cln%20%5Clambda%20+%20n%20%5Cln%20%5Calpha%20+%20(%5Calpha%20-%201)%20%5Csum%20%5Cln%20t_j%20-%20%5Clambda%20%5Csum%20t_j%5E%5Calpha%20.%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7Bu%7D(%5Clambda,%20%5Calpha)%20=%20%5Cbegin%7Bpmatrix%7D%20u_%5Clambda%20%5C%5C%20u_%5Calpha%20%5Cend%7Bpmatrix%7D%20=%20%5Cbegin%7Bpmatrix%7D%20n/%5Clambda%20-%20%5Csum%20t_j%5E%5Calpha%20%5C%5C%20n/%5Calpha%20+%20%5Csum%20%5Cln%20t_j%20-%20%5Clambda%20%5Csum%20t_j%5E%5Calpha%20%5Cln%20t_j%20%5Cend%7Bpmatrix%7D%20.%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7BH%7D(%5Clambda,%20%5Calpha)%20=%20%5Cbegin%7Bpmatrix%7D%0A-n/%5Clambda%5E2%20&amp;%20-%5Csum%20t_j%5E%5Calpha%20%5Cln%20t_j%20%5C%5C%0A-%5Csum%20t_j%5E%5Calpha%20%5Cln%20t_j%20&amp;%20-n/%5Calpha%5E2%20-%20%5Clambda%20%5Csum%20t_j%5E%5Calpha%20(%5Cln%20t_j)%5E2%0A%5Cend%7Bpmatrix%7D%20.%20"></p>
</section>
<section id="시작값" class="level4" data-number="7.1.2">
<h4 data-number="7.1.2" class="anchored" data-anchor-id="시작값"><span class="header-section-number">7.1.2</span> 시작값</h4>
<p>Method-of-moments 추정: <img src="https://latex.codecogs.com/png.latex?%5Calpha_0%20=%201"> (지수분포 가정), <img src="https://latex.codecogs.com/png.latex?%5Clambda_0%20=%2010/%5Csum%20t_j%20%5Capprox%201.024">. 초기 log-likelihood <img src="https://latex.codecogs.com/png.latex?%5Cell(%5Clambda_0,%20%5Calpha_0)%20=%20-9.757">.</p>
<p>정지 기준: <img src="https://latex.codecogs.com/png.latex?%5Cmax(%7Cu_%5Clambda%7C,%20%7Cu_%5Calpha%7C)%20%3C%200.1">.</p>
</section>
</section>
<section id="steepest-ascent-5-step-trace" class="level3" data-number="7.2">
<h3 data-number="7.2" class="anchored" data-anchor-id="steepest-ascent-5-step-trace"><span class="header-section-number">7.2</span> Steepest Ascent — 5 step Trace</h3>
<table class="table">
<colgroup>
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
</colgroup>
<thead>
<tr class="header">
<th>Step <img src="https://latex.codecogs.com/png.latex?k"></th>
<th><img src="https://latex.codecogs.com/png.latex?%5Clambda_k"></th>
<th><img src="https://latex.codecogs.com/png.latex?%5Calpha_k"></th>
<th><img src="https://latex.codecogs.com/png.latex?%5Cell"></th>
<th><img src="https://latex.codecogs.com/png.latex?u_%5Clambda"></th>
<th><img src="https://latex.codecogs.com/png.latex?u_%5Calpha"></th>
<th><img src="https://latex.codecogs.com/png.latex?d_k"></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>0</td>
<td>1.024</td>
<td>1.000</td>
<td><img src="https://latex.codecogs.com/png.latex?-9.757"></td>
<td>0.001</td>
<td>7.035</td>
<td>0.098</td>
</tr>
<tr class="even">
<td>1</td>
<td>1.025</td>
<td>1.693</td>
<td><img src="https://latex.codecogs.com/png.latex?-7.491"></td>
<td>0.001</td>
<td><img src="https://latex.codecogs.com/png.latex?-1.80"></td>
<td>0.089</td>
</tr>
<tr class="odd">
<td>2</td>
<td>0.865</td>
<td>1.694</td>
<td><img src="https://latex.codecogs.com/png.latex?-7.339"></td>
<td>0.661</td>
<td>0.001</td>
<td>0.126</td>
</tr>
<tr class="even">
<td>3</td>
<td>0.865</td>
<td>1.777</td>
<td><img src="https://latex.codecogs.com/png.latex?-7.311"></td>
<td>0.000</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.363"></td>
<td>0.073</td>
</tr>
<tr class="odd">
<td>4</td>
<td>0.839</td>
<td>1.777</td>
<td><img src="https://latex.codecogs.com/png.latex?-7.307"></td>
<td>0.121</td>
<td>0.000</td>
<td>0.128</td>
</tr>
<tr class="even">
<td>5</td>
<td>0.839</td>
<td>1.792</td>
<td><img src="https://latex.codecogs.com/png.latex?-7.306"></td>
<td>0.000</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.072"></td>
<td>0.007</td>
</tr>
</tbody>
</table>
<p><strong>5 step 후 <img src="https://latex.codecogs.com/png.latex?(%5Chat%7B%5Clambda%7D,%20%5Chat%7B%5Calpha%7D)%20=%20(0.839,%201.792)"></strong>.</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Trace 의 패턴 — 지그재그 명확
</div>
</div>
<div class="callout-body-container callout-body">
<p>각 step 의 변화:</p>
<ul>
<li><strong>Step 0 → 1</strong>: <img src="https://latex.codecogs.com/png.latex?%5Calpha"> 만 거의 변화 (1.000 → 1.693). <img src="https://latex.codecogs.com/png.latex?%5Clambda"> 거의 그대로 (1.024 → 1.025). <img src="https://latex.codecogs.com/png.latex?u_%5Calpha%20=%207.035"> 가 <img src="https://latex.codecogs.com/png.latex?u_%5Clambda%20=%200.001"> 의 압도적으로 크므로 gradient 가 거의 <img src="https://latex.codecogs.com/png.latex?%5Calpha"> 방향.</li>
<li><strong>Step 1 → 2</strong>: <img src="https://latex.codecogs.com/png.latex?%5Clambda"> 만 거의 변화 (1.025 → 0.865). <img src="https://latex.codecogs.com/png.latex?%5Calpha"> 거의 그대로 (1.693 → 1.694). 새 gradient 가 거의 <img src="https://latex.codecogs.com/png.latex?%5Clambda"> 방향.</li>
<li><strong>Step 2 → 3</strong>: <img src="https://latex.codecogs.com/png.latex?%5Calpha"> 변화 (1.694 → 1.777). <img src="https://latex.codecogs.com/png.latex?%5Clambda"> 그대로.</li>
<li><strong>Step 3 → 4</strong>: <img src="https://latex.codecogs.com/png.latex?%5Clambda"> 변화. <img src="https://latex.codecogs.com/png.latex?%5Calpha"> 그대로.</li>
<li><strong>Step 4 → 5</strong>: <img src="https://latex.codecogs.com/png.latex?%5Calpha"> 변화. <img src="https://latex.codecogs.com/png.latex?%5Clambda"> 그대로.</li>
</ul>
<p>즉 <strong>각 step 이 한 모수씩 번갈아 큰 변화</strong> — 이것이 길쭉한 우도 함수의 지그재그 패턴이다.</p>
<p>수렴은 결국 도달하지만 step 수가 많고 (5 step) 진행이 비효율적. Newton 의 Hessian 정규화가 이 비효율을 해결한다 (다음 절).</p>
</div>
</div>
</section>
<section id="newton-raphson-다변수-3-step-trace" class="level3" data-number="7.3">
<h3 data-number="7.3" class="anchored" data-anchor-id="newton-raphson-다변수-3-step-trace"><span class="header-section-number">7.3</span> Newton-Raphson 다변수 — 3 step Trace</h3>
<p>같은 시작값 + 정지 기준.</p>
<table class="table">
<colgroup>
<col style="width: 12%">
<col style="width: 12%">
<col style="width: 12%">
<col style="width: 12%">
<col style="width: 12%">
<col style="width: 12%">
<col style="width: 12%">
<col style="width: 12%">
</colgroup>
<thead>
<tr class="header">
<th>Step <img src="https://latex.codecogs.com/png.latex?k"></th>
<th><img src="https://latex.codecogs.com/png.latex?%5Clambda_k"></th>
<th><img src="https://latex.codecogs.com/png.latex?%5Calpha_k"></th>
<th><img src="https://latex.codecogs.com/png.latex?u_%5Clambda"></th>
<th><img src="https://latex.codecogs.com/png.latex?u_%5Calpha"></th>
<th><img src="https://latex.codecogs.com/png.latex?H_%7B%5Clambda%5Clambda%7D"></th>
<th><img src="https://latex.codecogs.com/png.latex?H_%7B%5Calpha%5Calpha%7D"></th>
<th><img src="https://latex.codecogs.com/png.latex?H_%7B%5Clambda%5Calpha%7D"></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>0</td>
<td>1.024</td>
<td>1.000</td>
<td>0.001</td>
<td>7.035</td>
<td><img src="https://latex.codecogs.com/png.latex?-9.537"></td>
<td><img src="https://latex.codecogs.com/png.latex?-13.449"></td>
<td><img src="https://latex.codecogs.com/png.latex?-1.270"></td>
</tr>
<tr class="even">
<td>1</td>
<td>0.954</td>
<td>1.530</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.471"></td>
<td>1.684</td>
<td><img src="https://latex.codecogs.com/png.latex?-10.987"></td>
<td><img src="https://latex.codecogs.com/png.latex?-8.657"></td>
<td><img src="https://latex.codecogs.com/png.latex?-3.34"></td>
</tr>
<tr class="odd">
<td>2</td>
<td>0.838</td>
<td>1.769</td>
<td>0.035</td>
<td>0.181</td>
<td><img src="https://latex.codecogs.com/png.latex?-14.223"></td>
<td><img src="https://latex.codecogs.com/png.latex?-7.783"></td>
<td><img src="https://latex.codecogs.com/png.latex?-1.220"></td>
</tr>
<tr class="even">
<td>3</td>
<td>0.832</td>
<td>1.796</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.001"></td>
<td>0.001</td>
<td><img src="https://latex.codecogs.com/png.latex?-14.431"></td>
<td><img src="https://latex.codecogs.com/png.latex?-7.750"></td>
<td><img src="https://latex.codecogs.com/png.latex?-4.539"></td>
</tr>
</tbody>
</table>
<p><strong>3 step 후 <img src="https://latex.codecogs.com/png.latex?(%5Chat%7B%5Clambda%7D,%20%5Chat%7B%5Calpha%7D)%20=%20(0.832,%201.796)"></strong>.</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Newton 의 첫 step 분석
</div>
</div>
<div class="callout-body-container callout-body">
<p>Step 0 → 1: <img src="https://latex.codecogs.com/png.latex?%5CDelta%20=%20-%5Cmathbf%7BH%7D%5E%7B-1%7D%20%5Cmathbf%7Bu%7D">. Hessian:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7BH%7D%20=%20%5Cbegin%7Bpmatrix%7D%20-9.537%20&amp;%20-1.270%20%5C%5C%20-1.270%20&amp;%20-13.449%20%5Cend%7Bpmatrix%7D,%20%5Cquad%20%5Cdet(%5Cmathbf%7BH%7D)%20=%209.537%20%5Ctimes%2013.449%20-%201.270%5E2%20=%20126.65%20.%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D%5E%7B-1%7D%20=%20%5Cfrac%7B1%7D%7B126.65%7D%20%5Cbegin%7Bpmatrix%7D%20-13.449%20&amp;%201.270%20%5C%5C%201.270%20&amp;%20-9.537%20%5Cend%7Bpmatrix%7D">.</p>
<p><img src="https://latex.codecogs.com/png.latex?%5CDelta%20=%20-%5Cmathbf%7BH%7D%5E%7B-1%7D%20%5Cmathbf%7Bu%7D%20=%20-%5Cfrac%7B1%7D%7B126.65%7D%20%5Cbegin%7Bpmatrix%7D%20-13.449%20%5Ccdot%200.001%20+%201.270%20%5Ccdot%207.035%20%5C%5C%201.270%20%5Ccdot%200.001%20+%20(-9.537)%20%5Ccdot%207.035%20%5Cend%7Bpmatrix%7D%20%5Capprox%20%5Cbegin%7Bpmatrix%7D%20-0.07%20%5C%5C%200.530%20%5Cend%7Bpmatrix%7D">.</p>
<p>따라서 새 점: <img src="https://latex.codecogs.com/png.latex?(1.024%20-%200.07,%201.000%20+%200.530)%20=%20(0.954,%201.530)"> — 표 첫 행과 일치.</p>
<p>Step 1 의 <img src="https://latex.codecogs.com/png.latex?%5Calpha"> 변화 <img src="https://latex.codecogs.com/png.latex?1.000%20%E2%86%92%201.530"> 은 steepest 의 <img src="https://latex.codecogs.com/png.latex?1.000%20%E2%86%92%201.693"> 보다 적다 (overshoot 회피). 그러나 동시에 <img src="https://latex.codecogs.com/png.latex?%5Clambda"> 도 적절히 줄임 (<img src="https://latex.codecogs.com/png.latex?1.024%20%E2%86%92%200.954">) — <strong>두 모수를 동시에 합리적으로 update</strong>, steepest 의 한 모수씩 변화 패턴 회피.</p>
<p>이것이 Hessian 의 cross-term (<img src="https://latex.codecogs.com/png.latex?H_%7B%5Clambda%5Calpha%7D">) 이 만드는 차이 — 두 모수의 상관을 고려해 동시 update.</p>
</div>
</div>
</section>
<section id="marquardt-5-step-trace-gamma-0.5" class="level3" data-number="7.4">
<h3 data-number="7.4" class="anchored" data-anchor-id="marquardt-5-step-trace-gamma-0.5"><span class="header-section-number">7.4</span> Marquardt — 5 step Trace (<img src="https://latex.codecogs.com/png.latex?%5Cgamma%20=%200.5">)</h3>
<table class="table">
<colgroup>
<col style="width: 12%">
<col style="width: 12%">
<col style="width: 12%">
<col style="width: 12%">
<col style="width: 12%">
<col style="width: 12%">
<col style="width: 12%">
<col style="width: 12%">
</colgroup>
<thead>
<tr class="header">
<th>Step <img src="https://latex.codecogs.com/png.latex?k"></th>
<th><img src="https://latex.codecogs.com/png.latex?%5Clambda_k"></th>
<th><img src="https://latex.codecogs.com/png.latex?%5Calpha_k"></th>
<th><img src="https://latex.codecogs.com/png.latex?u_%5Clambda"></th>
<th><img src="https://latex.codecogs.com/png.latex?u_%5Calpha"></th>
<th><img src="https://latex.codecogs.com/png.latex?H_%7B%5Clambda%5Clambda%7D"></th>
<th><img src="https://latex.codecogs.com/png.latex?H_%7B%5Calpha%5Calpha%7D"></th>
<th><img src="https://latex.codecogs.com/png.latex?H_%7B%5Clambda%5Calpha%7D"></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>0</td>
<td>1.024</td>
<td>1.000</td>
<td>0.001</td>
<td>7.035</td>
<td><img src="https://latex.codecogs.com/png.latex?-9.537"></td>
<td><img src="https://latex.codecogs.com/png.latex?-13.449"></td>
<td><img src="https://latex.codecogs.com/png.latex?-1.270"></td>
</tr>
<tr class="even">
<td>1</td>
<td>0.993</td>
<td>1.351</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.357"></td>
<td>3.189</td>
<td><img src="https://latex.codecogs.com/png.latex?-10.136"></td>
<td><img src="https://latex.codecogs.com/png.latex?-9.534"></td>
<td><img src="https://latex.codecogs.com/png.latex?-2.565"></td>
</tr>
<tr class="odd">
<td>2</td>
<td>0.930</td>
<td>1.585</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.394"></td>
<td>1.295</td>
<td><img src="https://latex.codecogs.com/png.latex?-11.557"></td>
<td><img src="https://latex.codecogs.com/png.latex?-8.424"></td>
<td><img src="https://latex.codecogs.com/png.latex?-3.599"></td>
</tr>
<tr class="even">
<td>3</td>
<td>0.883</td>
<td>1.701</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.275"></td>
<td>0.523</td>
<td><img src="https://latex.codecogs.com/png.latex?-12.813"></td>
<td><img src="https://latex.codecogs.com/png.latex?-8.049"></td>
<td><img src="https://latex.codecogs.com/png.latex?-4.176"></td>
</tr>
<tr class="odd">
<td>4</td>
<td>0.858</td>
<td>1.753</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.162"></td>
<td>0.218</td>
<td><img src="https://latex.codecogs.com/png.latex?-13.591"></td>
<td><img src="https://latex.codecogs.com/png.latex?-7.891"></td>
<td><img src="https://latex.codecogs.com/png.latex?-4.453"></td>
</tr>
<tr class="even">
<td>5</td>
<td>0.845</td>
<td>1.777</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.087"></td>
<td>0.094</td>
<td><img src="https://latex.codecogs.com/png.latex?-14.013"></td>
<td><img src="https://latex.codecogs.com/png.latex?-7.817"></td>
<td><img src="https://latex.codecogs.com/png.latex?-4.581"></td>
</tr>
</tbody>
</table>
<p><strong>5 step 후 <img src="https://latex.codecogs.com/png.latex?(%5Chat%7B%5Clambda%7D,%20%5Chat%7B%5Calpha%7D)%20=%20(0.845,%201.777)"></strong>.</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Marquardt 의 보수적 진행
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?%5Cgamma%20=%200.5"> 의 고정값 (적응 안 함). 효과:</p>
<ul>
<li>Newton 의 첫 step (1.024, 1.000) → (0.954, 1.530) 보다 <strong>더 보수적</strong> — Marquardt 는 (0.993, 1.351) 로 절반쯤만 진행.</li>
<li>매 step 의 변화도 작음 — 안전하게 천천히 도달.</li>
<li>결국 5 step 필요 (Newton 의 3 step 보다 많음).</li>
</ul>
<p><strong><img src="https://latex.codecogs.com/png.latex?%5Cgamma"> 적응이 없을 때</strong>의 Marquardt 가 보여주는 안전 운전 패턴. 적응 (<img src="https://latex.codecogs.com/png.latex?%5Cgamma"> 자동 조절) 을 사용하면 끝 step 에서 <img src="https://latex.codecogs.com/png.latex?%5Cgamma%20%5Cto%200"> 으로 Newton 과 동등해져 더 빠르다.</p>
</div>
</div>
</section>
<section id="세-방법-종합-비교-example-a.2" class="level3" data-number="7.5">
<h3 data-number="7.5" class="anchored" data-anchor-id="세-방법-종합-비교-example-a.2"><span class="header-section-number">7.5</span> 세 방법 종합 비교 — Example A.2</h3>
<table class="table">
<colgroup>
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
</colgroup>
<thead>
<tr class="header">
<th>방법</th>
<th>Step</th>
<th><img src="https://latex.codecogs.com/png.latex?(%5Chat%7B%5Clambda%7D,%20%5Chat%7B%5Calpha%7D)"></th>
<th>마지막 <img src="https://latex.codecogs.com/png.latex?%5Cmax(%7Cu_%5Clambda%7C,%20%7Cu_%5Calpha%7C)"></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Steepest Ascent</td>
<td>5</td>
<td><img src="https://latex.codecogs.com/png.latex?(0.839,%201.792)"></td>
<td>0.072</td>
</tr>
<tr class="even">
<td>Newton-Raphson</td>
<td>3</td>
<td><img src="https://latex.codecogs.com/png.latex?(0.832,%201.796)"></td>
<td>0.001</td>
</tr>
<tr class="odd">
<td>Marquardt (<img src="https://latex.codecogs.com/png.latex?%5Cgamma%20=%200.5">)</td>
<td>5</td>
<td><img src="https://latex.codecogs.com/png.latex?(0.845,%201.777)"></td>
<td>0.094</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
통찰 — 세 방법의 trade-off 가 명확히 보임
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>Newton 의 우월성</strong>: - Step 수: 3 (Marquardt/Steepest 의 5 보다 적음). - 마지막 정확도: <img src="https://latex.codecogs.com/png.latex?%7Cu%7C%20=%200.001"> — Marquardt/Steepest 의 0.07-0.09 보다 100 배 정확. - 점추정: <img src="https://latex.codecogs.com/png.latex?(0.832,%201.796)"> — 다른 방법과 약간 다름 (정지 기준 안에서의 우연 차이).</p>
<p><strong>Steepest 의 비효율</strong>: - 한 모수씩 번갈아 변화 (지그재그). - 같은 step 수로 Marquardt 와 비슷.</p>
<p><strong>Marquardt 의 안전</strong>: - 보수적 진행, 중간 step 의 안정성 좋음. - 적응 (<img src="https://latex.codecogs.com/png.latex?%5Cgamma"> 조절) 추가하면 Newton 과 동등 속도까지 가능.</p>
<p><strong>실무 권고</strong>: - 단일 우도 함수, 좋은 시작값 → <strong>Newton</strong>. - 복잡한 모형, 시작값 불안정 → <strong>Marquardt 적응</strong>. - 매우 큰 <img src="https://latex.codecogs.com/png.latex?p">, Hessian 비싼 경우 → <strong>BFGS / L-BFGS</strong> (다음 절).</p>
</div>
</div>
</section>
</section>
<section id="quasi-newton-bfgs-klein-미언급의-표준" class="level2" data-number="8">
<h2 data-number="8" class="anchored" data-anchor-id="quasi-newton-bfgs-klein-미언급의-표준"><span class="header-section-number">8</span> Quasi-Newton (BFGS) — Klein 미언급의 표준</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
현대 표준 — Quasi-Newton
</div>
</div>
<div class="callout-body-container callout-body">
<p>Klein 부록 A 가 작성된 시점 (2003) 부터 표준 도구는 거의 변하지 않았지만, 한 가지 빠진 부분이 <strong>Quasi-Newton</strong>.</p>
<p><strong>아이디어</strong>: Hessian 명시적 계산 대신 <strong>gradient 변화</strong> 로 Hessian 의 근사 update.</p>
<p><strong>BFGS 갱신 공식</strong>:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7BB%7D_%7Bk+1%7D%20=%20%5Cmathbf%7BB%7D_k%20+%20%5Cfrac%7B%5Cmathbf%7By%7D_k%20%5Cmathbf%7By%7D_k%5Et%7D%7B%5Cmathbf%7By%7D_k%5Et%20%5Cmathbf%7Bs%7D_k%7D%20-%20%5Cfrac%7B%5Cmathbf%7BB%7D_k%20%5Cmathbf%7Bs%7D_k%20%5Cmathbf%7Bs%7D_k%5Et%20%5Cmathbf%7BB%7D_k%7D%7B%5Cmathbf%7Bs%7D_k%5Et%20%5Cmathbf%7BB%7D_k%20%5Cmathbf%7Bs%7D_k%7D%20,%20"></p>
<p>여기서 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bs%7D_k%20=%20%5Cmathbf%7Bx%7D_%7Bk+1%7D%20-%20%5Cmathbf%7Bx%7D_k">, <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7By%7D_k%20=%20%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D_%7Bk+1%7D)%20-%20%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D_k)">.</p>
<p><strong>장점</strong>: - Hessian 명시적 계산 불필요 → <img src="https://latex.codecogs.com/png.latex?f''"> 비싼 우도에 적합. - Super-linear 수렴 (Newton 의 quadratic 보다 약간 느림). - <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BB%7D_k"> 가 자동으로 양의 정칙 유지 → 안전.</p>
<p><strong>단점</strong>: - <img src="https://latex.codecogs.com/png.latex?p%20%5Ctimes%20p"> 행렬 저장 — <img src="https://latex.codecogs.com/png.latex?p"> 매우 클 때 (예: 신경망의 수백만 모수) 부담. - 해결: <strong>L-BFGS</strong> (limited-memory BFGS) — 최근 <img src="https://latex.codecogs.com/png.latex?m"> step 만 저장. 메모리 <img src="https://latex.codecogs.com/png.latex?O(mp)">.</p>
<p><strong>구현</strong>: - R: <code>optim(method = "BFGS")</code> 또는 <code>optim(method = "L-BFGS-B")</code> (with bounds). - Python: <code>scipy.optimize.minimize(method='BFGS')</code> 또는 <code>'L-BFGS-B'</code>.</p>
<p><strong>실무 권고</strong>: <img src="https://latex.codecogs.com/png.latex?p%20%5Cleq%20100"> 이면 BFGS, <img src="https://latex.codecogs.com/png.latex?p%20%3E%20100"> 이면 L-BFGS. 생존분석은 거의 항상 <img src="https://latex.codecogs.com/png.latex?p%20%5Cleq%2050"> 이라 BFGS 가 default.</p>
</div>
</div>
</section>
<section id="코드-예시" class="level2" data-number="9">
<h2 data-number="9" class="anchored" data-anchor-id="코드-예시"><span class="header-section-number">9</span> 코드 예시</h2>
<section id="step-1-python-scipy-의-통합-api" class="level3" data-number="9.1">
<h3 data-number="9.1" class="anchored" data-anchor-id="step-1-python-scipy-의-통합-api"><span class="header-section-number">9.1</span> Step 1 — Python: scipy 의 통합 API</h3>
<div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb6-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb6-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> scipy.optimize <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> minimize</span>
<span id="cb6-3"></span>
<span id="cb6-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Example A.2 데이터</span></span>
<span id="cb6-5">t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.array([<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.57</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.58</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.82</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.02</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.78</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.46</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.04</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.43</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.69</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.37</span>])</span>
<span id="cb6-6">n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">len</span>(t)</span>
<span id="cb6-7"></span>
<span id="cb6-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 음의 log-likelihood (minimize 기준)</span></span>
<span id="cb6-9"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> neg_loglik(params):</span>
<span id="cb6-10">    lam, alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> params</span>
<span id="cb6-11">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> lam <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">or</span> alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>:</span>
<span id="cb6-12">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> np.inf</span>
<span id="cb6-13">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>(n<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>np.log(lam) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> n<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>np.log(alpha)</span>
<span id="cb6-14">             <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(np.log(t)) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> lam<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(t<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span>alpha))</span>
<span id="cb6-15"></span>
<span id="cb6-16"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Gradient (식 A.3)</span></span>
<span id="cb6-17"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> neg_grad(params):</span>
<span id="cb6-18">    lam, alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> params</span>
<span id="cb6-19">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>np.array([</span>
<span id="cb6-20">        n<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>lam <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(t<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span>alpha),</span>
<span id="cb6-21">        n<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(np.log(t)) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> lam<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(t<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span>alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.log(t))</span>
<span id="cb6-22">    ])</span>
<span id="cb6-23"></span>
<span id="cb6-24"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Hessian (식 A.4)</span></span>
<span id="cb6-25"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> neg_hess(params):</span>
<span id="cb6-26">    lam, alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> params</span>
<span id="cb6-27">    H <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.array([</span>
<span id="cb6-28">        [<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>n<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>lam<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(t<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span>alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.log(t))],</span>
<span id="cb6-29">        [<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(t<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span>alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.log(t)),</span>
<span id="cb6-30">         <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>n<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> lam<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(t<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span>alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.log(t)<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)]</span>
<span id="cb6-31">    ])</span>
<span id="cb6-32">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>H  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># neg_loglik 의 Hessian</span></span>
<span id="cb6-33"></span>
<span id="cb6-34"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 1. Newton-Raphson (Newton-CG)</span></span>
<span id="cb6-35">res_nr <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> minimize(neg_loglik, x0<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.024</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>], jac<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>neg_grad, hess<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>neg_hess,</span>
<span id="cb6-36">                  method<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'Newton-CG'</span>, options<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>{<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'xtol'</span>: <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-6</span>})</span>
<span id="cb6-37"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Newton-CG: λ̂=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res_nr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>x[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, α̂=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res_nr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>x[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, iter=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res_nr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>nit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb6-38"></span>
<span id="cb6-39"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 2. BFGS (Hessian 자동 근사)</span></span>
<span id="cb6-40">res_bfgs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> minimize(neg_loglik, x0<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.024</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>], jac<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>neg_grad,</span>
<span id="cb6-41">                    method<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'BFGS'</span>, options<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>{<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'gtol'</span>: <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-6</span>})</span>
<span id="cb6-42"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"BFGS: λ̂=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res_bfgs<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>x[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, α̂=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res_bfgs<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>x[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, iter=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res_bfgs<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>nit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb6-43"></span>
<span id="cb6-44"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 3. L-BFGS-B (with bounds)</span></span>
<span id="cb6-45">res_lb <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> minimize(neg_loglik, x0<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.024</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>], jac<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>neg_grad,</span>
<span id="cb6-46">                  method<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'L-BFGS-B'</span>, bounds<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.01</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">None</span>), (<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.01</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">None</span>)])</span>
<span id="cb6-47"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"L-BFGS-B: λ̂=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res_lb<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>x[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, α̂=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res_lb<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>x[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, iter=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res_lb<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>nit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb6-48"></span>
<span id="cb6-49"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 4. Steepest descent (직접 구현)</span></span>
<span id="cb6-50"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> steepest_ascent(f_obj, grad, x0, max_iter<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, tol<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.1</span>):</span>
<span id="cb6-51">    x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.array(x0, dtype<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">float</span>)</span>
<span id="cb6-52">    history <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [x.copy()]</span>
<span id="cb6-53">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">for</span> k <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">range</span>(max_iter):</span>
<span id="cb6-54">        g <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>grad(x)  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># f_obj 는 neg, gradient 도 neg</span></span>
<span id="cb6-55">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">max</span>(np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">abs</span>(g)) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> tol:</span>
<span id="cb6-56">            <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">break</span></span>
<span id="cb6-57">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 1D line search</span></span>
<span id="cb6-58">        <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> scipy.optimize <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> minimize_scalar</span>
<span id="cb6-59">        res <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> minimize_scalar(<span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">lambda</span> d: f_obj(x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> d<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>g), method<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'brent'</span>,</span>
<span id="cb6-60">                               bracket<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>))</span>
<span id="cb6-61">        x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> res.x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> g</span>
<span id="cb6-62">        history.append(x.copy())</span>
<span id="cb6-63">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> x, k, history</span>
<span id="cb6-64"></span>
<span id="cb6-65">x_sa, k_sa, _ <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> steepest_ascent(neg_loglik, neg_grad, [<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.024</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>])</span>
<span id="cb6-66"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Steepest: λ̂=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>x_sa[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, α̂=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>x_sa[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, iter=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>k_sa<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span></code></pre></div>
</section>
<section id="step-2-r-optim-의-다양한-method" class="level3" data-number="9.2">
<h3 data-number="9.2" class="anchored" data-anchor-id="step-2-r-optim-의-다양한-method"><span class="header-section-number">9.2</span> Step 2 — R: optim() 의 다양한 method</h3>
<div class="sourceCode" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb7-1">t <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.57</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.58</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.82</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.02</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.78</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.46</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.04</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.43</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.69</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.37</span>)</span>
<span id="cb7-2">n <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(t)</span>
<span id="cb7-3"></span>
<span id="cb7-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 음의 log-likelihood</span></span>
<span id="cb7-5">neg_loglik <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">function</span>(params) {</span>
<span id="cb7-6">  lam <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> params[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]; alpha <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> params[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>]</span>
<span id="cb7-7">  <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> (lam <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">||</span> alpha <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>) <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">return</span>(<span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">Inf</span>)</span>
<span id="cb7-8">  <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>(n<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log</span>(lam) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> n<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log</span>(alpha) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (alpha<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">-1</span>)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log</span>(t)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> lam<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(t<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span>alpha))</span>
<span id="cb7-9">}</span>
<span id="cb7-10"></span>
<span id="cb7-11"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Gradient</span></span>
<span id="cb7-12">neg_grad <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">function</span>(params) {</span>
<span id="cb7-13">  lam <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> params[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]; alpha <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> params[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>]</span>
<span id="cb7-14">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>(n<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>lam <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(t<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span>alpha)),</span>
<span id="cb7-15">    <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>(n<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>alpha <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log</span>(t)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> lam<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(t<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span>alpha <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log</span>(t))))</span>
<span id="cb7-16">}</span>
<span id="cb7-17"></span>
<span id="cb7-18"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 1. BFGS (default for smooth)</span></span>
<span id="cb7-19">fit_bfgs <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">optim</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.024</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>), neg_loglik, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">gr =</span> neg_grad,</span>
<span id="cb7-20">                  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">method =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BFGS"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">control =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">list</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">reltol =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-8</span>))</span>
<span id="cb7-21"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BFGS:"</span>, fit_bfgs<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>par, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"iters:"</span>, fit_bfgs<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>counts, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb7-22"></span>
<span id="cb7-23"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 2. L-BFGS-B (with bounds)</span></span>
<span id="cb7-24">fit_lbfgs <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">optim</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.024</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>), neg_loglik, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">gr =</span> neg_grad,</span>
<span id="cb7-25">                   <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">method =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"L-BFGS-B"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">lower =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.01</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.01</span>))</span>
<span id="cb7-26"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"L-BFGS-B:"</span>, fit_lbfgs<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>par, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb7-27"></span>
<span id="cb7-28"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 3. Nelder-Mead (gradient-free, robust)</span></span>
<span id="cb7-29">fit_nm <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">optim</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.024</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>), neg_loglik, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">method =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nelder-Mead"</span>)</span>
<span id="cb7-30"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nelder-Mead:"</span>, fit_nm<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>par, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb7-31"></span>
<span id="cb7-32"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 4. CG (Conjugate Gradient — large-scale 대안)</span></span>
<span id="cb7-33">fit_cg <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">optim</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.024</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>), neg_loglik, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">gr =</span> neg_grad, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">method =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"CG"</span>)</span>
<span id="cb7-34"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"CG:"</span>, fit_cg<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>par, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb7-35"></span>
<span id="cb7-36"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 5. nlminb (Quasi-Newton + box constraint, 기본 default)</span></span>
<span id="cb7-37">fit_nlm <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">nlminb</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.024</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>), neg_loglik, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">gradient =</span> neg_grad,</span>
<span id="cb7-38">                  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">lower =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.01</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.01</span>))</span>
<span id="cb7-39"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"nlminb:"</span>, fit_nlm<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>par, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"iter:"</span>, fit_nlm<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>iterations, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span></code></pre></div>
</section>
<section id="step-3-marquardt-직접-구현" class="level3" data-number="9.3">
<h3 data-number="9.3" class="anchored" data-anchor-id="step-3-marquardt-직접-구현"><span class="header-section-number">9.3</span> Step 3 — Marquardt 직접 구현</h3>
<div class="sourceCode" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb8-1"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> marquardt(f_obj, grad, hess, x0, gamma_0<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.001</span>, max_iter<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, tol<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-6</span>):</span>
<span id="cb8-2">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">"""</span></span>
<span id="cb8-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    Marquardt's algorithm with adaptive γ.</span></span>
<span id="cb8-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    f_obj: function to MAXIMIZE (positive log-likelihood).</span></span>
<span id="cb8-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    """</span></span>
<span id="cb8-6">    x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.array(x0, dtype<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">float</span>)</span>
<span id="cb8-7">    gamma <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> gamma_0</span>
<span id="cb8-8">    f_curr <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> f_obj(x)</span>
<span id="cb8-9"></span>
<span id="cb8-10">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">for</span> k <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">range</span>(max_iter):</span>
<span id="cb8-11">        g <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> grad(x)                                <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># gradient</span></span>
<span id="cb8-12">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">max</span>(np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">abs</span>(g)) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> tol:</span>
<span id="cb8-13">            <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">break</span></span>
<span id="cb8-14">        H <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> hess(x)                                <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Hessian</span></span>
<span id="cb8-15">        S <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.diag(np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">abs</span>(np.diag(H))<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span>(<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>))    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 스케일 행렬</span></span>
<span id="cb8-16">        M <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> S <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">@</span> H <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">@</span> S <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> gamma <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.eye(<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">len</span>(x))</span>
<span id="cb8-17">        delta <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> S <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">@</span> np.linalg.solve(M, S <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">@</span> g)</span>
<span id="cb8-18">        x_new <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> delta</span>
<span id="cb8-19"></span>
<span id="cb8-20">        f_new <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> f_obj(x_new)</span>
<span id="cb8-21">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> f_new <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> f_curr:</span>
<span id="cb8-22">            x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x_new</span>
<span id="cb8-23">            f_curr <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> f_new</span>
<span id="cb8-24">            gamma <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>                            <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Newton 쪽으로</span></span>
<span id="cb8-25">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">else</span>:</span>
<span id="cb8-26">            gamma <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>                            <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Steepest 쪽으로</span></span>
<span id="cb8-27">            <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> gamma <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e10</span>:</span>
<span id="cb8-28">                <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">break</span>                              <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 발산 방지</span></span>
<span id="cb8-29"></span>
<span id="cb8-30">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> x, k, gamma</span></code></pre></div>
</section>
</section>
<section id="핵심-요약" class="level2" data-number="10">
<h2 data-number="10" class="anchored" data-anchor-id="핵심-요약"><span class="header-section-number">10</span> 핵심 요약</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
§ A.2 한 줄 요약
</div>
</div>
<div class="callout-body-container callout-body">
<blockquote class="blockquote">
<p>다변수 최적화는 gradient <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bu%7D"> (식 A.3) 와 Hessian <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> (식 A.4) 를 도구로 사용한다. <strong>Steepest Ascent</strong> (식 A.5) 는 gradient 방향 + 1D line search — Hessian 불필요하지만 길쭉한 우도에서 지그재그로 수렴 매우 느림. <strong>Newton-Raphson 다변수</strong> (식 A.6, <img src="https://latex.codecogs.com/png.latex?-%5Cmathbf%7BH%7D%5E%7B-1%7D%20%5Cmathbf%7Bu%7D">) 는 Hessian 으로 좌표를 정규화한 후 한 step 으로 점프 — 2차 수렴이지만 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 비싸거나 ill-conditioned 시 위험. <strong>Marquardt</strong> (<img src="https://latex.codecogs.com/png.latex?%5Cgamma"> blending) 는 둘의 절충 — <img src="https://latex.codecogs.com/png.latex?%5Cgamma%20=%200"> 이면 Newton, <img src="https://latex.codecogs.com/png.latex?%5Cgamma%20%5Cto%20%5Cinfty"> 면 steepest. Klein Example A.2 의 Weibull (λ, α) MLE 에서 NR 3 step, Steepest 5 step, Marquardt 5 step. 현대 표준은 BFGS / L-BFGS (Hessian 을 gradient 변화로 자동 근사) — <code>optim</code> / <code>scipy.minimize</code> 의 default.</p>
</blockquote>
</div>
</div>
<table class="table">
<colgroup>
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
</colgroup>
<thead>
<tr class="header">
<th>방법</th>
<th>식</th>
<th>정보 요구</th>
<th>수렴 차수</th>
<th>견고성</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Steepest Ascent</td>
<td>식 (A.5)</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bu%7D"> (+ 1D line search)</td>
<td>선형</td>
<td>매우 강</td>
</tr>
<tr class="even">
<td>Newton-Raphson</td>
<td>식 (A.6)</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bu%7D,%20%5Cmathbf%7BH%7D"></td>
<td>2 (이차)</td>
<td>약</td>
</tr>
<tr class="odd">
<td>Marquardt</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Cgamma"> blending</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bu%7D,%20%5Cmathbf%7BH%7D,%20%5Cgamma"></td>
<td>적응</td>
<td>중간-강</td>
</tr>
<tr class="even">
<td>BFGS (Quasi-Newton)</td>
<td>rank-1 update</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bu%7D"> + Hessian 근사</td>
<td>super-linear</td>
<td>강</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
5 가지 실무 권고
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>1. Default 는 BFGS / L-BFGS</strong>: <img src="https://latex.codecogs.com/png.latex?f''"> 명시적 계산 부담 회피, super-linear 수렴, 양의 정칙 자동 유지. <code>optim</code> / <code>scipy.minimize</code> default.</p>
<p><strong>2. 좋은 시작값이 핵심</strong>: Method-of-moments, OLS, profile likelihood 등으로 사전 추정. 시작값에서 최적까지 거리가 멀수록 발산 위험.</p>
<p><strong>3. Step-Halving 안전장치</strong>: Newton 의 단순 구현 위험. <img src="https://latex.codecogs.com/png.latex?f"> 값 모니터링 + step 절반 fallback.</p>
<p><strong>4. 비선형 회귀에는 Marquardt (LM)</strong>: <code>nls()</code>, <code>minpack.lm::nlsLM()</code>, <code>scipy.optimize.least_squares(method='lm')</code>. 작은 표본 / 모형 오설정에서 가장 견고.</p>
<p><strong>5. 수렴 후 검증</strong>: <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D(%5Chat%7B%5Cmathbf%7Bx%7D%7D)"> 가 음의 정칙 (eigenvalue &lt; 0) 인지 확인. 안 그러면 안장점 또는 local min — 다른 시작값으로 재시도.</p>
</div>
</div>
</section>
<section id="관련-주제" class="level2" data-number="11">
<h2 data-number="11" class="anchored" data-anchor-id="관련-주제"><span class="header-section-number">11</span> 관련 주제</h2>
<p><strong>Klein Appendix A 시리즈</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/14-klein-appendix-a-numerical.html">Appendix A — Numerical Techniques for Maximization</a> — overview (단변수 + 다변수 종합)</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/14-1-univariate-methods.html">§ A.1 — Univariate Methods</a> — Bisection, Secant, Newton-Raphson 의 알고리즘과 수렴 차수</li>
</ul>
<p><strong>본문 응용</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/08-klein-ch8-cox-ph.html">Ch.8 — Cox 비례위험 모형</a> — 다변수 부분우도 Newton-Raphson + step-halving</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/12-klein-ch12-parametric.html">Ch.12 — 모수적 회귀 모형</a> — Weibull/LL/LN 다변수 MLE</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/13-2-gamma-frailty-marginal.html">§ 13.3-13.4 — Gamma Frailty EM &amp; Marginal Model</a> — EM M-step 의 다변수 NR</li>
</ul>
<p><strong>관련 개념</strong></p>
<ul>
<li><a href="https://en.wikipedia.org/wiki/Broyden%E2%80%93Fletcher%E2%80%93Goldfarb%E2%80%93Shanno_algorithm">BFGS / L-BFGS (Wikipedia)</a></li>
<li><a href="https://en.wikipedia.org/wiki/Levenberg%E2%80%93Marquardt_algorithm">Levenberg-Marquardt 알고리즘 (Wikipedia)</a></li>
<li><a href="https://en.wikipedia.org/wiki/Trust_region">Trust region method (Wikipedia)</a> — Marquardt 의 현대 일반화</li>
</ul>
</section>
<section id="참고-문헌" class="level2" data-number="12">
<h2 data-number="12" class="anchored" data-anchor-id="참고-문헌"><span class="header-section-number">12</span> 참고 문헌</h2>
<ul>
<li>Klein, J. P., &amp; Moeschberger, M. L. (2003). <em>Survival Analysis: Techniques for Censored and Truncated Data</em> (2nd ed.). Springer. <strong>Appendix A.2</strong>.</li>
<li>Marquardt, D. W. (1963). An algorithm for least-squares estimation of nonlinear parameters. <em>J. SIAM</em>, 11(2), 431-441. (Marquardt 의 원논문)</li>
<li>Levenberg, K. (1944). A method for the solution of certain non-linear problems in least squares. <em>Quart. Appl. Math.</em>, 2(2), 164-168. (LM 의 한쪽 역사)</li>
<li>Broyden, C. G., Fletcher, R., Goldfarb, D., &amp; Shanno, D. F. (1970년대). BFGS 의 4 명 독립 발견. (Wikipedia 참조)</li>
<li>Nocedal, J., &amp; Wright, S. J. (2006). <em>Numerical Optimization</em> (2nd ed.). Springer. (현대 표준 — line search, trust region, BFGS, L-BFGS, conjugate gradient 종합)</li>
<li>Press, W. H., Teukolsky, S. A., Vetterling, W. T., &amp; Flannery, B. P. (2007). <em>Numerical Recipes</em> (3rd ed.). Cambridge. (Marquardt, BFGS 의 실용 구현)</li>
<li>Thisted, R. A. (1988). <em>Elements of Statistical Computing: Numerical Computation</em>. Chapman and Hall. (Klein 인용 표준 교재)</li>
</ul>


</section>

 ]]></description>
  <category>Statistics</category>
  <category>Survival Analysis</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Statistics/survival/14-2-multivariate-methods.html</guid>
  <pubDate>Tue, 12 May 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Klein Appendix A.1 — Univariate Methods for Maximization</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Statistics/survival/14-1-univariate-methods.html</link>
  <description><![CDATA[ 





<section id="도입-단변수-최적화의-위치" class="level2" data-number="1">
<h2 data-number="1" class="anchored" data-anchor-id="도입-단변수-최적화의-위치"><span class="header-section-number">1</span> 도입 — 단변수 최적화의 위치</h2>
<p>Klein 책 본문에서 단변수 최적화가 등장하는 자리:</p>
<table class="table">
<colgroup>
<col style="width: 33%">
<col style="width: 33%">
<col style="width: 33%">
</colgroup>
<thead>
<tr class="header">
<th>본문 위치</th>
<th>단변수 모수</th>
<th>비고</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Ch.4 — Confidence band 의 critical value</td>
<td><img src="https://latex.codecogs.com/png.latex?c_%5Calpha"></td>
<td>분포함수의 분위수 찾기</td>
</tr>
<tr class="even">
<td>Ch.7 — Renyi 검정의 sup statistic</td>
<td><img src="https://latex.codecogs.com/png.latex?t%5E*"></td>
<td>시간 영역 sup 점</td>
</tr>
<tr class="odd">
<td>Ch.8 — 단일 공변량 Cox PH</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Cbeta"> (<img src="https://latex.codecogs.com/png.latex?p%20=%201">)</td>
<td>단순 사례</td>
</tr>
<tr class="even">
<td>Ch.12 — 단일 분포 모수 (Weibull <img src="https://latex.codecogs.com/png.latex?%5Calpha"> 만, <img src="https://latex.codecogs.com/png.latex?%5Clambda"> 알려진 경우)</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Calpha"></td>
<td>Example A.1</td>
</tr>
<tr class="odd">
<td>Ch.13 — Frailty EM 의 <img src="https://latex.codecogs.com/png.latex?%5Ctheta"> update</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Ctheta"></td>
<td>M-step 내부</td>
</tr>
<tr class="even">
<td>Profile likelihood 일반</td>
<td>profile 모수</td>
<td>다른 모수를 max-out</td>
</tr>
</tbody>
</table>
<p>각각의 경우 <strong>score 방정식 <img src="https://latex.codecogs.com/png.latex?f'(x)%20=%200"> 의 영점을 찾는 1 차원 문제</strong> 로 환원된다. 이는 다변수 최적화 (§ A.2) 의 building block 이기도 하다 — steepest ascent 의 step size 결정, profile likelihood 의 inner loop, line search 모두 1D 영점 찾기를 사용한다.</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
§ A.1 의 위치
</div>
</div>
<div class="callout-body-container callout-body">
<p>§ A.1 의 세 방법은 <strong>단변수 영점 찾기의 표준 도구</strong> 이다. 각각의 trade-off:</p>
<table class="table">
<colgroup>
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
</colgroup>
<thead>
<tr class="header">
<th>방법</th>
<th>정보 요구</th>
<th>수렴 차수</th>
<th>견고성</th>
<th>사용 시점</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Bisection</td>
<td><img src="https://latex.codecogs.com/png.latex?f'"> 부호 만</td>
<td>1 (선형)</td>
<td>매우 강</td>
<td>안전한 시작, <img src="https://latex.codecogs.com/png.latex?f'"> 거칠 때</td>
</tr>
<tr class="even">
<td>Secant</td>
<td><img src="https://latex.codecogs.com/png.latex?f'"> 만 (두 점)</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Cphi%20%5Capprox%201.618"></td>
<td>중간</td>
<td><img src="https://latex.codecogs.com/png.latex?f''"> 비싼 경우</td>
</tr>
<tr class="odd">
<td>Newton-Raphson</td>
<td><img src="https://latex.codecogs.com/png.latex?f',%20f''"></td>
<td>2 (이차)</td>
<td>약</td>
<td>좋은 시작값 + 빠른 수렴</td>
</tr>
</tbody>
</table>
<p>본 sub-post 는 세 방법의 알고리즘을 의사코드로 정리하고, 수렴 차수의 수학적 유도, 발산 사례, 그리고 Klein 의 Weibull MLE 예제 (Example A.1) 의 step-by-step trace 로 수렴 속도를 비교한다.</p>
</div>
</div>
</section>
<section id="문제-정의-score-영점-찾기" class="level2" data-number="2">
<h2 data-number="2" class="anchored" data-anchor-id="문제-정의-score-영점-찾기"><span class="header-section-number">2</span> 문제 정의 — Score 영점 찾기</h2>
<p>목적 함수 <img src="https://latex.codecogs.com/png.latex?f:%20%5Cmathbb%7BR%7D%20%5Cto%20%5Cmathbb%7BR%7D"> 의 최대값을 찾는다:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Chat%7Bx%7D%20=%20%5Carg%5Cmax_x%20f(x)%20.%20"></p>
<p>정칙 조건 (<img src="https://latex.codecogs.com/png.latex?f"> 가 두 번 미분 가능, 단봉) 하에서 일계 조건:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20f'(%5Chat%7Bx%7D)%20=%200%20%5Cquad%20%5Ctext%7Band%7D%20%5Cquad%20f''(%5Chat%7Bx%7D)%20%3C%200%20.%20"></p>
<p>따라서 <strong><img src="https://latex.codecogs.com/png.latex?f'"> 의 영점 (root) 을 찾는 문제</strong> 로 환원. 이를 위해 다음을 알고 있다고 가정한다:</p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?f'(x)"> 의 함수 형태 (수치적 또는 해석적 평가 가능)</li>
<li>일부 방법에서는 <img src="https://latex.codecogs.com/png.latex?f''(x)"> 도 평가 가능</li>
</ul>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
영점 = 최대값? — 검증 필수
</div>
</div>
<div class="callout-body-container callout-body">
<p>세 방법 모두 <img src="https://latex.codecogs.com/png.latex?f'(x)%20=%200"> 의 해를 찾을 뿐, 그 해가 최대인지 최소인지 변곡점인지 알지 못한다. 우도 함수가 단봉이면 안전하지만, 그렇지 않으면 다음을 점검:</p>
<ol type="1">
<li><img src="https://latex.codecogs.com/png.latex?f''(%5Chat%7Bx%7D)%20%3C%200"> (음의 정칙) 확인</li>
<li>인접한 두 점의 <img src="https://latex.codecogs.com/png.latex?f"> 값 비교</li>
<li>다른 시작값으로 재시도해 같은 해 도달</li>
</ol>
<p>특히 frailty 모수 <img src="https://latex.codecogs.com/png.latex?%5Ctheta"> 처럼 <strong>모수 공간 경계</strong> (<img src="https://latex.codecogs.com/png.latex?%5Ctheta%20%5Cgeq%200">) 에 가까운 경우, score 영점이 경계에 있을 수 있어 일반 정칙 이론이 약하다.</p>
</div>
</div>
</section>
<section id="a.1.1-bisection-가장-견고한-방법" class="level2" data-number="3">
<h2 data-number="3" class="anchored" data-anchor-id="a.1.1-bisection-가장-견고한-방법"><span class="header-section-number">3</span> § A.1.1 Bisection — 가장 견고한 방법</h2>
<section id="알고리즘" class="level3" data-number="3.1">
<h3 data-number="3.1" class="anchored" data-anchor-id="알고리즘"><span class="header-section-number">3.1</span> 알고리즘</h3>
<p><img src="https://latex.codecogs.com/png.latex?f'(x)"> 의 영점이 구간 <img src="https://latex.codecogs.com/png.latex?%5Bx_L,%20x_U%5D"> 안에 있다는 정보가 있다고 가정 — 양 끝의 부호가 다름:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20f'(x_L)%20%5Ccdot%20f'(x_U)%20%3C%200%20.%20"></p>
<p>(중간값 정리에 의해 <img src="https://latex.codecogs.com/png.latex?f'"> 가 연속이면 그 사이에 적어도 하나의 영점 존재.)</p>
<section id="의사코드" class="level4" data-number="3.1.1">
<h4 data-number="3.1.1" class="anchored" data-anchor-id="의사코드"><span class="header-section-number">3.1.1</span> 의사코드</h4>
<pre><code>INPUT: f', x_L, x_U (with f'(x_L)·f'(x_U) &lt; 0), tol
WHILE (x_U - x_L) &gt; tol:
    x_N ← (x_L + x_U) / 2
    fp_N ← f'(x_N)
    IF f'(x_L) · fp_N &gt; 0:        # 영점이 [x_N, x_U] 에 있음
        x_L ← x_N
    ELSE:                          # 영점이 [x_L, x_N] 에 있음
        x_U ← x_N
RETURN (x_L + x_U) / 2</code></pre>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 매 step 절반씩 좁힘
</div>
</div>
<div class="callout-body-container callout-body">
<p>각 step 에서 구간 길이가 정확히 절반으로 줄어든다. <img src="https://latex.codecogs.com/png.latex?k"> step 후 길이:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Ctext%7BLength%7D_k%20=%20%5Cfrac%7Bx_U%5E%7B(0)%7D%20-%20x_L%5E%7B(0)%7D%7D%7B2%5Ek%7D%20.%20"></p>
<p>따라서 정확도 <img src="https://latex.codecogs.com/png.latex?%5Cepsilon"> 도달까지:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20k%20=%20%5Cleft%5Clceil%20%5Clog_2%20%5Cfrac%7Bx_U%5E%7B(0)%7D%20-%20x_L%5E%7B(0)%7D%7D%7B%5Cepsilon%7D%20%5Cright%5Crceil%20.%20"></p>
<p>예: 초기 폭 1.0, 정확도 <img src="https://latex.codecogs.com/png.latex?10%5E%7B-6%7D"> 원하면 <img src="https://latex.codecogs.com/png.latex?k%20=%2020"> step 필요. <img src="https://latex.codecogs.com/png.latex?10%5E%7B-12%7D"> 원하면 <img src="https://latex.codecogs.com/png.latex?k%20=%2040"> step.</p>
<p>이는 <strong>선형 수렴 (linear convergence)</strong> — 매 step 정확도가 일정 비율 (1/2) 로 줄어든다.</p>
</div>
</div>
</section>
</section>
<section id="수렴-보장과-견고성" class="level3" data-number="3.2">
<h3 data-number="3.2" class="anchored" data-anchor-id="수렴-보장과-견고성"><span class="header-section-number">3.2</span> 수렴 보장과 견고성</h3>
<div class="callout callout-style-default callout-important callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Bisection 의 강점 — 수렴 보장
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>중간값 정리</strong> 가 보장: <img src="https://latex.codecogs.com/png.latex?f'"> 가 <img src="https://latex.codecogs.com/png.latex?%5Bx_L,%20x_U%5D"> 에서 연속이고 양 끝 부호가 다르면 그 사이에 적어도 한 영점이 존재. Bisection 은 그 영점을 반드시 찾는다.</p>
<p>따라서 <strong>함수의 모양과 무관하게 수렴 보장</strong>. 다른 방법이 발산하거나 잘못된 방향으로 갈 수 있는 험한 함수 (잡음, 평탄 영역, 다봉) 에서도 안전하게 작동.</p>
<p>비유: 산속에서 길을 잃었을 때 <strong>나침반 (bisection)</strong> 만으로 천천히 가지만 반드시 도착. 빠른 차 (Newton) 는 길이 좋을 때만 빠르고, 길이 나쁘면 멈추거나 절벽으로 갈 수 있음.</p>
<p><strong>비용</strong>: 선형 수렴은 다른 방법 (super-linear, quadratic) 보다 느리다. 그러나 수렴 보장은 매우 큰 가치.</p>
</div>
</div>
</section>
<section id="한계" class="level3" data-number="3.3">
<h3 data-number="3.3" class="anchored" data-anchor-id="한계"><span class="header-section-number">3.3</span> 한계</h3>
<table class="table">
<colgroup>
<col style="width: 50%">
<col style="width: 50%">
</colgroup>
<thead>
<tr class="header">
<th>한계</th>
<th>설명</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>초기 구간 필요</td>
<td><img src="https://latex.codecogs.com/png.latex?f'(x_L)"> 와 <img src="https://latex.codecogs.com/png.latex?f'(x_U)"> 의 부호가 달라야. 우도 함수 score 의 부호를 사전에 알기 어려운 경우 있음</td>
</tr>
<tr class="even">
<td>다중 영점</td>
<td>구간 안에 영점이 여러 개면 그중 하나만 찾음 (어느 것일지 예측 불가)</td>
</tr>
<tr class="odd">
<td>미분 불가 / 불연속</td>
<td>중간값 정리가 깨지면 작동 안 함 — 우도가 PMF 같은 이산 함수면 부적합</td>
</tr>
<tr class="even">
<td>선형 수렴</td>
<td><img src="https://latex.codecogs.com/png.latex?2%5E%7B-k%7D"> → 정밀도 <img src="https://latex.codecogs.com/png.latex?10%5E%7B-12%7D"> 위해 40+ step. Newton 의 quadratic 보다 훨씬 많음</td>
</tr>
</tbody>
</table>
</section>
<section id="사용-시점" class="level3" data-number="3.4">
<h3 data-number="3.4" class="anchored" data-anchor-id="사용-시점"><span class="header-section-number">3.4</span> 사용 시점</h3>
<ul>
<li><strong>초기값 정보 부실</strong>: Newton-Raphson 의 시작값을 잘 모르는 경우 bisection 으로 거친 영역 좁힘.</li>
<li><strong>함수가 거칠다</strong>: 우도 함수에 잡음·미분 불가 점이 있을 때.</li>
<li><strong>하이브리드 알고리즘의 안전장치</strong>: Brent’s method 가 secant + bisection 결합으로 양쪽 장점 취함.</li>
</ul>
</section>
</section>
<section id="a.1.2-secant-method-식-a.1" class="level2" data-number="4">
<h2 data-number="4" class="anchored" data-anchor-id="a.1.2-secant-method-식-a.1"><span class="header-section-number">4</span> § A.1.2 Secant Method — 식 (A.1)</h2>
<section id="알고리즘-1" class="level3" data-number="4.1">
<h3 data-number="4.1" class="anchored" data-anchor-id="알고리즘-1"><span class="header-section-number">4.1</span> 알고리즘</h3>
<p>두 초기값 <img src="https://latex.codecogs.com/png.latex?x_0,%20x_1"> 에서 시작 (영점을 사이에 둘 필요 없음, 자유). 각 step 에서:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20x_%7Bi+1%7D%20=%20x_i%20-%20f'(x_i)%20%5Ccdot%20%5Cfrac%7Bx_i%20-%20x_%7Bi-1%7D%7D%7Bf'(x_i)%20-%20f'(x_%7Bi-1%7D)%7D%20.%20%5Ctag%7B%EC%8B%9D%20A.1%7D%20"></p>
<section id="의사코드-1" class="level4" data-number="4.1.1">
<h4 data-number="4.1.1" class="anchored" data-anchor-id="의사코드-1"><span class="header-section-number">4.1.1</span> 의사코드</h4>
<pre><code>INPUT: f', x_0, x_1, tol
fp_0 ← f'(x_0)
fp_1 ← f'(x_1)
WHILE |fp_1| &gt; tol:
    x_new ← x_1 - fp_1 · (x_1 - x_0) / (fp_1 - fp_0)
    x_0 ← x_1
    fp_0 ← fp_1
    x_1 ← x_new
    fp_1 ← f'(x_1)
RETURN x_1</code></pre>
<p>(정지 기준은 <img src="https://latex.codecogs.com/png.latex?%7Cf'(x_1)%7C"> 외에 <img src="https://latex.codecogs.com/png.latex?%7Cx_1%20-%20x_0%7C"> 또는 <img src="https://latex.codecogs.com/png.latex?%7Cx_1%20-%20x_0%7C/%7Cx_0%7C"> 등 사용 가능.)</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 할선 (Secant) 의 영점
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?f'"> 의 두 점 <img src="https://latex.codecogs.com/png.latex?(x_%7Bi-1%7D,%20f'(x_%7Bi-1%7D))">, <img src="https://latex.codecogs.com/png.latex?(x_i,%20f'(x_i))"> 을 잇는 직선 (할선, secant line) 을 그린다. 이 할선의 방정식:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20y%20-%20f'(x_i)%20=%20%5Cfrac%7Bf'(x_i)%20-%20f'(x_%7Bi-1%7D)%7D%7Bx_i%20-%20x_%7Bi-1%7D%7D%20(x%20-%20x_i)%20.%20"></p>
<p>이 직선의 <img src="https://latex.codecogs.com/png.latex?x">-intercept (<img src="https://latex.codecogs.com/png.latex?y%20=%200"> 점) 가 다음 후보:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20x_%7Bi+1%7D%20=%20x_i%20-%20f'(x_i)%20%5Ccdot%20%5Cfrac%7Bx_i%20-%20x_%7Bi-1%7D%7D%7Bf'(x_i)%20-%20f'(x_%7Bi-1%7D)%7D%20.%20"></p>
<p>이게 식 (A.1).</p>
<p><strong>아이디어</strong>: <img src="https://latex.codecogs.com/png.latex?f'"> 가 부드러운 곡선이면 두 점 사이에서 거의 직선에 가깝다. 그 직선 근사로 영점을 추정 → 빠르게 수렴.</p>
</div>
</div>
</section>
</section>
<section id="수렴-차수-황금-비율-phi-의-등장" class="level3" data-number="4.2">
<h3 data-number="4.2" class="anchored" data-anchor-id="수렴-차수-황금-비율-phi-의-등장"><span class="header-section-number">4.2</span> 수렴 차수 — 황금 비율 <img src="https://latex.codecogs.com/png.latex?%5Cphi"> 의 등장</h3>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<img src="https://latex.codecogs.com/png.latex?%5Cphi%20%5Capprox%201.618"> 의 유도
</div>
</div>
<div class="callout-body-container callout-body">
<p>오차 <img src="https://latex.codecogs.com/png.latex?e_i%20=%20x_i%20-%20%5Chat%7Bx%7D"> 를 정의. Taylor 전개로 (자세한 유도는 Numerical Recipes Ch.9 참조):</p>
<p><img src="https://latex.codecogs.com/png.latex?%20e_%7Bi+1%7D%20%5Capprox%20%5Cfrac%7Bf''(%5Chat%7Bx%7D)%7D%7B2%20f'(%5Chat%7Bx%7D)%7D%20%5Ccdot%20e_i%20%5Ccdot%20e_%7Bi-1%7D%20.%20"></p>
<p>오차 점화식 <img src="https://latex.codecogs.com/png.latex?e_%7Bi+1%7D%20=%20C%20%5Ccdot%20e_i%20%5Ccdot%20e_%7Bi-1%7D"> 에서 차수 <img src="https://latex.codecogs.com/png.latex?p"> 를 찾는다. 가정 <img src="https://latex.codecogs.com/png.latex?e_%7Bi+1%7D%20=%20K%20%5Ccdot%20e_i%5Ep"> 면:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20K%20e_i%5Ep%20=%20C%20%5Ccdot%20e_i%20%5Ccdot%20e_%7Bi-1%7D%20.%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?e_i%20=%20K%20%5Ccdot%20e_%7Bi-1%7D%5Ep"> 에서 <img src="https://latex.codecogs.com/png.latex?e_%7Bi-1%7D%20=%20(e_i/K)%5E%7B1/p%7D"> 대입:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20K%20e_i%5Ep%20=%20C%20%5Ccdot%20e_i%20%5Ccdot%20(e_i/K)%5E%7B1/p%7D%20%5C;%5CRightarrow%5C;%20K%5E%7B1+1/p%7D%20e_i%5E%7Bp%20-%201%20-%201/p%7D%20=%20C%20.%20"></p>
<p>이 식이 <img src="https://latex.codecogs.com/png.latex?e_i"> 무관하려면 지수 <img src="https://latex.codecogs.com/png.latex?p%20-%201%20-%201/p%20=%200">, 즉:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20p%5E2%20-%20p%20-%201%20=%200%20%5C;%5CRightarrow%5C;%20p%20=%20%5Cfrac%7B1%20+%20%5Csqrt%7B5%7D%7D%7B2%7D%20=%20%5Cphi%20%5Capprox%201.618%20.%20"></p>
<p><strong>황금 비율</strong> 이 자연스럽게 등장 — 피보나치 점화식 <img src="https://latex.codecogs.com/png.latex?F_%7Bi+1%7D%20=%20F_i%20+%20F_%7Bi-1%7D"> 와 같은 구조 (<img src="https://latex.codecogs.com/png.latex?e_%7Bi+1%7D"> 가 직전 두 항의 곱) 에서 <img src="https://latex.codecogs.com/png.latex?%5Cphi"> 가 나오는 것은 같은 수학적 원리.</p>
</div>
</div>
</section>
<section id="secant-의-장단점" class="level3" data-number="4.3">
<h3 data-number="4.3" class="anchored" data-anchor-id="secant-의-장단점"><span class="header-section-number">4.3</span> Secant 의 장단점</h3>
<table class="table">
<thead>
<tr class="header">
<th>측면</th>
<th>Bisection</th>
<th>Secant</th>
<th>Newton-Raphson</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>수렴 차수</td>
<td>1 (선형)</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Cphi%20%5Capprox%201.618"></td>
<td>2 (이차)</td>
</tr>
<tr class="even">
<td>정보 요구</td>
<td><img src="https://latex.codecogs.com/png.latex?f'"> 만</td>
<td><img src="https://latex.codecogs.com/png.latex?f'"> 만 (두 점)</td>
<td><img src="https://latex.codecogs.com/png.latex?f',%20f''"></td>
</tr>
<tr class="odd">
<td>초기값</td>
<td>부호 다른 두 점</td>
<td>두 점 (자유)</td>
<td>한 점</td>
</tr>
<tr class="even">
<td>견고성</td>
<td>매우 강</td>
<td>중간</td>
<td>약</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Secant 의 결정적 장점 — <img src="https://latex.codecogs.com/png.latex?f''"> 불필요
</div>
</div>
<div class="callout-body-container callout-body">
<p>Newton-Raphson 보다 약간 느리지만 (<img src="https://latex.codecogs.com/png.latex?%5Cphi%20%3C%202">), <strong>2 차 도함수 <img src="https://latex.codecogs.com/png.latex?f''"> 계산이 불필요</strong> 하다는 점이 결정적 장점이다.</p>
<p><strong>왜 중요한가</strong>:</p>
<ul>
<li>Cox 부분우도의 <img src="https://latex.codecogs.com/png.latex?f''"> 는 위험집합의 가중 공분산 — 큰 데이터에서 매 step <img src="https://latex.codecogs.com/png.latex?O(n%5E2)"> 비용.</li>
<li>Frailty marginal 우도의 <img src="https://latex.codecogs.com/png.latex?f''"> 는 digamma 함수의 도함수 (trigamma) 등 복잡 함수.</li>
<li>일반화 감마의 <img src="https://latex.codecogs.com/png.latex?f''"> 는 표현식이 매우 복잡.</li>
</ul>
<p>이런 경우 Newton 의 quadratic 수렴 (2 step) 이 secant 의 super-linear (3-4 step) 보다 느릴 수 있다 — Hessian 한 번 계산 비용이 secant step 두 번보다 큼.</p>
<p><strong>Quasi-Newton 의 다변수 일반화</strong> (BFGS 등) 는 secant 의 다변수 버전 — Hessian 을 score 변화로 근사.</p>
</div>
</div>
</section>
<section id="발산-사례" class="level3" data-number="4.4">
<h3 data-number="4.4" class="anchored" data-anchor-id="발산-사례"><span class="header-section-number">4.4</span> 발산 사례</h3>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Secant 가 실패하는 경우
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>1. <img src="https://latex.codecogs.com/png.latex?f'(x_i)%20%5Capprox%20f'(x_%7Bi-1%7D)"></strong>: 분모 <img src="https://latex.codecogs.com/png.latex?(f'(x_i)%20-%20f'(x_%7Bi-1%7D))"> 가 0 에 가까워 step 이 폭발. 평탄 영역에서 발생.</p>
<p><strong>2. <img src="https://latex.codecogs.com/png.latex?f''"> 부호 변화</strong>: 변곡점 부근에서 할선 근사가 부정확 → 잘못된 방향으로 점프.</p>
<p><strong>3. 다중 영점</strong>: 두 시작값이 다른 영점 사이에 있으면 어느 영점에 수렴할지 예측 불가.</p>
<p><strong>대처</strong>: - 정지 기준에 <img src="https://latex.codecogs.com/png.latex?%7Cx_%7Bi+1%7D%20-%20x_i%7C"> 추가 (모수 변화도 점검). - 분모 절댓값이 임계 이하면 bisection 으로 fallback. - 함수 값 모니터링 — <img src="https://latex.codecogs.com/png.latex?f(x_%7Bi+1%7D)%20%5Cgeq%20f(x_i)"> 위반 시 반대 방향으로 이동 안 함.</p>
</div>
</div>
</section>
</section>
<section id="a.1.3-newton-raphson-식-a.2" class="level2" data-number="5">
<h2 data-number="5" class="anchored" data-anchor-id="a.1.3-newton-raphson-식-a.2"><span class="header-section-number">5</span> § A.1.3 Newton-Raphson — 식 (A.2)</h2>
<section id="알고리즘-2" class="level3" data-number="5.1">
<h3 data-number="5.1" class="anchored" data-anchor-id="알고리즘-2"><span class="header-section-number">5.1</span> 알고리즘</h3>
<p>단일 초기값 <img src="https://latex.codecogs.com/png.latex?x_0"> 에서 시작:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20x_%7Bi+1%7D%20=%20x_i%20-%20%5Cfrac%7Bf'(x_i)%7D%7Bf''(x_i)%7D%20.%20%5Ctag%7B%EC%8B%9D%20A.2%7D%20"></p>
<section id="의사코드-2" class="level4" data-number="5.1.1">
<h4 data-number="5.1.1" class="anchored" data-anchor-id="의사코드-2"><span class="header-section-number">5.1.1</span> 의사코드</h4>
<pre><code>INPUT: f', f'', x_0, tol
x ← x_0
fp ← f'(x)
WHILE |fp| &gt; tol:
    fpp ← f''(x)
    IF fpp ≈ 0:
        ABORT (수치 불안정)
    x ← x - fp / fpp
    fp ← f'(x)
RETURN x</code></pre>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — Taylor 1차 근사 = 접선
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?x_i"> 근처에서 <img src="https://latex.codecogs.com/png.latex?f'"> 의 1 차 Taylor 근사:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20f'(x)%20%5Capprox%20f'(x_i)%20+%20f''(x_i)%20%5Ccdot%20(x%20-%20x_i)%20.%20"></p>
<p>이는 <img src="https://latex.codecogs.com/png.latex?f'"> 의 그래프에 점 <img src="https://latex.codecogs.com/png.latex?(x_i,%20f'(x_i))"> 에서 접선을 그은 것 (기울기 = <img src="https://latex.codecogs.com/png.latex?f''(x_i)">).</p>
<p>이 접선의 <img src="https://latex.codecogs.com/png.latex?x">-intercept (<img src="https://latex.codecogs.com/png.latex?f'(x)%20=%200">) 를 풀면:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20x_%7Bi+1%7D%20=%20x_i%20-%20%5Cfrac%7Bf'(x_i)%7D%7Bf''(x_i)%7D%20.%20"></p>
<p>이게 식 (A.2). 즉 <strong><img src="https://latex.codecogs.com/png.latex?f'"> 의 접선의 영점</strong> 을 다음 후보로 삼는다.</p>
<p>Secant 와 비교: - Secant: 두 점을 잇는 <strong>할선</strong>의 영점. 두 점 사이의 평균 기울기 사용. - Newton: 한 점에서 그은 <strong>접선</strong>의 영점. 그 점의 정확한 기울기 (<img src="https://latex.codecogs.com/png.latex?f''">) 사용.</p>
<p>따라서 Newton 이 더 정확한 1차 근사 → 더 빠른 수렴.</p>
</div>
</div>
</section>
</section>
<section id="수렴-차수-2차-quadratic-의-유도" class="level3" data-number="5.2">
<h3 data-number="5.2" class="anchored" data-anchor-id="수렴-차수-2차-quadratic-의-유도"><span class="header-section-number">5.2</span> 수렴 차수 — 2차 (Quadratic) 의 유도</h3>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Quadratic 수렴 유도
</div>
</div>
<div class="callout-body-container callout-body">
<p>영점 <img src="https://latex.codecogs.com/png.latex?%5Chat%7Bx%7D"> 근처에서 <img src="https://latex.codecogs.com/png.latex?f'(%5Chat%7Bx%7D)%20=%200">. Taylor 전개:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20f'(x_i)%20=%20f''(%5Chat%7Bx%7D)%20%5Ccdot%20(x_i%20-%20%5Chat%7Bx%7D)%20+%20%5Cfrac%7B1%7D%7B2%7D%20f'''(%5Chat%7Bx%7D)%20(x_i%20-%20%5Chat%7Bx%7D)%5E2%20+%20O(e_i%5E3)%20,%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%20f''(x_i)%20=%20f''(%5Chat%7Bx%7D)%20+%20f'''(%5Chat%7Bx%7D)%20(x_i%20-%20%5Chat%7Bx%7D)%20+%20O(e_i%5E2)%20,%20"></p>
<p>여기서 <img src="https://latex.codecogs.com/png.latex?e_i%20=%20x_i%20-%20%5Chat%7Bx%7D">.</p>
<p>Newton 갱신 <img src="https://latex.codecogs.com/png.latex?x_%7Bi+1%7D%20=%20x_i%20-%20f'(x_i)/f''(x_i)"> 에서:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cbegin%7Baligned%7D%0Ae_%7Bi+1%7D%20&amp;=%20e_i%20-%20%5Cfrac%7Bf'(x_i)%7D%7Bf''(x_i)%7D%20%5C%5C%0A&amp;%5Capprox%20e_i%20-%20%5Cfrac%7Bf''(%5Chat%7Bx%7D)%20e_i%20+%20%5Cfrac%7B1%7D%7B2%7D%20f'''(%5Chat%7Bx%7D)%20e_i%5E2%7D%7Bf''(%5Chat%7Bx%7D)%20+%20f'''(%5Chat%7Bx%7D)%20e_i%7D%20%5C%5C%0A&amp;=%20e_i%20-%20e_i%20%5Ccdot%20%5Cfrac%7B1%20+%20%5Cfrac%7B1%7D%7B2%7D%20%5Cfrac%7Bf'''(%5Chat%7Bx%7D)%7D%7Bf''(%5Chat%7Bx%7D)%7D%20e_i%7D%7B1%20+%20%5Cfrac%7Bf'''(%5Chat%7Bx%7D)%7D%7Bf''(%5Chat%7Bx%7D)%7D%20e_i%7D%20%5C%5C%0A&amp;%5Capprox%20e_i%20%5Ccdot%20%5Cleft%5B1%20-%20%5Cleft(1%20-%20%5Cfrac%7B1%7D%7B2%7D%20%5Cfrac%7Bf'''(%5Chat%7Bx%7D)%7D%7Bf''(%5Chat%7Bx%7D)%7D%20e_i%5Cright)%5Cright%5D%20=%20%5Cfrac%7B1%7D%7B2%7D%20%5Cfrac%7Bf'''(%5Chat%7Bx%7D)%7D%7Bf''(%5Chat%7Bx%7D)%7D%20e_i%5E2%20.%0A%5Cend%7Baligned%7D%20"></p>
<p>따라서:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cboxed%7B%20e_%7Bi+1%7D%20%5Capprox%20%5Cfrac%7Bf'''(%5Chat%7Bx%7D)%7D%7B2%20f''(%5Chat%7Bx%7D)%7D%20%5Ccdot%20e_i%5E2%20%7D%20.%20"></p>
<p>오차가 매 step <strong>제곱</strong> 된다. 정확도 변화:</p>
<table class="table">
<thead>
<tr class="header">
<th>Step</th>
<th>오차</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>0</td>
<td><img src="https://latex.codecogs.com/png.latex?10%5E%7B-2%7D"></td>
</tr>
<tr class="even">
<td>1</td>
<td><img src="https://latex.codecogs.com/png.latex?10%5E%7B-4%7D"></td>
</tr>
<tr class="odd">
<td>2</td>
<td><img src="https://latex.codecogs.com/png.latex?10%5E%7B-8%7D"></td>
</tr>
<tr class="even">
<td>3</td>
<td><img src="https://latex.codecogs.com/png.latex?10%5E%7B-16%7D"> (기계 정밀도 도달)</td>
</tr>
</tbody>
</table>
<p>3 step 만에 16 자리 정밀도. <strong>이것이 Newton 의 폭발적 가속의 원천</strong>.</p>
</div>
</div>
</section>
<section id="발산-사례-newton-의-약점" class="level3" data-number="5.3">
<h3 data-number="5.3" class="anchored" data-anchor-id="발산-사례-newton-의-약점"><span class="header-section-number">5.3</span> 발산 사례 — Newton 의 약점</h3>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Newton-Raphson 이 실패하는 경우
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>1. <img src="https://latex.codecogs.com/png.latex?f''(x_i)%20%5Capprox%200"> — 접선이 거의 수평</strong>: Step 크기가 폭발. 변곡점 근처에서 발생.</p>
<p><strong>2. Overshoot — 접선이 영점을 너무 멀리 가리킴</strong>: <img src="https://latex.codecogs.com/png.latex?%7Cf'(x_i)/f''(x_i)%7C"> 가 크면 새 점이 영점 반대편 멀리 점프. 그 새 점에서 또 잘못된 방향 → 발산.</p>
<p><strong>3. 잘못된 방향 — <img src="https://latex.codecogs.com/png.latex?f"> 값 감소</strong>: <img src="https://latex.codecogs.com/png.latex?f(x_%7Bi+1%7D)%20%3C%20f(x_i)"> 면 최대화에 반대 방향 진행. Newton 식은 root 를 찾을 뿐, 값의 증가를 보장 안 함.</p>
<p><strong>4. 다중 영점에서의 cycle</strong>: 시작값에 따라 두 영점 사이를 왔다갔다하는 cycle 가능 (드뭄).</p>
<p><strong>대처 — Step Halving</strong>:</p>
<p><img src="https://latex.codecogs.com/png.latex?f(x_%7Bi+1%7D)%20%3C%20f(x_i)"> 검출 시 step 크기 절반:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20x_%7Bi+1%7D%20=%20x_i%20-%20%5Cfrac%7B1%7D%7B2%7D%20%5Ccdot%20%5Cfrac%7Bf'(x_i)%7D%7Bf''(x_i)%7D%20.%20"></p>
<p>다시 안 되면 또 절반 (<img src="https://latex.codecogs.com/png.latex?1/4">, <img src="https://latex.codecogs.com/png.latex?1/8">, …). 이는 SAS Cox 회귀의 표준 안전장치이다.</p>
<p><strong>대안 — Levenberg-Marquardt (다변수)</strong>: <img src="https://latex.codecogs.com/png.latex?f''"> 에 작은 양의 상수를 더해 안정화. 다변수 최적화의 표준 (§ A.2 참조).</p>
</div>
</div>
</section>
<section id="newton-raphson-의-사용-시점" class="level3" data-number="5.4">
<h3 data-number="5.4" class="anchored" data-anchor-id="newton-raphson-의-사용-시점"><span class="header-section-number">5.4</span> Newton-Raphson 의 사용 시점</h3>
<table class="table">
<thead>
<tr class="header">
<th>조건</th>
<th>Newton 이 적합</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>좋은 초기값 (영점 근처)</td>
<td>O — 빠른 quadratic 수렴</td>
</tr>
<tr class="even">
<td><img src="https://latex.codecogs.com/png.latex?f''"> 평가 가능·저렴</td>
<td>O — Hessian 정보 활용</td>
</tr>
<tr class="odd">
<td>함수 부드러움 (<img src="https://latex.codecogs.com/png.latex?C%5E2">, 단봉)</td>
<td>O — Taylor 근사 정확</td>
</tr>
<tr class="even">
<td>단일 영점</td>
<td>O — 다중 영점 cycle 회피</td>
</tr>
</tbody>
</table>
</section>
</section>
<section id="세-방법의-비교-정량적" class="level2" data-number="6">
<h2 data-number="6" class="anchored" data-anchor-id="세-방법의-비교-정량적"><span class="header-section-number">6</span> 세 방법의 비교 — 정량적</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<img src="https://latex.codecogs.com/png.latex?k"> step 후 정확도
</div>
</div>
<div class="callout-body-container callout-body">
<p>초기 오차 <img src="https://latex.codecogs.com/png.latex?e_0%20=%200.1"> 이라고 하자. 각 방법의 <img src="https://latex.codecogs.com/png.latex?k"> step 후 오차:</p>
<table class="table">
<colgroup>
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
</colgroup>
<thead>
<tr class="header">
<th>Step</th>
<th>Bisection (<img src="https://latex.codecogs.com/png.latex?%5Ctimes%201/2">)</th>
<th>Secant (<img src="https://latex.codecogs.com/png.latex?e_i%5E%7B1.618%7D">)</th>
<th>Newton (<img src="https://latex.codecogs.com/png.latex?e_i%5E2">)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>0</td>
<td><img src="https://latex.codecogs.com/png.latex?10%5E%7B-1%7D"></td>
<td><img src="https://latex.codecogs.com/png.latex?10%5E%7B-1%7D"></td>
<td><img src="https://latex.codecogs.com/png.latex?10%5E%7B-1%7D"></td>
</tr>
<tr class="even">
<td>1</td>
<td><img src="https://latex.codecogs.com/png.latex?5%20%5Ctimes%2010%5E%7B-2%7D"></td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%2010%5E%7B-1.62%7D%20%5Capprox%202.4%20%5Ctimes%2010%5E%7B-2%7D"></td>
<td><img src="https://latex.codecogs.com/png.latex?10%5E%7B-2%7D"></td>
</tr>
<tr class="odd">
<td>2</td>
<td><img src="https://latex.codecogs.com/png.latex?2.5%20%5Ctimes%2010%5E%7B-2%7D"></td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%2010%5E%7B-2.62%7D"></td>
<td><img src="https://latex.codecogs.com/png.latex?10%5E%7B-4%7D"></td>
</tr>
<tr class="even">
<td>3</td>
<td><img src="https://latex.codecogs.com/png.latex?1.25%20%5Ctimes%2010%5E%7B-2%7D"></td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%2010%5E%7B-4.24%7D"></td>
<td><img src="https://latex.codecogs.com/png.latex?10%5E%7B-8%7D"></td>
</tr>
<tr class="odd">
<td>4</td>
<td><img src="https://latex.codecogs.com/png.latex?6.25%20%5Ctimes%2010%5E%7B-3%7D"></td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%2010%5E%7B-6.86%7D"></td>
<td><img src="https://latex.codecogs.com/png.latex?10%5E%7B-16%7D"></td>
</tr>
</tbody>
</table>
<p><strong>Newton 의 압도적 우위</strong>: 4 step 만에 기계 정밀도 도달. Bisection 은 같은 정밀도까지 약 50 step 필요.</p>
<p><strong>Secant 도 매우 빠름</strong>: 4 step 으로 <img src="https://latex.codecogs.com/png.latex?10%5E%7B-7%7D"> 수준 — 실용적으로 Newton 과 큰 차이 없음.</p>
<p>그러나 <strong>Newton 의 한 step 비용이 Secant 보다 클 수 있다</strong> (<img src="https://latex.codecogs.com/png.latex?f''"> 계산). 따라서 한 step 의 wallclock 시간을 비교하면 Secant 가 유리할 수 있다 — 특히 Hessian 비싼 우도에서.</p>
</div>
</div>
</section>
<section id="example-a.1-weibull-단모수-mle" class="level2" data-number="7">
<h2 data-number="7" class="anchored" data-anchor-id="example-a.1-weibull-단모수-mle"><span class="header-section-number">7</span> Example A.1 — Weibull 단모수 MLE</h2>
<section id="데이터와-모형" class="level3" data-number="7.1">
<h3 data-number="7.1" class="anchored" data-anchor-id="데이터와-모형"><span class="header-section-number">7.1</span> 데이터와 모형</h3>
<p>10 개 비검열 관측 (단순화된 생존시간):</p>
<pre><code>t = (2.57, 0.58, 0.82, 1.02, 0.78, 0.46, 1.04, 0.43, 0.69, 1.37)</code></pre>
<p><img src="https://latex.codecogs.com/png.latex?%5Csum%20t_j%20%5Capprox%209.76">, <img src="https://latex.codecogs.com/png.latex?%5Csum%20%5Cln%20t_j%20%5Capprox%20-0.94">.</p>
<p>진짜 분포: Weibull, <img src="https://latex.codecogs.com/png.latex?%5Clambda%20=%201"> 고정, <img src="https://latex.codecogs.com/png.latex?%5Calpha"> 만 추정. 생존함수 <img src="https://latex.codecogs.com/png.latex?S(t)%20=%20e%5E%7B-t%5E%5Calpha%7D">, 위험률 <img src="https://latex.codecogs.com/png.latex?h(t)%20=%20%5Calpha%20t%5E%7B%5Calpha-1%7D">.</p>
<section id="log-likelihood-score-hessian" class="level4" data-number="7.1.1">
<h4 data-number="7.1.1" class="anchored" data-anchor-id="log-likelihood-score-hessian"><span class="header-section-number">7.1.1</span> Log-likelihood, Score, Hessian</h4>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cell(%5Calpha)%20=%20n%20%5Cln%20%5Calpha%20+%20(%5Calpha%20-%201)%20%5Csum%20%5Cln%20t_j%20-%20%5Csum%20t_j%5E%5Calpha%20.%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%20f'(%5Calpha)%20=%20%5Cfrac%7Bn%7D%7B%5Calpha%7D%20+%20%5Csum%20%5Cln%20t_j%20-%20%5Csum%20t_j%5E%5Calpha%20%5Cln%20t_j%20.%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%20f''(%5Calpha)%20=%20-%5Cfrac%7Bn%7D%7B%5Calpha%5E2%7D%20-%20%5Csum%20t_j%5E%5Calpha%20(%5Cln%20t_j)%5E2%20.%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?f''(%5Calpha)%20%3C%200"> for all <img src="https://latex.codecogs.com/png.latex?%5Calpha%20%3E%200"> → 우도가 단봉, 어떤 영점이든 최대.</p>
</section>
</section>
<section id="bisection-8-step-trace-klein-본문-표" class="level3" data-number="7.2">
<h3 data-number="7.2" class="anchored" data-anchor-id="bisection-8-step-trace-klein-본문-표"><span class="header-section-number">7.2</span> Bisection — 8 step Trace (Klein 본문 표)</h3>
<p>초기 구간 <img src="https://latex.codecogs.com/png.latex?%5B%5Calpha_L,%20%5Calpha_U%5D%20=%20%5B1.5,%202%5D">. 정지 기준 <img src="https://latex.codecogs.com/png.latex?%7Cf'(%5Calpha)%7C%20%3C%200.01">.</p>
<table class="table">
<colgroup>
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
</colgroup>
<thead>
<tr class="header">
<th>Step</th>
<th><img src="https://latex.codecogs.com/png.latex?%5Calpha_L"></th>
<th><img src="https://latex.codecogs.com/png.latex?%5Calpha_U"></th>
<th><img src="https://latex.codecogs.com/png.latex?%5Calpha_N"></th>
<th><img src="https://latex.codecogs.com/png.latex?f'(%5Calpha_L)"></th>
<th><img src="https://latex.codecogs.com/png.latex?f'(%5Calpha_U)"></th>
<th><img src="https://latex.codecogs.com/png.latex?f'(%5Calpha_N)"></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>1</td>
<td>1.5</td>
<td>2.0</td>
<td>1.75</td>
<td>1.798</td>
<td><img src="https://latex.codecogs.com/png.latex?-2.589"></td>
<td><img src="https://latex.codecogs.com/png.latex?-0.387"></td>
</tr>
<tr class="even">
<td>2</td>
<td>1.5</td>
<td>1.75</td>
<td>1.625</td>
<td>1.798</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.387"></td>
<td>0.697</td>
</tr>
<tr class="odd">
<td>3</td>
<td>1.625</td>
<td>1.75</td>
<td>1.6875</td>
<td>0.697</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.387"></td>
<td>0.154</td>
</tr>
<tr class="even">
<td>4</td>
<td>1.6875</td>
<td>1.75</td>
<td>1.71875</td>
<td>0.154</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.387"></td>
<td><img src="https://latex.codecogs.com/png.latex?-0.116"></td>
</tr>
<tr class="odd">
<td>5</td>
<td>1.6875</td>
<td>1.71875</td>
<td>1.70313</td>
<td>0.154</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.116"></td>
<td>0.019</td>
</tr>
<tr class="even">
<td>6</td>
<td>1.70313</td>
<td>1.71875</td>
<td>1.71094</td>
<td>0.019</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.116"></td>
<td><img src="https://latex.codecogs.com/png.latex?-0.049"></td>
</tr>
<tr class="odd">
<td>7</td>
<td>1.70313</td>
<td>1.71094</td>
<td>1.70704</td>
<td>0.019</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.049"></td>
<td><img src="https://latex.codecogs.com/png.latex?-0.015"></td>
</tr>
<tr class="even">
<td>8</td>
<td>1.70313</td>
<td>1.70704</td>
<td>1.70509</td>
<td>0.019</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.015"></td>
<td><strong>0.002</strong></td>
</tr>
</tbody>
</table>
<p><strong>8 step 후 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Calpha%7D%20=%201.705"></strong>. <img src="https://latex.codecogs.com/png.latex?%7Cf'(1.705)%7C%20%3C%200.01"> 충족.</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Trace 의 패턴
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li><strong>구간 길이</strong>: 0.5 → 0.25 → 0.125 → … → 0.0039 (정확히 절반씩).</li>
<li><strong><img src="https://latex.codecogs.com/png.latex?f'"> 부호 변동</strong>: 매 step 에서 새 중점의 부호가 한쪽 끝과 일치하면 다른 끝을 그 중점으로 대체. step 1 의 <img src="https://latex.codecogs.com/png.latex?f'(1.75)%20=%20-0.387"> (음수) 이 <img src="https://latex.codecogs.com/png.latex?f'(2)%20=%20-2.589"> (음수) 와 같은 부호 → <img src="https://latex.codecogs.com/png.latex?x_U%20%5Cleftarrow%201.75">.</li>
<li><strong>수렴 패턴</strong>: 안정적, 진동 없음. 매 step 정확히 절반의 진전.</li>
</ul>
<p>8 step 으로 정밀도 <img src="https://latex.codecogs.com/png.latex?0.5/2%5E8%20%5Capprox%200.002"> 도달 — 정지 기준 부합.</p>
</div>
</div>
</section>
<section id="secant-method-2-step-trace" class="level3" data-number="7.3">
<h3 data-number="7.3" class="anchored" data-anchor-id="secant-method-2-step-trace"><span class="header-section-number">7.3</span> Secant Method — 2 step Trace</h3>
<p>초기값 <img src="https://latex.codecogs.com/png.latex?%5Calpha_0%20=%201.0,%20%5Calpha_1%20=%201.5">. 같은 정지 기준.</p>
<table class="table">
<colgroup>
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
<col style="width: 14%">
</colgroup>
<thead>
<tr class="header">
<th>Step</th>
<th><img src="https://latex.codecogs.com/png.latex?%5Calpha_%7Bi-1%7D"></th>
<th><img src="https://latex.codecogs.com/png.latex?%5Calpha_i"></th>
<th><img src="https://latex.codecogs.com/png.latex?f'(%5Calpha_%7Bi-1%7D)"></th>
<th><img src="https://latex.codecogs.com/png.latex?f'(%5Calpha_i)"></th>
<th><img src="https://latex.codecogs.com/png.latex?%5Calpha_%7Bi+1%7D"></th>
<th><img src="https://latex.codecogs.com/png.latex?f'(%5Calpha_%7Bi+1%7D)"></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>1</td>
<td>1.0</td>
<td>1.5</td>
<td>7.065</td>
<td>1.798</td>
<td><strong>1.671</strong></td>
<td>0.300</td>
</tr>
<tr class="even">
<td>2</td>
<td>1.5</td>
<td>1.671</td>
<td>1.798</td>
<td>0.300</td>
<td><strong>1.705</strong></td>
<td>0.004</td>
</tr>
</tbody>
</table>
<p><strong>2 step 후 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Calpha%7D%20=%201.705"></strong>. <img src="https://latex.codecogs.com/png.latex?%7Cf'(1.705)%7C%20=%200.004%20%3C%200.01"> 충족.</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
식 (A.1) 의 직접 적용
</div>
</div>
<div class="callout-body-container callout-body">
<p>Step 1: <img src="https://latex.codecogs.com/png.latex?%5Calpha_2%20=%201.5%20-%201.798%20%5Ccdot%20%5Cfrac%7B1.5%20-%201.0%7D%7B1.798%20-%207.065%7D%20=%201.5%20-%201.798%20%5Ccdot%20%5Cfrac%7B0.5%7D%7B-5.267%7D%20=%201.5%20+%200.171%20=%201.671">.</p>
<p>Step 2: <img src="https://latex.codecogs.com/png.latex?%5Calpha_3%20=%201.671%20-%200.300%20%5Ccdot%20%5Cfrac%7B1.671%20-%201.5%7D%7B0.300%20-%201.798%7D%20=%201.671%20-%200.300%20%5Ccdot%20%5Cfrac%7B0.171%7D%7B-1.498%7D%20=%201.671%20+%200.034%20=%201.705">.</p>
<p><strong>Bisection 8 step → Secant 2 step</strong>: 동일 정밀도 도달에 4 배 빠름.</p>
</div>
</div>
</section>
<section id="newton-raphson-2-step-trace" class="level3" data-number="7.4">
<h3 data-number="7.4" class="anchored" data-anchor-id="newton-raphson-2-step-trace"><span class="header-section-number">7.4</span> Newton-Raphson — 2 step Trace</h3>
<p>초기값 <img src="https://latex.codecogs.com/png.latex?%5Calpha_0%20=%201.5">. <img src="https://latex.codecogs.com/png.latex?f'(1.5)%20=%201.798">, <img src="https://latex.codecogs.com/png.latex?f''(1.5)%20=%20-8.947">.</p>
<table class="table">
<colgroup>
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
</colgroup>
<thead>
<tr class="header">
<th>Step</th>
<th><img src="https://latex.codecogs.com/png.latex?%5Calpha_%7Bi-1%7D"></th>
<th><img src="https://latex.codecogs.com/png.latex?f'(%5Calpha_%7Bi-1%7D)"></th>
<th><img src="https://latex.codecogs.com/png.latex?f''(%5Calpha_%7Bi-1%7D)"></th>
<th><img src="https://latex.codecogs.com/png.latex?%5Calpha_i"></th>
<th><img src="https://latex.codecogs.com/png.latex?f'(%5Calpha_i)"></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>1</td>
<td>1.5</td>
<td>1.798</td>
<td><img src="https://latex.codecogs.com/png.latex?-8.947"></td>
<td><strong>1.701</strong></td>
<td>0.038</td>
</tr>
<tr class="even">
<td>2</td>
<td>1.701</td>
<td>0.038</td>
<td><img src="https://latex.codecogs.com/png.latex?-8.655"></td>
<td><strong>1.705</strong></td>
<td><img src="https://latex.codecogs.com/png.latex?2%20%5Ctimes%2010%5E%7B-6%7D"></td>
</tr>
</tbody>
</table>
<p><strong>2 step 후 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Calpha%7D%20=%201.705"></strong>.</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Newton 의 한 step 의 정확도
</div>
</div>
<div class="callout-body-container callout-body">
<p>Step 1: <img src="https://latex.codecogs.com/png.latex?%5Calpha_1%20=%201.5%20-%201.798/(-8.947)%20=%201.5%20+%200.201%20=%201.701">. <strong>첫 step 만에 정답에 매우 가까움</strong> (<img src="https://latex.codecogs.com/png.latex?1.701"> vs <img src="https://latex.codecogs.com/png.latex?1.705">, 차이 <img src="https://latex.codecogs.com/png.latex?0.004">).</p>
<p>Secant 의 첫 step 결과는 <img src="https://latex.codecogs.com/png.latex?1.671"> — Newton 보다 <img src="https://latex.codecogs.com/png.latex?0.030"> 더 멀다. <strong>Newton 의 정확한 곡률 정보 (<img src="https://latex.codecogs.com/png.latex?f''">) 가 첫 step 부터 더 좋은 추정</strong>을 만든다.</p>
<p><strong>그러나 같은 2 step 으로 Secant 도 도달</strong>. 정지 기준이 <img src="https://latex.codecogs.com/png.latex?%7Cf'%7C%20%3C%200.01"> 로 너그러우면 두 방법 동등.</p>
<p>만약 <img src="https://latex.codecogs.com/png.latex?%7Cf'%7C%20%3C%2010%5E%7B-10%7D"> 같은 엄격한 기준이면: - Newton: 3-4 step 으로 도달 (quadratic). - Secant: 5-6 step 필요 (super-linear <img src="https://latex.codecogs.com/png.latex?%5Cphi">).</p>
<p>차이가 점점 벌어진다. 그러나 어느 쪽이든 Bisection (선형) 보다 압도적.</p>
</div>
</div>
</section>
<section id="세-방법-종합-비교" class="level3" data-number="7.5">
<h3 data-number="7.5" class="anchored" data-anchor-id="세-방법-종합-비교"><span class="header-section-number">7.5</span> 세 방법 종합 비교</h3>
<table class="table">
<thead>
<tr class="header">
<th>방법</th>
<th>Step</th>
<th><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Calpha%7D"></th>
<th>마지막 <img src="https://latex.codecogs.com/png.latex?%7Cf'%7C"></th>
<th>비고</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Bisection</td>
<td>8</td>
<td>1.705</td>
<td>0.002</td>
<td>견고하지만 느림</td>
</tr>
<tr class="even">
<td>Secant</td>
<td>2</td>
<td>1.705</td>
<td>0.004</td>
<td>빠르고 <img src="https://latex.codecogs.com/png.latex?f''"> 불필요</td>
</tr>
<tr class="odd">
<td>Newton-Raphson</td>
<td>2</td>
<td>1.705</td>
<td><img src="https://latex.codecogs.com/png.latex?2%20%5Ctimes%2010%5E%7B-6%7D"></td>
<td>가장 빠르고 정확</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
같은 답, 다른 길
</div>
</div>
<div class="callout-body-container callout-body">
<p>세 방법 모두 같은 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Calpha%7D%20=%201.705"> 에 수렴. 단순한 1D 단봉 우도라 어느 방법이든 OK. 실제 차이:</p>
<ul>
<li><strong>Step 수</strong>: 8 → 2 → 2.</li>
<li><strong>마지막 <img src="https://latex.codecogs.com/png.latex?f'"> 값</strong>: 0.002 → 0.004 → <img src="https://latex.codecogs.com/png.latex?10%5E%7B-6%7D"> (Newton 이 가장 정확).</li>
<li><strong>Computation</strong>:
<ul>
<li>Bisection: <img src="https://latex.codecogs.com/png.latex?f'"> 8 회 평가.</li>
<li>Secant: <img src="https://latex.codecogs.com/png.latex?f'"> 3 회 평가 (초기 2 + 매 step 1 추가).</li>
<li>Newton: <img src="https://latex.codecogs.com/png.latex?f'"> 2 회 + <img src="https://latex.codecogs.com/png.latex?f''"> 2 회 평가.</li>
</ul></li>
</ul>
<p>만약 <img src="https://latex.codecogs.com/png.latex?f''"> 가 <img src="https://latex.codecogs.com/png.latex?f'"> 의 5 배 비용이면 Newton 의 총 비용은 <img src="https://latex.codecogs.com/png.latex?2%20+%202%20%5Ctimes%205%20=%2012"> vs Secant 의 3 — Secant 가 더 빠르다.</p>
<p><strong>결론</strong>: 한 step 의 wallclock 가 아닌 step 수만 보면 Newton 우위. 비용까지 고려하면 함수 의존. 일반 가이드: Newton 시도 → 발산 시 Secant 또는 Bisection 으로 fallback.</p>
</div>
</div>
</section>
</section>
<section id="brents-method-결합-알고리즘-klein-미언급" class="level2" data-number="8">
<h2 data-number="8" class="anchored" data-anchor-id="brents-method-결합-알고리즘-klein-미언급"><span class="header-section-number">8</span> Brent’s Method — 결합 알고리즘 (Klein 미언급)</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
표준 라이브러리의 default
</div>
</div>
<div class="callout-body-container callout-body">
<p>Klein 본문은 세 방법을 별도로 다루지만, 실제 통계 패키지의 default 는 <strong>Brent’s method (1973)</strong> — 세 방법의 장점을 결합.</p>
<p><strong>알고리즘</strong>: 1. Bisection 으로 초기 구간 좁힘 (안전). 2. 영점 근처에서 inverse quadratic interpolation (3 점의 2 차 근사) 시도. 3. Inverse quadratic 이 실패하면 secant. 4. Secant 도 실패하면 bisection. 5. 매 step 진행도 검증 — bisection 보다 못하면 fallback.</p>
<p><strong>보장</strong>: 항상 수렴 (bisection 의 견고성). 그리고 함수가 부드러우면 super-linear 수렴 (secant + quadratic).</p>
<p><strong>구현</strong>: - Python: <code>scipy.optimize.brentq</code>, <code>scipy.optimize.brent</code> - R: <code>uniroot()</code>, <code>optimize()</code> - C: GSL <code>gsl_root_fsolver_brent</code></p>
<p><strong>실무 권고</strong>: 직접 Newton 구현보다 라이브러리의 Brent 호출이 안전. 단변수 영점 / 최적화는 거의 항상 Brent 가 최적.</p>
</div>
</div>
</section>
<section id="코드-예시" class="level2" data-number="9">
<h2 data-number="9" class="anchored" data-anchor-id="코드-예시"><span class="header-section-number">9</span> 코드 예시</h2>
<section id="step-1-python-scipy-의-통합-api" class="level3" data-number="9.1">
<h3 data-number="9.1" class="anchored" data-anchor-id="step-1-python-scipy-의-통합-api"><span class="header-section-number">9.1</span> Step 1 — Python: scipy 의 통합 API</h3>
<div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb5-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb5-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> scipy.optimize <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> brentq, newton, minimize_scalar</span>
<span id="cb5-3"></span>
<span id="cb5-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Example A.1 데이터</span></span>
<span id="cb5-5">t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.array([<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.57</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.58</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.82</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.02</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.78</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.46</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.04</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.43</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.69</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.37</span>])</span>
<span id="cb5-6">n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">len</span>(t)</span>
<span id="cb5-7"></span>
<span id="cb5-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Score 와 Hessian</span></span>
<span id="cb5-9"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> score(alpha):</span>
<span id="cb5-10">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(np.log(t)) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(t<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span>alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.log(t))</span>
<span id="cb5-11"></span>
<span id="cb5-12"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> hessian(alpha):</span>
<span id="cb5-13">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(t<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span>alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (np.log(t))<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)</span>
<span id="cb5-14"></span>
<span id="cb5-15"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 1. Bisection (scipy.optimize.brentq — 사실은 Brent's method)</span></span>
<span id="cb5-16">alpha_b <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> brentq(score, a<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>, b<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.0</span>, xtol<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-6</span>)</span>
<span id="cb5-17"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Brent: α̂ = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>alpha_b<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.6f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb5-18"></span>
<span id="cb5-19"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 2. Newton-Raphson (직접)</span></span>
<span id="cb5-20">alpha_n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> newton(score, x0<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>, fprime<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>hessian, tol<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-6</span>, maxiter<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>)</span>
<span id="cb5-21"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Newton: α̂ = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>alpha_n<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.6f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb5-22"></span>
<span id="cb5-23"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 3. Secant (scipy.optimize.newton with fprime=None — secant 으로 fallback)</span></span>
<span id="cb5-24">alpha_s <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> newton(score, x0<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>, x1<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>, tol<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-6</span>, maxiter<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>)</span>
<span id="cb5-25"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Secant: α̂ = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>alpha_s<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.6f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb5-26"></span>
<span id="cb5-27"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 4. minimize_scalar — log-likelihood 최대화 (음의 lik 최소화)</span></span>
<span id="cb5-28"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> neg_loglik(alpha):</span>
<span id="cb5-29">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>(n<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>np.log(alpha) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(np.log(t)) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(t<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span>alpha))</span>
<span id="cb5-30"></span>
<span id="cb5-31">res <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> minimize_scalar(neg_loglik, bracket<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.0</span>), method<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'brent'</span>)</span>
<span id="cb5-32"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"minimize_scalar: α̂ = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>x<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.6f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, iterations = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>nit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span></code></pre></div>
</section>
<section id="step-2-r-uniroot-optimize" class="level3" data-number="9.2">
<h3 data-number="9.2" class="anchored" data-anchor-id="step-2-r-uniroot-optimize"><span class="header-section-number">9.2</span> Step 2 — R: uniroot / optimize</h3>
<div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb6-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Example A.1 데이터</span></span>
<span id="cb6-2">t <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.57</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.58</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.82</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.02</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.78</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.46</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.04</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.43</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.69</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.37</span>)</span>
<span id="cb6-3">n <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(t)</span>
<span id="cb6-4"></span>
<span id="cb6-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Score function</span></span>
<span id="cb6-6">score <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">function</span>(alpha) n<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>alpha <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log</span>(t)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(t<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span>alpha <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log</span>(t))</span>
<span id="cb6-7"></span>
<span id="cb6-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 1. uniroot (Brent's method — score 의 영점)</span></span>
<span id="cb6-9">res_uniroot <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">uniroot</span>(score, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">interval =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.0</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tol =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-6</span>)</span>
<span id="cb6-10"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"uniroot: α̂ ="</span>, res_uniroot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>root,</span>
<span id="cb6-11">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">", iterations ="</span>, res_uniroot<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>iter, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb6-12"></span>
<span id="cb6-13"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 2. optimize (single-variable function maximization)</span></span>
<span id="cb6-14">loglik <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">function</span>(alpha) {</span>
<span id="cb6-15">  n<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log</span>(alpha) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (alpha<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">-1</span>)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log</span>(t)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(t<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span>alpha)</span>
<span id="cb6-16">}</span>
<span id="cb6-17">res_opt <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">optimize</span>(loglik, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">interval =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.0</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">maximum =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tol =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-6</span>)</span>
<span id="cb6-18"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"optimize: α̂ ="</span>, res_opt<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>maximum, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span></code></pre></div>
</section>
<section id="step-3-직접-구현-학습용" class="level3" data-number="9.3">
<h3 data-number="9.3" class="anchored" data-anchor-id="step-3-직접-구현-학습용"><span class="header-section-number">9.3</span> Step 3 — 직접 구현 (학습용)</h3>
<div class="sourceCode" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb7-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Bisection 직접 구현 — 식 (A.2)</span></span>
<span id="cb7-2"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> bisection(f, x_L, x_U, tol<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-4</span>, max_iter<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>):</span>
<span id="cb7-3">    fp_L <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> f(x_L)<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">;</span> fp_U <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> f(x_U)</span>
<span id="cb7-4">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">assert</span> fp_L <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> fp_U <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"양 끝의 부호가 같음"</span></span>
<span id="cb7-5">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">for</span> k <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">range</span>(max_iter):</span>
<span id="cb7-6">        x_N <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (x_L <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> x_U) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span></span>
<span id="cb7-7">        fp_N <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> f(x_N)</span>
<span id="cb7-8">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">abs</span>(fp_N) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> tol <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">or</span> (x_U <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> x_L) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> tol:</span>
<span id="cb7-9">            <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> x_N, k</span>
<span id="cb7-10">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> fp_L <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> fp_N <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>:</span>
<span id="cb7-11">            x_L, fp_L <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x_N, fp_N</span>
<span id="cb7-12">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">else</span>:</span>
<span id="cb7-13">            x_U, fp_U <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x_N, fp_N</span>
<span id="cb7-14">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> (x_L <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> x_U) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, max_iter</span>
<span id="cb7-15"></span>
<span id="cb7-16"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Secant 직접 구현 — 식 (A.1)</span></span>
<span id="cb7-17"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> secant(f, x0, x1, tol<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-4</span>, max_iter<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>):</span>
<span id="cb7-18">    fp0 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> f(x0)<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">;</span> fp1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> f(x1)</span>
<span id="cb7-19">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">for</span> k <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">range</span>(max_iter):</span>
<span id="cb7-20">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">abs</span>(fp1) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> tol:</span>
<span id="cb7-21">            <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> x1, k</span>
<span id="cb7-22">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">abs</span>(fp1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> fp0) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-12</span>:</span>
<span id="cb7-23">            <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> x1, k  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 분모 0 방지</span></span>
<span id="cb7-24">        x_new <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> fp1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (x1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> x0) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> (fp1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> fp0)</span>
<span id="cb7-25">        x0, fp0 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x1, fp1</span>
<span id="cb7-26">        x1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x_new</span>
<span id="cb7-27">        fp1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> f(x1)</span>
<span id="cb7-28">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> x1, max_iter</span>
<span id="cb7-29"></span>
<span id="cb7-30"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Newton-Raphson 직접 구현 — 식 (A.2) + step-halving</span></span>
<span id="cb7-31"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> newton_safe(f, fp, x0, tol<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-4</span>, max_iter<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, f_obj<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">None</span>):</span>
<span id="cb7-32">    x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x0</span>
<span id="cb7-33">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">for</span> k <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">range</span>(max_iter):</span>
<span id="cb7-34">        fx <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> f(x)</span>
<span id="cb7-35">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">abs</span>(fx) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> tol:</span>
<span id="cb7-36">            <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> x, k</span>
<span id="cb7-37">        fpx <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> fp(x)</span>
<span id="cb7-38">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">abs</span>(fpx) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-12</span>:</span>
<span id="cb7-39">            <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> x, k  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># f'' = 0 방지</span></span>
<span id="cb7-40">        step <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> fx <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> fpx</span>
<span id="cb7-41">        x_new <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> step</span>
<span id="cb7-42">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># step-halving: f_obj 가 감소하면 step 줄임</span></span>
<span id="cb7-43">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> f_obj <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">is</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">not</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">None</span>:</span>
<span id="cb7-44">            <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">while</span> f_obj(x_new) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> f_obj(x) <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">and</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">abs</span>(step) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-10</span>:</span>
<span id="cb7-45">                step <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span></span>
<span id="cb7-46">                x_new <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> step</span>
<span id="cb7-47">        x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x_new</span>
<span id="cb7-48">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> x, max_iter</span>
<span id="cb7-49"></span>
<span id="cb7-50"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Example A.1 적용</span></span>
<span id="cb7-51">alpha_b, k_b <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> bisection(score, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.0</span>)</span>
<span id="cb7-52">alpha_s, k_s <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> secant(score, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>)</span>
<span id="cb7-53">alpha_n, k_n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> newton_safe(score, hessian, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>)</span>
<span id="cb7-54"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Bisection: α̂=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>alpha_b<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, iters=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>k_b<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb7-55"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Secant:    α̂=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>alpha_s<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, iters=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>k_s<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb7-56"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Newton:    α̂=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>alpha_n<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, iters=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>k_n<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span></code></pre></div>
</section>
</section>
<section id="핵심-요약" class="level2" data-number="10">
<h2 data-number="10" class="anchored" data-anchor-id="핵심-요약"><span class="header-section-number">10</span> 핵심 요약</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
§ A.1 한 줄 요약
</div>
</div>
<div class="callout-body-container callout-body">
<blockquote class="blockquote">
<p>단변수 score 영점 찾기는 <strong>Bisection</strong> (절반씩 좁힘, 선형 수렴 <img src="https://latex.codecogs.com/png.latex?%5Ctext%7Blength%7D/2%5Ek">, 매우 견고하지만 느림), <strong>Secant</strong> (식 A.1, 할선의 영점, 황금비 <img src="https://latex.codecogs.com/png.latex?%5Cphi%20%5Capprox%201.618"> 차 수렴, <img src="https://latex.codecogs.com/png.latex?f''"> 불필요), <strong>Newton-Raphson</strong> (식 A.2, 접선의 영점, 2차 수렴 <img src="https://latex.codecogs.com/png.latex?e_%7Bi+1%7D%20%5Cpropto%20e_i%5E2">, 초기값 의존) 의 세 방법이 표준이다. Klein 의 Weibull α MLE 예제 (10 obs, <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Calpha%7D%20=%201.705">) 에서 bisection 8 step, secant·Newton 모두 2 step. 실무에서는 라이브러리의 Brent’s method (<code>scipy.brentq</code>, R <code>uniroot</code>) 가 세 방법을 결합한 안전한 default 이다.</p>
</blockquote>
</div>
</div>
<table class="table">
<thead>
<tr class="header">
<th>방법</th>
<th>식</th>
<th>수렴 차수</th>
<th>정보 요구</th>
<th>견고성</th>
<th>Example A.1 step</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Bisection</td>
<td>절반씩 좁힘</td>
<td>1 (선형)</td>
<td><img src="https://latex.codecogs.com/png.latex?f'"> 부호만</td>
<td>매우 강</td>
<td>8</td>
</tr>
<tr class="even">
<td>Secant</td>
<td>식 (A.1)</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Cphi%20%5Capprox%201.618"></td>
<td><img src="https://latex.codecogs.com/png.latex?f'"> (두 점)</td>
<td>중간</td>
<td>2</td>
</tr>
<tr class="odd">
<td>Newton-Raphson</td>
<td>식 (A.2)</td>
<td>2 (이차)</td>
<td><img src="https://latex.codecogs.com/png.latex?f',%20f''"></td>
<td>약</td>
<td>2</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
5 가지 실무 권고
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>1. 라이브러리 우선</strong>: 직접 Newton 구현보다 <code>scipy.brentq</code> 또는 R <code>uniroot</code> (Brent’s method) 가 안전. 발산·cycle 의 사전 처리 포함.</p>
<p><strong>2. 좋은 시작값이 가장 중요</strong>: Newton 의 quadratic 수렴은 시작값이 영점 근처일 때만. Method-of-moments 등으로 사전 추정.</p>
<p><strong>3. 단봉 검증</strong>: <img src="https://latex.codecogs.com/png.latex?f''(x)%20%3C%200"> 이 모든 영역에서 성립하는지 (또는 적어도 영점 근처에서). 단봉 아니면 다른 시작값으로 다중 영점 점검.</p>
<p><strong>4. 정지 기준 다중</strong>: <img src="https://latex.codecogs.com/png.latex?%7Cf'%7C"> + <img src="https://latex.codecogs.com/png.latex?%7Cx_%7Bi+1%7D%20-%20x_i%7C"> 둘 다 점검. 한 가지만 보면 가짜 수렴 가능.</p>
<p><strong>5. Step-halving 으로 발산 방지</strong>: Newton 의 단순 구현은 위험. <img src="https://latex.codecogs.com/png.latex?f"> 값 모니터링 + step 절반 fallback 추가.</p>
</div>
</div>
</section>
<section id="관련-주제" class="level2" data-number="11">
<h2 data-number="11" class="anchored" data-anchor-id="관련-주제"><span class="header-section-number">11</span> 관련 주제</h2>
<p><strong>Klein Appendix A 시리즈</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/14-klein-appendix-a-numerical.html">Appendix A — Numerical Techniques for Maximization</a> — overview (단변수 + 다변수 종합)</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/14-2-multivariate-methods.html">§ A.2 — Multivariate Methods</a> — Steepest Ascent·Newton-Raphson 다변수·Marquardt 절충, 지그재그·Hessian 정규화 직관</li>
</ul>
<p><strong>본문 응용</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/08-klein-ch8-cox-ph.html">Ch.8 — Cox 비례위험 모형</a> — 단일 공변량 부분우도 (단변수 NR)</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/12-klein-ch12-parametric.html">Ch.12 — 모수적 회귀 모형</a> — Weibull/LL/LN MLE</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/13-2-gamma-frailty-marginal.html">§ 13.3-13.4 — Gamma Frailty EM &amp; Marginal Model</a> — EM M-step 의 1D θ 업데이트</li>
</ul>
<p><strong>관련 개념</strong></p>
<ul>
<li><a href="https://en.wikipedia.org/wiki/Brent%27s_method">Brent’s method (Wikipedia)</a> — 결합 알고리즘</li>
<li><a href="https://en.wikipedia.org/wiki/Rate_of_convergence">Convergence rate 일반 (Wikipedia)</a></li>
<li><a href="http://numerical.recipes/">Numerical Recipes Ch.9</a> — Bisection, Secant, Newton 의 실용 구현</li>
</ul>
</section>
<section id="참고-문헌" class="level2" data-number="12">
<h2 data-number="12" class="anchored" data-anchor-id="참고-문헌"><span class="header-section-number">12</span> 참고 문헌</h2>
<ul>
<li>Klein, J. P., &amp; Moeschberger, M. L. (2003). <em>Survival Analysis: Techniques for Censored and Truncated Data</em> (2nd ed.). Springer. <strong>Appendix A.1</strong>.</li>
<li>Brent, R. P. (1973). <em>Algorithms for Minimization without Derivatives</em>. Prentice-Hall. (Brent’s method 의 원전)</li>
<li>Press, W. H., Teukolsky, S. A., Vetterling, W. T., &amp; Flannery, B. P. (2007). <em>Numerical Recipes</em> (3rd ed.). Cambridge. (Bisection, Secant, Newton, Brent 의 실용 구현 + 수렴 차수 유도)</li>
<li>Thisted, R. A. (1988). <em>Elements of Statistical Computing: Numerical Computation</em>. Chapman and Hall. (Klein 인용 표준 교재)</li>
<li>Nocedal, J., &amp; Wright, S. J. (2006). <em>Numerical Optimization</em> (2nd ed.). Springer. (현대 표준, line search + trust region 포괄)</li>
</ul>


</section>

 ]]></description>
  <category>Statistics</category>
  <category>Survival Analysis</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Statistics/survival/14-1-univariate-methods.html</guid>
  <pubDate>Mon, 11 May 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Klein Appendix A — Numerical Techniques for Maximization</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Statistics/survival/14-klein-appendix-a-numerical.html</link>
  <description><![CDATA[ 





<section id="도입-왜-수치-최적화인가" class="level2" data-number="1">
<h2 data-number="1" class="anchored" data-anchor-id="도입-왜-수치-최적화인가"><span class="header-section-number">1</span> 도입 — 왜 수치 최적화인가</h2>
<p>Klein 책의 본문 (Ch.1-13) 에서 나온 추정 절차의 거의 전부가 다음 한 가지 문제로 환원된다:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cwidehat%7B%5Ctheta%7D%20=%20%5Carg%5Cmax_%7B%5Ctheta%7D%20L(%5Ctheta)%20%5Cquad%20%5Ctext%7B%EB%98%90%EB%8A%94%7D%20%5Cquad%20%5Carg%5Cmax_%7B%5Ctheta%7D%20%5Cell(%5Ctheta)%20=%20%5Clog%20L(%5Ctheta)%20.%20"></p>
<table class="table">
<colgroup>
<col style="width: 33%">
<col style="width: 33%">
<col style="width: 33%">
</colgroup>
<thead>
<tr class="header">
<th>본문 위치</th>
<th>추정 대상</th>
<th>우도/score 형태</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Ch.8 Cox PH</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"></td>
<td>부분우도 <img src="https://latex.codecogs.com/png.latex?L_p(%5Cbeta)"></td>
</tr>
<tr class="even">
<td>Ch.10 Aalen 가산</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Cwidehat%7BB%7D_k(t)"></td>
<td>시점별 OLS (closed-form 있음)</td>
</tr>
<tr class="odd">
<td>Ch.10 Lin-Ying</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Calpha%7D"></td>
<td><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Calpha%7D%20=%20A%5E%7B-1%7D%20B"> (closed-form)</td>
</tr>
<tr class="even">
<td>Ch.12 모수 회귀 (Weibull, LL, LN)</td>
<td><img src="https://latex.codecogs.com/png.latex?(%5Chat%7B%5Cmu%7D,%20%5Chat%7B%5Csigma%7D,%20%5Chat%7B%5Cgamma%7D)"></td>
<td>full 우도 <img src="https://latex.codecogs.com/png.latex?L(%5Cmu,%20%5Csigma,%20%5Cgamma)"></td>
</tr>
<tr class="odd">
<td>Ch.13 Gamma frailty EM</td>
<td><img src="https://latex.codecogs.com/png.latex?(%5Chat%7B%5Ctheta%7D,%20%5Chat%7B%5Cbeta%7D,%20%5Cwidehat%7BH%7D_0)"></td>
<td>E + M step</td>
</tr>
<tr class="even">
<td>Ch.13 Marginal model</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"></td>
<td>일반 Cox + sandwich</td>
</tr>
</tbody>
</table>
<p>이 중 <strong>closed-form 이 있는 것은 Aalen, Lin-Ying 두 가지뿐</strong>. 나머지 — Cox 부분우도, 모수 회귀 MLE, frailty EM 의 M-step, 일반화 감마, 시간의존 공변량 — 는 모두 <strong>반복적 수치 최적화</strong> 에 의존한다.</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
왜 closed-form 이 거의 없는가
</div>
</div>
<div class="callout-body-container callout-body">
<p>생존분석의 우도는 거의 항상 다음 두 인자를 포함한다:</p>
<ol type="1">
<li><strong>검열 (censoring)</strong>: 사건 관찰자는 밀도 <img src="https://latex.codecogs.com/png.latex?f">, 검열자는 생존함수 <img src="https://latex.codecogs.com/png.latex?S"> 로 우도에 들어가 <img src="https://latex.codecogs.com/png.latex?L%20=%20%5Cprod%20f%5E%5Cdelta%20S%5E%7B1-%5Cdelta%7D"> 형태. 이 곱 우도는 <img src="https://latex.codecogs.com/png.latex?%5Ctheta"> 에 대한 비선형 함수.</li>
<li><strong>위험집합 합 (risk set sum)</strong>: Cox 부분우도, frailty marginal 우도 모두 <img src="https://latex.codecogs.com/png.latex?%5Csum_%7Bj%20%5Cin%20R(t)%7D%20%5Cexp(%5Cbeta%5Et%20Z_j)"> 형태가 들어가 <img src="https://latex.codecogs.com/png.latex?%5Cbeta"> 의 비선형 함수.</li>
</ol>
<p>이 두 비선형성이 합쳐져 score 방정식 <img src="https://latex.codecogs.com/png.latex?%5Cpartial%20%5Cell%20/%20%5Cpartial%20%5Ctheta%20=%200"> 의 닫힌 해가 거의 존재하지 않는다. 따라서 <strong>score 의 영점을 수치적으로 찾는 것</strong> 이 표준 절차이다.</p>
<p>부록 A 는 이 “score 영점 찾기” 의 표준 도구 6 개 (단변수 3 + 다변수 3) 를 제시한다.</p>
</div>
</div>
<p>본 포스트는 § A.1 단변수 방법과 § A.2 다변수 방법의 알고리즘과 직관, Klein 의 Weibull MLE 두 예제로 본 수렴 비교, 그리고 생존분석 본문에서의 실제 응용을 정리한다.</p>
</section>
<section id="a.1-univariate-methods-단변수-score-영점-찾기" class="level2" data-number="2">
<h2 data-number="2" class="anchored" data-anchor-id="a.1-univariate-methods-단변수-score-영점-찾기"><span class="header-section-number">2</span> § A.1 Univariate Methods — 단변수 score 영점 찾기</h2>
<section id="문제-정의" class="level3" data-number="2.1">
<h3 data-number="2.1" class="anchored" data-anchor-id="문제-정의"><span class="header-section-number">2.1</span> 문제 정의</h3>
<p><img src="https://latex.codecogs.com/png.latex?f(x)"> 의 1차원 최대값을 찾는다. 정칙 조건 (<img src="https://latex.codecogs.com/png.latex?f"> 미분 가능, 단봉) 하에서:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Chat%7Bx%7D%20=%20%5Carg%5Cmax_x%20f(x)%20%5C;%5CLeftrightarrow%5C;%20f'(%5Chat%7Bx%7D)%20=%200%20%5C;%5Ctext%7Band%7D%5C;%20f''(%5Chat%7Bx%7D)%20%3C%200%20.%20"></p>
<p>따라서 score 함수 <img src="https://latex.codecogs.com/png.latex?f'(x)"> 의 <strong>영점 (root) 을 찾는 문제</strong> 로 환원된다. Klein 은 세 가지 방법을 제시한다.</p>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
모든 방법은 score 의 영점만 찾는다 — 최대인지 검증 필수
</div>
</div>
<div class="callout-body-container callout-body">
<p>세 방법 모두 <img src="https://latex.codecogs.com/png.latex?f'(x)%20=%200"> 의 해를 찾을 뿐, 그 해가 최대인지 최소인지 변곡점인지 알지 못한다.</p>
<p>수렴 후 반드시 <img src="https://latex.codecogs.com/png.latex?f''(%5Chat%7Bx%7D)%20%3C%200"> (단변수의 음의 정칙) 을 확인하거나, 또는 인접한 두 점에서 <img src="https://latex.codecogs.com/png.latex?f"> 값을 비교해 진짜 최대값임을 검증해야 한다. 우도 함수가 다봉형이면 여러 다른 시작값으로 시도해 전역 최대를 보장한다.</p>
</div>
</div>
</section>
<section id="bisection-이분법-가장-견고한-시작점" class="level3" data-number="2.2">
<h3 data-number="2.2" class="anchored" data-anchor-id="bisection-이분법-가장-견고한-시작점"><span class="header-section-number">2.2</span> Bisection 이분법 — 가장 견고한 시작점</h3>
<section id="알고리즘" class="level4" data-number="2.2.1">
<h4 data-number="2.2.1" class="anchored" data-anchor-id="알고리즘"><span class="header-section-number">2.2.1</span> 알고리즘</h4>
<p><img src="https://latex.codecogs.com/png.latex?f'(x)"> 의 영점이 구간 <img src="https://latex.codecogs.com/png.latex?%5Bx_L,%20x_U%5D"> 에 있다는 정보가 있다고 가정 (<img src="https://latex.codecogs.com/png.latex?f'(x_L)%20%5Ccdot%20f'(x_U)%20%3C%200">, 즉 양 끝의 score 가 부호가 다름).</p>
<pre><code>While (x_U - x_L) &gt; tol:
    x_N = (x_L + x_U) / 2          # 중점
    if f'(x_L) * f'(x_N) &gt; 0:
        x_L ← x_N                   # 해가 [x_N, x_U]
    else:
        x_U ← x_N                   # 해가 [x_L, x_N]</code></pre>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 절반씩 좁혀가는 보장된 수렴
</div>
</div>
<div class="callout-body-container callout-body">
<p>각 step 에서 구간 길이가 정확히 절반으로 줄어든다 → <img src="https://latex.codecogs.com/png.latex?k"> step 후 길이는 초기의 <img src="https://latex.codecogs.com/png.latex?2%5E%7B-k%7D">. 따라서 <img src="https://latex.codecogs.com/png.latex?%5Clog_2(%5Ctext%7B%EC%B4%88%EA%B8%B0%20%ED%8F%AD%7D/%5Ctext%7B%ED%97%88%EC%9A%A9%EC%98%A4%EC%B0%A8%7D)"> step 으로 무조건 수렴.</p>
<p><strong>장점</strong>: 초기 구간만 잡으면 <strong>반드시 수렴</strong> 한다. 함수 모양 무관.</p>
<p><strong>단점</strong>: 수렴 속도가 선형 (<img src="https://latex.codecogs.com/png.latex?k"> step 에 정확도 <img src="https://latex.codecogs.com/png.latex?2%5E%7B-k%7D">). 다른 방법이 가능하면 더 빠른 것을 선택.</p>
<p><strong>사용 시점</strong>: 초기값 정보가 부실하거나 함수가 거칠 때의 안전 시작.</p>
</div>
</div>
</section>
</section>
<section id="secant-method-할선법-식-a.1" class="level3" data-number="2.3">
<h3 data-number="2.3" class="anchored" data-anchor-id="secant-method-할선법-식-a.1"><span class="header-section-number">2.3</span> Secant Method 할선법 — 식 (A.1)</h3>
<section id="알고리즘-1" class="level4" data-number="2.3.1">
<h4 data-number="2.3.1" class="anchored" data-anchor-id="알고리즘-1"><span class="header-section-number">2.3.1</span> 알고리즘</h4>
<p>두 초기값 <img src="https://latex.codecogs.com/png.latex?x_0,%20x_1"> 에서 시작 (영점을 사이에 두지 않아도 OK). 각 step:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20x_%7Bi+1%7D%20=%20x_i%20-%20f'(x_i)%20%5Ccdot%20%5Cfrac%7Bx_i%20-%20x_%7Bi-1%7D%7D%7Bf'(x_i)%20-%20f'(x_%7Bi-1%7D)%7D%20.%20%5Ctag%7B%EC%8B%9D%20A.1%7D%20"></p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 할선의 영점
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?f'"> 의 영점을 찾는 데 <img src="https://latex.codecogs.com/png.latex?f'"> 자체의 두 점 <img src="https://latex.codecogs.com/png.latex?(x_%7Bi-1%7D,%20f'(x_%7Bi-1%7D))">, <img src="https://latex.codecogs.com/png.latex?(x_i,%20f'(x_i))"> 을 잇는 직선 (할선, secant) 의 <img src="https://latex.codecogs.com/png.latex?x"> 절편을 다음 후보로 삼는다.</p>
<p>이는 <strong><img src="https://latex.codecogs.com/png.latex?f'"> 가 거의 직선</strong> 이라는 가정 하에서 합리적이다. 실제 <img src="https://latex.codecogs.com/png.latex?f'"> 가 곡선이어도 두 점이 충분히 가까우면 직선 근사가 좋다.</p>
<p>수렴 차수: 황금 비율 <img src="https://latex.codecogs.com/png.latex?%5Cphi%20=%20(1+%5Csqrt%7B5%7D)/2%20%5Capprox%201.618"> — bisection (선형, 1) 보다 빠르고 Newton (2) 보다 느림. 그러나 <strong>2차 도함수 계산이 불필요</strong> 하다는 결정적 장점.</p>
<p><strong>사용 시점</strong>: <img src="https://latex.codecogs.com/png.latex?f''"> 가 복잡하거나 계산 비용이 큰 경우. Cox 부분우도의 Hessian 처럼 비용이 큰 경우 secant 가 유리.</p>
</div>
</div>
</section>
</section>
<section id="newton-raphson-방법-식-a.2" class="level3" data-number="2.4">
<h3 data-number="2.4" class="anchored" data-anchor-id="newton-raphson-방법-식-a.2"><span class="header-section-number">2.4</span> Newton-Raphson 방법 — 식 (A.2)</h3>
<section id="알고리즘-2" class="level4" data-number="2.4.1">
<h4 data-number="2.4.1" class="anchored" data-anchor-id="알고리즘-2"><span class="header-section-number">2.4.1</span> 알고리즘</h4>
<p>단일 초기값 <img src="https://latex.codecogs.com/png.latex?x_0"> 에서 시작:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20x_%7Bi+1%7D%20=%20x_i%20-%20%5Cfrac%7Bf'(x_i)%7D%7Bf''(x_i)%7D%20.%20%5Ctag%7B%EC%8B%9D%20A.2%7D%20"></p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — Taylor 1차 근사
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?x_i"> 근처에서 <img src="https://latex.codecogs.com/png.latex?f'"> 의 1차 Taylor 근사: <img src="https://latex.codecogs.com/png.latex?f'(x)%20%5Capprox%20f'(x_i)%20+%20f''(x_i)(x%20-%20x_i)">. 이 근사를 0 으로 놓고 <img src="https://latex.codecogs.com/png.latex?x"> 에 대해 풀면:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20x%20=%20x_i%20-%20%5Cfrac%7Bf'(x_i)%7D%7Bf''(x_i)%7D%20.%20"></p>
<p>이게 식 (A.2). 즉 <strong><img src="https://latex.codecogs.com/png.latex?f'"> 의 접선</strong> 의 <img src="https://latex.codecogs.com/png.latex?x"> 절편을 다음 추정값으로.</p>
<p>수렴 차수: <strong>2 차 (quadratic)</strong> — 매 step 에서 정확도가 거의 제곱된다. 정확도 <img src="https://latex.codecogs.com/png.latex?10%5E%7B-2%7D%20%5Cto%2010%5E%7B-4%7D%20%5Cto%2010%5E%7B-8%7D"> 의 폭발적 가속.</p>
<p><strong>장점</strong>: 초기값이 좋으면 매우 빠름. Cox/MLE 의 표준 알고리즘.</p>
<p><strong>단점</strong>: - 초기값이 나쁘면 발산 또는 잘못된 영점으로 수렴 가능. - <img src="https://latex.codecogs.com/png.latex?f''"> 계산 비용이 큰 경우 (예: 다변수 Hessian) 부담. - <img src="https://latex.codecogs.com/png.latex?f''(x_i)"> 가 0 에 가까우면 step 이 폭발 (수치 불안정).</p>
<p><strong>사용 시점</strong>: 좋은 초기값 + <img src="https://latex.codecogs.com/png.latex?f''"> 계산 가능 + 빠른 수렴 원할 때.</p>
</div>
</div>
</section>
</section>
<section id="세-방법-비교-식-a.1-a.2" class="level3" data-number="2.5">
<h3 data-number="2.5" class="anchored" data-anchor-id="세-방법-비교-식-a.1-a.2"><span class="header-section-number">2.5</span> 세 방법 비교 — 식 (A.1), (A.2)</h3>
<table class="table">
<thead>
<tr class="header">
<th>방법</th>
<th>정보 요구</th>
<th>초기값</th>
<th>수렴 차수</th>
<th>견고성</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Bisection</td>
<td><img src="https://latex.codecogs.com/png.latex?f'"> 만</td>
<td>부호 다른 두 점</td>
<td>1 (선형)</td>
<td>매우 강</td>
</tr>
<tr class="even">
<td>Secant</td>
<td><img src="https://latex.codecogs.com/png.latex?f'"> 만</td>
<td>두 점 (자유)</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Cphi%20%5Capprox%201.618"></td>
<td>중간</td>
</tr>
<tr class="odd">
<td>Newton-Raphson</td>
<td><img src="https://latex.codecogs.com/png.latex?f',%20f''"></td>
<td>한 점</td>
<td>2 (이차)</td>
<td>약 (초기값 의존)</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
실무 권고 — 세 방법의 결합
</div>
</div>
<div class="callout-body-container callout-body">
<p>Klein 도 명시하지 않은 결합 패턴이 표준 실무이다:</p>
<p><strong>1 단계 — Bisection 으로 초기 구간 좁히기</strong>: 거친 단계에서 견고한 bisection 으로 영점 부근 찾기 (예: 2-3 step 만).</p>
<p><strong>2 단계 — Newton-Raphson 으로 마무리</strong>: 영점 근처에서 빠른 2차 수렴.</p>
<p>이 결합이 R 의 <code>uniroot()</code>, Python <code>scipy.optimize.brentq</code> 등의 내부 알고리즘이다 (Brent’s method = bisection + secant + inverse quadratic 의 결합).</p>
<p>따라서 직접 구현 시는 보통 Newton-Raphson 만 써도 충분 (좋은 초기값 + safeguard) 하지만, 라이브러리는 결합 알고리즘을 사용해 양쪽 장점을 취한다.</p>
</div>
</div>
</section>
<section id="example-a.1-weibull-단모수-mle" class="level3" data-number="2.6">
<h3 data-number="2.6" class="anchored" data-anchor-id="example-a.1-weibull-단모수-mle"><span class="header-section-number">2.6</span> Example A.1 — Weibull 단모수 MLE</h3>
<section id="데이터" class="level4" data-number="2.6.1">
<h4 data-number="2.6.1" class="anchored" data-anchor-id="데이터"><span class="header-section-number">2.6.1</span> 데이터</h4>
<p>10 개의 비검열 관측 (단순화된 생존시간):</p>
<pre><code>2.57, 0.58, 0.82, 1.02, 0.78, 0.46, 1.04, 0.43, 0.69, 1.37</code></pre>
<p>진짜 모형: <img src="https://latex.codecogs.com/png.latex?%5Clambda%20=%201"> 고정 의 Weibull, <img src="https://latex.codecogs.com/png.latex?h(t)%20=%20%5Calpha%20t%5E%7B%5Calpha-1%7D%20e%5E%7B-t%5E%5Calpha%7D">. 형상 모수 <img src="https://latex.codecogs.com/png.latex?%5Calpha"> 만 추정.</p>
</section>
<section id="우도와-score" class="level4" data-number="2.6.2">
<h4 data-number="2.6.2" class="anchored" data-anchor-id="우도와-score"><span class="header-section-number">2.6.2</span> 우도와 score</h4>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cell(%5Calpha)%20=%20n%20%5Cln%20%5Calpha%20+%20(%5Calpha%20-%201)%20%5Csum%20%5Cln%20t_j%20-%20%5Csum%20t_j%5E%5Calpha%20.%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%20f'(%5Calpha)%20=%20%5Cfrac%7Bn%7D%7B%5Calpha%7D%20+%20%5Csum%20%5Cln%20t_j%20-%20%5Csum%20t_j%5E%5Calpha%20%5Cln%20t_j%20.%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%20f''(%5Calpha)%20=%20-%5Cfrac%7Bn%7D%7B%5Calpha%5E2%7D%20-%20%5Csum%20t_j%5E%5Calpha%20%5B%5Cln%20t_j%5D%5E2%20.%20"></p>
</section>
<section id="세-방법-적용-klein-본문-결과" class="level4" data-number="2.6.3">
<h4 data-number="2.6.3" class="anchored" data-anchor-id="세-방법-적용-klein-본문-결과"><span class="header-section-number">2.6.3</span> 세 방법 적용 — Klein 본문 결과</h4>
<table class="table">
<thead>
<tr class="header">
<th>방법</th>
<th>시작값</th>
<th>수렴 step</th>
<th><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Calpha%7D"></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Bisection</td>
<td><img src="https://latex.codecogs.com/png.latex?%5B%5Calpha_L,%20%5Calpha_U%5D%20=%20%5B1.5,%202%5D"></td>
<td><strong>8</strong></td>
<td>1.705</td>
</tr>
<tr class="even">
<td>Secant</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Calpha_0%20=%201,%20%5Calpha_1%20=%201.5"></td>
<td><strong>2</strong></td>
<td>1.705</td>
</tr>
<tr class="odd">
<td>Newton-Raphson</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Calpha_0%20=%201.5"></td>
<td><strong>2</strong></td>
<td>1.705</td>
</tr>
</tbody>
</table>
<p>(정지 기준: <img src="https://latex.codecogs.com/png.latex?%7Cf'(%5Calpha)%7C%20%3C%200.01">.)</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Example A.1 의 교훈
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>세 방법 모두 같은 답</strong> (<img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Calpha%7D%20=%201.705">) 에 수렴 — 단일 단봉 우도라 어떤 방법이든 OK.</p>
<p><strong>수렴 속도 비교</strong>:</p>
<ul>
<li>Bisection: 8 step (선형 수렴, 매 step 절반)</li>
<li>Secant: 2 step (sub-quadratic, 두 step 만에 거의 정확)</li>
<li>Newton-Raphson: 2 step (quadratic, 같은 2 step 이지만 더 정확한 끝값)</li>
</ul>
<p><strong>Newton-Raphson 의 첫 step</strong>: <img src="https://latex.codecogs.com/png.latex?%5Calpha_0%20=%201.5%20%5Cto%20%5Calpha_1%20=%201.701">. Secant 의 첫 step (<img src="https://latex.codecogs.com/png.latex?%5Calpha_0%20=%201,%20%5Calpha_1%20=%201.5%20%5Cto%20%5Calpha_2%20=%201.671">) 보다 정답에 더 가까움. <strong>2차 수렴의 위력</strong>.</p>
<p>이 예제는 모수 1 개라 Newton-Raphson 의 약점 (Hessian 비용) 이 거의 무. 실제 생존분석 모형은 모수 <img src="https://latex.codecogs.com/png.latex?p%20%5Cgeq%205"> 가 흔하므로 Hessian 의 <img src="https://latex.codecogs.com/png.latex?p%20%5Ctimes%20p"> 행렬 역수가 부담이 된다 — 그래서 § A.2 다변수 방법이 등장.</p>
</div>
</div>
</section>
</section>
</section>
<section id="a.2-multivariate-methods-다변수-score-영점-찾기" class="level2" data-number="3">
<h2 data-number="3" class="anchored" data-anchor-id="a.2-multivariate-methods-다변수-score-영점-찾기"><span class="header-section-number">3</span> § A.2 Multivariate Methods — 다변수 score 영점 찾기</h2>
<section id="표기" class="level3" data-number="3.1">
<h3 data-number="3.1" class="anchored" data-anchor-id="표기"><span class="header-section-number">3.1</span> 표기</h3>
<p><img src="https://latex.codecogs.com/png.latex?f(%5Cmathbf%7Bx%7D)"> 의 <img src="https://latex.codecogs.com/png.latex?p">-차원 최대값을 찾는다. 다음 두 양이 핵심.</p>
<p><strong>Gradient (1차 도함수 벡터)</strong>:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D)%20=%20%5Bu_1(%5Cmathbf%7Bx%7D),%20%5Cldots,%20u_p(%5Cmathbf%7Bx%7D)%5D%5Et%20,%20%5Cquad%20u_j(%5Cmathbf%7Bx%7D)%20=%20%5Cfrac%7B%5Cpartial%20f(%5Cmathbf%7Bx%7D)%7D%7B%5Cpartial%20x_j%7D%20.%20%5Ctag%7B%EC%8B%9D%20A.3%7D%20"></p>
<p><strong>Hessian (2차 도함수 행렬)</strong>:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7BH%7D(%5Cmathbf%7Bx%7D)%20=%20(H_%7Bij%7D(%5Cmathbf%7Bx%7D))%20,%20%5Cquad%20H_%7Bij%7D(%5Cmathbf%7Bx%7D)%20=%20%5Cfrac%7B%5Cpartial%5E2%20f(%5Cmathbf%7Bx%7D)%7D%7B%5Cpartial%20x_i%20%5Cpartial%20x_j%7D%20.%20%5Ctag%7B%EC%8B%9D%20A.4%7D%20"></p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 그래디언트는 “가장 가파른 오르막”
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D)"> 는 점 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bx%7D"> 에서 <img src="https://latex.codecogs.com/png.latex?f"> 가 가장 빠르게 증가하는 방향을 가리키는 단위 벡터에 그 비율을 곱한 것이다 (단, normalize 안 한 형태). 영점 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D%5E*)%20=%20%5Cmathbf%7B0%7D"> 인 점 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bx%7D%5E*"> 가 임계점.</p>
<p>Hessian <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 는 그 점의 곡률 (curvature). <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 가 음의 정칙 (negative definite) 이면 그 임계점이 최대.</p>
<p>다변수 score 영점 찾기는 단변수와 비슷하지만 <strong>방향 + 보폭</strong> 을 둘 다 결정해야 한다. 세 방법은 이 결정 방식이 다르다.</p>
</div>
</div>
</section>
<section id="steepest-ascent-식-a.5" class="level3" data-number="3.2">
<h3 data-number="3.2" class="anchored" data-anchor-id="steepest-ascent-식-a.5"><span class="header-section-number">3.2</span> Steepest Ascent — 식 (A.5)</h3>
<section id="알고리즘-3" class="level4" data-number="3.2.1">
<h4 data-number="3.2.1" class="anchored" data-anchor-id="알고리즘-3"><span class="header-section-number">3.2.1</span> 알고리즘</h4>
<p>각 step 에서 그래디언트 방향으로 직선 탐색:</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7Bx%7D_%7Bk+1%7D%20=%20%5Cmathbf%7Bx%7D_k%20+%20d_k%20%5C,%20%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D_k)%20,%20%5Ctag%7B%EC%8B%9D%20A.5%7D%20"></p>
<p>여기서 <img src="https://latex.codecogs.com/png.latex?d_k"> 는 그 방향에서 <img src="https://latex.codecogs.com/png.latex?f"> 를 최대화하는 step size (1D 최적화 — bisection/Newton 등으로 1 차원 풀이).</p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — “현재 점에서 가장 가파른 방향” 만 사용
</div>
</div>
<div class="callout-body-container callout-body">
<p>Hessian 정보를 안 쓴다 — gradient 만 보고 그 방향으로 1D 최적화. 따라서:</p>
<p><strong>장점</strong>: Hessian 불필요. 초기값 견고 (수렴 보장).</p>
<p><strong>단점</strong>: <strong>수렴 매우 느림</strong>. 길쭉한 우도 함수 (한 축의 곡률이 다른 축보다 크게 다름) 에서 지그재그로 진동하며 천천히 수렴.</p>
<p><strong>사용 시점</strong>: 초기값이 매우 나쁠 때의 첫 몇 step 만. 또는 Hessian 계산이 불가능할 때 (예: 비미분 함수의 근사).</p>
</div>
</div>
</section>
</section>
<section id="newton-raphson-다변수-식-a.6" class="level3" data-number="3.3">
<h3 data-number="3.3" class="anchored" data-anchor-id="newton-raphson-다변수-식-a.6"><span class="header-section-number">3.3</span> Newton-Raphson 다변수 — 식 (A.6)</h3>
<section id="알고리즘-4" class="level4" data-number="3.3.1">
<h4 data-number="3.3.1" class="anchored" data-anchor-id="알고리즘-4"><span class="header-section-number">3.3.1</span> 알고리즘</h4>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7Bx%7D_%7Bk+1%7D%20=%20%5Cmathbf%7Bx%7D_k%20-%20%5Cmathbf%7BH%7D(%5Cmathbf%7Bx%7D_k)%5E%7B-1%7D%20%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D_k)%20.%20%5Ctag%7B%EC%8B%9D%20A.6%7D%20"></p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 단변수의 직접 일반화
</div>
</div>
<div class="callout-body-container callout-body">
<p>단변수 식 (A.2) <img src="https://latex.codecogs.com/png.latex?x_%7Bi+1%7D%20=%20x_i%20-%20f'(x_i)/f''(x_i)"> 에서 <img src="https://latex.codecogs.com/png.latex?f'/f''%20%5Cto%20%5Cmathbf%7BH%7D%5E%7B-1%7D%20%5Cmathbf%7Bu%7D"> 로 대체. Hessian 의 역수가 곡률 보정 역할.</p>
<p>또한 식 (A.6) 의 <img src="https://latex.codecogs.com/png.latex?-%5Cmathbf%7BH%7D%5E%7B-1%7D%20%5Cmathbf%7Bu%7D"> 가 Hessian-orthogonal 좌표계에서의 steepest ascent 와 같다. 즉 <strong>Hessian 으로 좌표를 정규화한 후 steepest ascent</strong> 를 적용한 것과 동치. 이는 길쭉한 우도 함수의 지그재그 문제를 자동 해결.</p>
<p><strong>수렴 차수</strong>: 2 차 (quadratic). 영점 부근에서 매우 빠름.</p>
<p><strong>단점 (단변수와 같음)</strong>: - 초기값이 나쁘면 발산 또는 잘못된 방향. - <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 가 singular 또는 ill-conditioned 면 수치 불안정. - <img src="https://latex.codecogs.com/png.latex?p%20%5Ctimes%20p"> Hessian 행렬 역수 비용 (<img src="https://latex.codecogs.com/png.latex?O(p%5E3)">) — <img src="https://latex.codecogs.com/png.latex?p"> 클 때 부담.</p>
<p><strong>대처</strong>: <img src="https://latex.codecogs.com/png.latex?f(%5Cmathbf%7Bx%7D_k)%20%3E%20f(%5Cmathbf%7Bx%7D_%7Bk+1%7D)"> (잘못된 방향) 이 검출되면 step 크기를 절반으로 줄임 (<img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bx%7D_%7Bk+1%7D%20=%20%5Cmathbf%7Bx%7D_k%20-%20%5Cmathbf%7BH%7D%5E%7B-1%7D%5Cmathbf%7Bu%7D/2">) — SAS 와 BMDP 의 Cox 회귀가 이 방식 사용.</p>
</div>
</div>
</section>
</section>
<section id="marquardts-method-steepest-ascent-와-newton-raphson-의-절충" class="level3" data-number="3.4">
<h3 data-number="3.4" class="anchored" data-anchor-id="marquardts-method-steepest-ascent-와-newton-raphson-의-절충"><span class="header-section-number">3.4</span> Marquardt’s Method — Steepest Ascent 와 Newton-Raphson 의 절충</h3>
<section id="알고리즘-5" class="level4" data-number="3.4.1">
<h4 data-number="3.4.1" class="anchored" data-anchor-id="알고리즘-5"><span class="header-section-number">3.4.1</span> 알고리즘</h4>
<p><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BS%7D_k"> 를 대각 스케일 행렬 (<img src="https://latex.codecogs.com/png.latex?S_%7Bii%7D%20=%20%7CH_%7Bii%7D(%5Cmathbf%7Bx%7D_k)%7C%5E%7B-1/2%7D">). <img src="https://latex.codecogs.com/png.latex?%5Cgamma%20%5Cgeq%200"> 을 blending 상수.</p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7Bx%7D_%7Bk+1%7D%20=%20%5Cmathbf%7Bx%7D_k%20-%20%5Cmathbf%7BS%7D_k%20%5Cbig(%5Cmathbf%7BS%7D_k%20%5Cmathbf%7BH%7D(%5Cmathbf%7Bx%7D_k)%20%5Cmathbf%7BS%7D_k%20+%20%5Cgamma%20%5Cmathbf%7BI%7D%5Cbig)%5E%7B-1%7D%20%5Cmathbf%7BS%7D_k%20%5Cmathbf%7Bu%7D(%5Cmathbf%7Bx%7D_k)%20.%20"></p>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — <img src="https://latex.codecogs.com/png.latex?%5Cgamma"> 가 두 방법을 잇는 다이얼
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li><img src="https://latex.codecogs.com/png.latex?%5Cgamma%20=%200">: <img src="https://latex.codecogs.com/png.latex?(%5Cmathbf%7BS%7D_k%20%5Cmathbf%7BH%7D%20%5Cmathbf%7BS%7D_k)%5E%7B-1%7D"> 만 남아 정규화된 Newton-Raphson.</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cgamma%20%5Cto%20%5Cinfty">: 분모의 <img src="https://latex.codecogs.com/png.latex?%5Cgamma%20%5Cmathbf%7BI%7D"> 가 지배 → <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BS%7D_k%20%5Ccdot%20%5Cfrac%7B%5Cmathbf%7BS%7D_k%20%5Cmathbf%7Bu%7D%7D%7B%5Cgamma%7D"> → steepest ascent (Hessian 영향 사라짐).</li>
</ul>
<p><strong>적응 절차</strong>:</p>
<ol type="1">
<li>작은 <img src="https://latex.codecogs.com/png.latex?%5Cgamma"> 로 시작 (예: <img src="https://latex.codecogs.com/png.latex?%5Cgamma%20=%200.01">).</li>
<li>한 step 후 <img src="https://latex.codecogs.com/png.latex?f(%5Cmathbf%7Bx%7D_%7Bk+1%7D)%20%3E%20f(%5Cmathbf%7Bx%7D_k)"> 면 OK, 다음 step.</li>
<li><img src="https://latex.codecogs.com/png.latex?f(%5Cmathbf%7Bx%7D_%7Bk+1%7D)%20%5Cleq%20f(%5Cmathbf%7Bx%7D_k)"> 면 (방향 잘못됨) <img src="https://latex.codecogs.com/png.latex?%5Cgamma"> 를 10 배 늘려 재시도.</li>
<li>수렴 직전 마지막 step 은 <img src="https://latex.codecogs.com/png.latex?%5Cgamma%20=%200"> (순수 Newton-Raphson) 으로 정확 마무리.</li>
</ol>
<p><strong>Marquardt (1963) 의 핵심 통찰</strong>: 초기에는 Hessian 정보가 부정확할 수 있으므로 (<img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 가 양의 정칙일 수도) steepest ascent 쪽에 가깝게, 영점 근처에서는 Newton-Raphson 의 빠른 수렴 활용.</p>
<p><strong>비유</strong>: 처음에는 안전 운전 (steepest ascent), 도착지 가까워지면 액셀 (Newton-Raphson). 비선형 회귀 (<code>nls()</code> in R) 의 default 알고리즘.</p>
</div>
</div>
</section>
</section>
<section id="수렴-판정-4-가지-기준" class="level3" data-number="3.5">
<h3 data-number="3.5" class="anchored" data-anchor-id="수렴-판정-4-가지-기준"><span class="header-section-number">3.5</span> 수렴 판정 — 4 가지 기준</h3>
<p>다변수 최적화의 수렴 여부 결정은 다음 중 하나 (또는 조합) 로:</p>
<ol type="1">
<li><strong>함수값 변화</strong>: <img src="https://latex.codecogs.com/png.latex?f(%5Cmathbf%7Bx%7D_%7Bk+1%7D)%20-%20f(%5Cmathbf%7Bx%7D_k)%20%3C%20%5Cepsilon"> 또는 상대 변화 <img src="https://latex.codecogs.com/png.latex?%7C%5B%5C,%5D/f(%5Cmathbf%7Bx%7D_k)%7C%20%3C%20%5Cepsilon">.</li>
<li><strong>그래디언트 노름</strong>: <img src="https://latex.codecogs.com/png.latex?%5Csum_j%20u_j(%5Cmathbf%7Bx%7D_%7Bk+1%7D)%5E2%20%3C%20%5Cepsilon"> 또는 <img src="https://latex.codecogs.com/png.latex?%5Cmax_j%20%7Cu_j(%5Cmathbf%7Bx%7D_%7Bk+1%7D)%7C%20%3C%20%5Cepsilon">.</li>
<li><strong>모수 변화</strong>: <img src="https://latex.codecogs.com/png.latex?%5Csum_j%20(x_%7Bk+1,%20j%7D%20-%20x_%7Bk,%20j%7D)%5E2%20%3C%20%5Cepsilon"> 또는 <img src="https://latex.codecogs.com/png.latex?%5Cmax_j%20%7Cx_%7Bk+1,%20j%7D%20-%20x_%7Bk,%20j%7D%7C%20%3C%20%5Cepsilon">.</li>
<li><strong>반복 한계</strong>: <img src="https://latex.codecogs.com/png.latex?k%20%5Cgeq%20k_%7B%5Cmax%7D"> — 발산 방지 안전장치.</li>
</ol>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
어느 기준이 좋은가
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>그래디언트 기준</strong>: 이론적으로 가장 정직 (<img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bu%7D%20=%200"> 이 최적성 조건). 그러나 <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bu%7D"> 의 척도가 모수 차원마다 달라 단일 <img src="https://latex.codecogs.com/png.latex?%5Cepsilon"> 으로 설정하기 까다로움.</p>
<p><strong>모수 변화 기준</strong>: 직관적이지만 평탄한 우도에서 가짜 수렴 가능 (step 이 작아져도 진짜 최적이 아닐 수 있음).</p>
<p><strong>함수값 변화 기준</strong>: 가장 흔히 사용. 우도가 거의 안 변한다 = 사실상 수렴.</p>
<p><strong>실무</strong>: 함수값 + 그래디언트 둘 다 점검. 상대 변화 <img src="https://latex.codecogs.com/png.latex?%5Cepsilon%20=%2010%5E%7B-6%7D"> 또는 <img src="https://latex.codecogs.com/png.latex?10%5E%7B-8%7D"> 권장.</p>
</div>
</div>
</section>
<section id="example-a.2-weibull-두-모수-mle" class="level3" data-number="3.6">
<h3 data-number="3.6" class="anchored" data-anchor-id="example-a.2-weibull-두-모수-mle"><span class="header-section-number">3.6</span> Example A.2 — Weibull 두 모수 MLE</h3>
<p>같은 10 개 데이터로 <img src="https://latex.codecogs.com/png.latex?S(t)%20=%20%5Cexp(-%5Clambda%20t%5E%5Calpha)"> 의 두 모수 추정. 시작값 <img src="https://latex.codecogs.com/png.latex?(%5Clambda_0,%20%5Calpha_0)%20=%20(1.024,%201.000)"> (<img src="https://latex.codecogs.com/png.latex?%5Clambda_0%20=%2010/%5Csum%20t_i"> 의 method-of-moments 추정).</p>
<section id="score-와-hessian" class="level4" data-number="3.6.1">
<h4 data-number="3.6.1" class="anchored" data-anchor-id="score-와-hessian"><span class="header-section-number">3.6.1</span> Score 와 Hessian</h4>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cbegin%7Baligned%7D%0Au_%5Clambda%20&amp;=%20%5Cfrac%7Bn%7D%7B%5Clambda%7D%20-%20%5Csum%20t_i%5E%5Calpha%20,%20%5C%5C%0Au_%5Calpha%20&amp;=%20%5Cfrac%7Bn%7D%7B%5Calpha%7D%20+%20%5Csum%20%5Cln%20t_i%20-%20%5Clambda%20%5Csum%20t_i%5E%5Calpha%20%5Cln%20t_i%20,%0A%5Cend%7Baligned%7D%20"></p>
<p><img src="https://latex.codecogs.com/png.latex?%20%5Cmathbf%7BH%7D(%5Clambda,%20%5Calpha)%20=%20%5Cbegin%7Bpmatrix%7D%0A-%5Cfrac%7Bn%7D%7B%5Clambda%5E2%7D%20&amp;%20-%5Csum%20t_i%5E%5Calpha%20%5Cln%20t_i%20%5C%5C%0A-%5Csum%20t_i%5E%5Calpha%20%5Cln%20t_i%20&amp;%20-%5Cfrac%7Bn%7D%7B%5Calpha%5E2%7D%20-%20%5Clambda%20%5Csum%20t_i%5E%5Calpha%20(%5Cln%20t_i)%5E2%0A%5Cend%7Bpmatrix%7D%20.%20"></p>
</section>
<section id="세-방법-비교-klein-본문-결과" class="level4" data-number="3.6.2">
<h4 data-number="3.6.2" class="anchored" data-anchor-id="세-방법-비교-klein-본문-결과"><span class="header-section-number">3.6.2</span> 세 방법 비교 — Klein 본문 결과</h4>
<table class="table">
<thead>
<tr class="header">
<th>방법</th>
<th>수렴 step</th>
<th><img src="https://latex.codecogs.com/png.latex?(%5Chat%7B%5Clambda%7D,%20%5Chat%7B%5Calpha%7D)"></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Steepest ascent</td>
<td><strong>5</strong></td>
<td><img src="https://latex.codecogs.com/png.latex?(0.839,%201.792)"></td>
</tr>
<tr class="even">
<td>Newton-Raphson</td>
<td><strong>3</strong></td>
<td><img src="https://latex.codecogs.com/png.latex?(0.832,%201.796)"></td>
</tr>
<tr class="odd">
<td>Marquardt (<img src="https://latex.codecogs.com/png.latex?%5Cgamma%20=%200.5">)</td>
<td>(~3-4)</td>
<td>수렴</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Example A.2 의 교훈
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>Newton-Raphson 의 우월성</strong>: 단 3 step 으로 수렴 — Hessian 정보를 활용해 직접 영점으로 점프.</p>
<p><strong>Steepest ascent 의 지그재그</strong>: 5 step 필요. 자세히 보면:</p>
<pre><code>Step 0: λ=1.024, α=1.000  →  α 방향으로 큰 step (u_α=7.035)
Step 1: λ=1.025, α=1.693  →  λ 방향으로 step (u_λ=0.661)
Step 2: λ=0.865, α=1.694  →  α 방향 보정
Step 3: λ=0.865, α=1.777
Step 4: λ=0.839, α=1.777
Step 5: λ=0.839, α=1.792 (수렴)</code></pre>
<p>각 step 이 한 모수씩 번갈아 큰 변화 — 우도 표면이 길쭉할 때 steepest ascent 의 전형적 비효율 패턴.</p>
<p><strong>Marquardt 의 절충</strong>: 초기 step 은 steepest 쪽 (안전), 후반은 Newton 쪽 (빠름). 실무 default.</p>
<p><strong>Newton-Raphson 의 미세 차이</strong>: 같은 데이터에 steepest 가 <img src="https://latex.codecogs.com/png.latex?(0.839,%201.792)"> Newton 이 <img src="https://latex.codecogs.com/png.latex?(0.832,%201.796)"> 으로 약간 다름 — 수렴 정밀도 차이 (모두 <img src="https://latex.codecogs.com/png.latex?%7Cu%7C%20%3C%200.1"> 까지만 풀어 정확한 최적값에 충분히 가까이는 안 옴). <img src="https://latex.codecogs.com/png.latex?%5Cepsilon"> 을 더 작게 하면 일치한다.</p>
</div>
</div>
</section>
</section>
</section>
<section id="생존분석에서의-응용-수치-최적화가-어디에-등장하는가" class="level2" data-number="4">
<h2 data-number="4" class="anchored" data-anchor-id="생존분석에서의-응용-수치-최적화가-어디에-등장하는가"><span class="header-section-number">4</span> 생존분석에서의 응용 — 수치 최적화가 어디에 등장하는가</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Cox 부분우도 (Ch.8)
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>문제</strong>: <img src="https://latex.codecogs.com/png.latex?%5Cpartial%20%5Clog%20L_p(%5Cbeta)%20/%20%5Cpartial%20%5Cbeta%20=%200">. <img src="https://latex.codecogs.com/png.latex?%5Cbeta%20%5Cin%20%5Cmathbb%7BR%7D%5Ep"> 이라 다변수.</p>
<p><strong>Score</strong>: <img src="https://latex.codecogs.com/png.latex?u_k(%5Cbeta)%20=%20%5Csum_j%20%5Cdelta_j%20%5BZ_%7Bjk%7D%20-%20%5Cbar%7BZ%7D_k(t_j;%20%5Cbeta)%5D">. (<img src="https://latex.codecogs.com/png.latex?%5Cbar%7BZ%7D"> 는 위험집합 가중 평균.)</p>
<p><strong>Hessian</strong>: <img src="https://latex.codecogs.com/png.latex?H_%7Bkl%7D(%5Cbeta)%20=%20-%5Csum_j%20%5Cdelta_j%20%5Ctext%7BVar%7D_%7BR(t_j)%7D(Z_k,%20Z_l;%20%5Cbeta)">. (위험집합의 가중 공분산.)</p>
<p><strong>알고리즘</strong>: Newton-Raphson (식 A.6). R <code>coxph()</code> 의 표준. 수렴 보통 4-7 iteration.</p>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
모수 회귀 MLE (Ch.12)
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>문제</strong>: <img src="https://latex.codecogs.com/png.latex?%5Carg%5Cmax_%7B(%5Cmu,%20%5Csigma,%20%5Cgamma)%7D%20L(%5Cmu,%20%5Csigma,%20%5Cgamma;%20%5Ctext%7Bdata%7D)"> — Weibull, log-logistic, log-normal 등.</p>
<p><strong>모수 수</strong>: <img src="https://latex.codecogs.com/png.latex?1%20+%201%20+%20p"> (intercept + scale + 회귀 계수).</p>
<p><strong>알고리즘</strong>: Newton-Raphson 또는 quasi-Newton. R <code>survreg()</code> 의 표준. 시작값을 OLS 등으로 보강하면 수렴 안정.</p>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Frailty EM M-step (Ch.13)
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>문제</strong>: M-step 에서 <img src="https://latex.codecogs.com/png.latex?%5Chat%7Bu%7D_i"> 를 known offset 으로 둔 Cox partial likelihood 최대화 (식 13.3.7) + <img src="https://latex.codecogs.com/png.latex?%5Ctheta"> 의 1D 최대화.</p>
<p><strong>알고리즘</strong>: - <img src="https://latex.codecogs.com/png.latex?%5Cbeta"> 업데이트: 다변수 Newton-Raphson (Cox 와 동일). - <img src="https://latex.codecogs.com/png.latex?%5Ctheta"> 업데이트: 단변수 Newton-Raphson 또는 grid search (Nielsen profile EM).</p>
<p>EM 전체는 외부 반복 + 내부 (M-step) 반복의 이중 구조. 외부 수렴 느림 → Nielsen profile EM 으로 가속.</p>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
일반화 감마 / 시간의존 공변량 (Ch.9, 12)
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>일반화 감마</strong> (Ch.12.4): 3 모수 (<img src="https://latex.codecogs.com/png.latex?%5Cmu,%20%5Csigma,%20%5Ctheta">), 어떤 분포든 포괄. Newton-Raphson 으로 풀이 — Marquardt 권장 (초기 hessian 약함).</p>
<p><strong>시간의존 공변량</strong> (Ch.9): <img src="https://latex.codecogs.com/png.latex?%5Cbeta"> 가 정상이지만 <img src="https://latex.codecogs.com/png.latex?Z(t)"> 가 시간 변동. Cox partial likelihood 의 표현 변경, 알고리즘 (Newton-Raphson) 동일.</p>
</div>
</div>
</section>
<section id="코드-예시" class="level2" data-number="5">
<h2 data-number="5" class="anchored" data-anchor-id="코드-예시"><span class="header-section-number">5</span> 코드 예시</h2>
<section id="step-1-python-scipy.optimize-의-통합-api" class="level3" data-number="5.1">
<h3 data-number="5.1" class="anchored" data-anchor-id="step-1-python-scipy.optimize-의-통합-api"><span class="header-section-number">5.1</span> Step 1 — Python: scipy.optimize 의 통합 API</h3>
<div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb4-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb4-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> scipy.optimize <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> minimize_scalar, minimize, newton</span>
<span id="cb4-3"></span>
<span id="cb4-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 1. Univariate (Example A.1) — Weibull α MLE</span></span>
<span id="cb4-5">data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.array([<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.57</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.58</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.82</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.02</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.78</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.46</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.04</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.43</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.69</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.37</span>])</span>
<span id="cb4-6">n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">len</span>(data)</span>
<span id="cb4-7"></span>
<span id="cb4-8"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> neg_log_lik(alpha):</span>
<span id="cb4-9">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>(n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.log(alpha) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(np.log(data))</span>
<span id="cb4-10">             <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span> alpha))</span>
<span id="cb4-11"></span>
<span id="cb4-12"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Brent's method (bisection + secant + inverse quadratic)</span></span>
<span id="cb4-13">res <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> minimize_scalar(neg_log_lik, bracket<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.0</span>), method<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'brent'</span>)</span>
<span id="cb4-14"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Brent: α̂ = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>x<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, iters = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>nit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb4-15"></span>
<span id="cb4-16"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Newton-Raphson (직접 구현 — 식 A.2)</span></span>
<span id="cb4-17"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> score(alpha):</span>
<span id="cb4-18">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(np.log(data)) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span> alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.log(data))</span>
<span id="cb4-19"></span>
<span id="cb4-20"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> hessian(alpha):</span>
<span id="cb4-21">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span> alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.log(data) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)</span>
<span id="cb4-22"></span>
<span id="cb4-23">alpha_hat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> newton(score, x0<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>, fprime<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>hessian, tol<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-6</span>)</span>
<span id="cb4-24"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Newton: α̂ = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>alpha_hat<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb4-25"></span>
<span id="cb4-26"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 2. Multivariate (Example A.2) — Weibull (λ, α) MLE</span></span>
<span id="cb4-27"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> neg_log_lik_2(params):</span>
<span id="cb4-28">    lam, alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> params</span>
<span id="cb4-29">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> lam <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">or</span> alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>:</span>
<span id="cb4-30">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> np.inf</span>
<span id="cb4-31">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>(n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.log(lam) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.log(alpha) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(np.log(data))</span>
<span id="cb4-32">             <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> lam <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span> alpha))</span>
<span id="cb4-33"></span>
<span id="cb4-34"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># BFGS (quasi-Newton, default for unconstrained smooth)</span></span>
<span id="cb4-35">res <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> minimize(neg_log_lik_2, x0<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>], method<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'BFGS'</span>)</span>
<span id="cb4-36"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"BFGS: λ̂ = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>x[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, α̂ = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>x[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, iters = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>res<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>nit<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb4-37"></span>
<span id="cb4-38"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Levenberg-Marquardt 변형 (least_squares 통해)</span></span>
<span id="cb4-39"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># scipy.optimize.minimize 는 직접 LM 안 지원, least_squares 의 method='lm' 으로</span></span></code></pre></div>
</section>
<section id="step-2-r-optim-통합-인터페이스" class="level3" data-number="5.2">
<h3 data-number="5.2" class="anchored" data-anchor-id="step-2-r-optim-통합-인터페이스"><span class="header-section-number">5.2</span> Step 2 — R: optim() 통합 인터페이스</h3>
<div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb5-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 데이터</span></span>
<span id="cb5-2">data <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.57</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.58</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.82</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.02</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.78</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.46</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.04</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.43</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.69</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.37</span>)</span>
<span id="cb5-3">n <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(data)</span>
<span id="cb5-4"></span>
<span id="cb5-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 음의 log-likelihood (R optim 은 minimize)</span></span>
<span id="cb5-6">neg_log_lik <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">function</span>(params) {</span>
<span id="cb5-7">  lam   <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> params[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]</span>
<span id="cb5-8">  alpha <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> params[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>]</span>
<span id="cb5-9">  <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> (lam <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">||</span> alpha <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>) <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">return</span>(<span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">Inf</span>)</span>
<span id="cb5-10">  <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>(n <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log</span>(lam) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> n <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log</span>(alpha) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (alpha <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log</span>(data))</span>
<span id="cb5-11">    <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> lam <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(data <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span> alpha))</span>
<span id="cb5-12">}</span>
<span id="cb5-13"></span>
<span id="cb5-14"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># BFGS (default for smooth)</span></span>
<span id="cb5-15">fit_bfgs <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">optim</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">par =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fn =</span> neg_log_lik, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">method =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BFGS"</span>)</span>
<span id="cb5-16"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BFGS: λ̂ ="</span>, fit_bfgs<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>par[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>], <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"α̂ ="</span>, fit_bfgs<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>par[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>], <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb5-17"></span>
<span id="cb5-18"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Nelder-Mead (gradient-free, robust for noisy/non-smooth)</span></span>
<span id="cb5-19">fit_nm <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">optim</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">par =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fn =</span> neg_log_lik, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">method =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nelder-Mead"</span>)</span>
<span id="cb5-20"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NM:   λ̂ ="</span>, fit_nm<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>par[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>], <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"α̂ ="</span>, fit_nm<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>par[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>], <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb5-21"></span>
<span id="cb5-22"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># L-BFGS-B (with box constraints, lambda &gt; 0, alpha &gt; 0)</span></span>
<span id="cb5-23">fit_lbfgs <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">optim</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">par =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fn =</span> neg_log_lik, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">method =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"L-BFGS-B"</span>,</span>
<span id="cb5-24">                   <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">lower =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.01</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.01</span>))</span>
<span id="cb5-25"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"LBFGS:λ̂ ="</span>, fit_lbfgs<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>par[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>], <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"α̂ ="</span>, fit_lbfgs<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>par[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>], <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb5-26"></span>
<span id="cb5-27"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Levenberg-Marquardt — minpack.lm 패키지</span></span>
<span id="cb5-28"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(minpack.lm)</span>
<span id="cb5-29"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># nlsLM() 은 nls() 의 LM 변형 — 회귀 형태에 사용</span></span></code></pre></div>
</section>
<section id="step-3-survreg-coxph-내부-알고리즘-확인" class="level3" data-number="5.3">
<h3 data-number="5.3" class="anchored" data-anchor-id="step-3-survreg-coxph-내부-알고리즘-확인"><span class="header-section-number">5.3</span> Step 3 — survreg / coxph 내부 알고리즘 확인</h3>
<div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb6-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(survival)</span>
<span id="cb6-2"></span>
<span id="cb6-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Cox PH — coxph 는 Newton-Raphson 사용 (with step-halving)</span></span>
<span id="cb6-4">fit_cox <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coxph</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Surv</span>(time, status) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> x, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> ...)</span>
<span id="cb6-5">fit_cox<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>iter            <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 수렴 step 수</span></span>
<span id="cb6-6">fit_cox<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>loglik          <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 초기 + 수렴 시 log-likelihood</span></span>
<span id="cb6-7"></span>
<span id="cb6-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Weibull AFT — survreg 는 Newton-Raphson</span></span>
<span id="cb6-9">fit_wei <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">survreg</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Surv</span>(time, status) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> x, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">dist =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"weibull"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> ...)</span>
<span id="cb6-10">fit_wei<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>iter</span>
<span id="cb6-11">fit_wei<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>loglik</span></code></pre></div>
</section>
</section>
<section id="핵심-요약" class="level2" data-number="6">
<h2 data-number="6" class="anchored" data-anchor-id="핵심-요약"><span class="header-section-number">6</span> 핵심 요약</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
부록 A 한 줄 요약
</div>
</div>
<div class="callout-body-container callout-body">
<blockquote class="blockquote">
<p>생존분석의 거의 모든 추정 (Cox · 모수 회귀 · frailty EM) 은 score 방정식 <img src="https://latex.codecogs.com/png.latex?%5Cpartial%20%5Cell%20/%20%5Cpartial%20%5Ctheta%20=%200"> 의 수치 영점 찾기로 환원된다. <strong>단변수</strong>에서는 bisection (견고·느림) → secant (식 A.1, 빠름·<img src="https://latex.codecogs.com/png.latex?f''"> 불필요) → Newton-Raphson (식 A.2, 가장 빠름) 의 trade-off. <strong>다변수</strong>에서는 steepest ascent (식 A.5, 견고·느림) → Newton-Raphson (식 A.6, 빠름·Hessian 비용) → Marquardt 절충 (<img src="https://latex.codecogs.com/png.latex?%5Cgamma"> 다이얼로 두 방법 결합) 의 trade-off. 실무에서는 R <code>optim</code> 의 BFGS, Python <code>scipy.optimize</code> 의 Brent / BFGS / LM 등이 이 알고리즘들의 결합 형태로 자동 사용된다.</p>
</blockquote>
</div>
</div>
<table class="table">
<thead>
<tr class="header">
<th>절</th>
<th>방법</th>
<th>핵심 식</th>
<th>수렴 차수</th>
<th>견고성</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>A.1</td>
<td>Bisection</td>
<td>절반씩 좁힘</td>
<td>1 (선형)</td>
<td>매우 강</td>
</tr>
<tr class="even">
<td>A.1</td>
<td>Secant</td>
<td>식 (A.1)</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Cphi%20%5Capprox%201.618"></td>
<td>중간</td>
</tr>
<tr class="odd">
<td>A.1</td>
<td>Newton-Raphson</td>
<td>식 (A.2)</td>
<td>2 (이차)</td>
<td>약</td>
</tr>
<tr class="even">
<td>A.2</td>
<td>Steepest Ascent</td>
<td>식 (A.5)</td>
<td>선형</td>
<td>매우 강</td>
</tr>
<tr class="odd">
<td>A.2</td>
<td>Newton-Raphson 다변수</td>
<td>식 (A.6)</td>
<td>2 (이차)</td>
<td>약</td>
</tr>
<tr class="even">
<td>A.2</td>
<td>Marquardt</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Cgamma"> blending</td>
<td>적응</td>
<td>중간-강</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
5 가지 실무 권고
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>1. 좋은 시작값이 가장 중요</strong>: Newton-Raphson 의 빠른 수렴은 시작값이 영점 근처일 때만. Method-of-moments, OLS 등으로 사전 추정 후 시작.</p>
<p><strong>2. Hessian 비용이 크면 Quasi-Newton (BFGS)</strong>: <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D"> 를 score 변화로 근사. R <code>optim</code>, Python <code>scipy.optimize.minimize</code> 의 default. Cox 보다 더 큰 모형에서 표준.</p>
<p><strong>3. 비선형 회귀에는 Marquardt (LM)</strong>: 초기에 안전, 수렴 부근에 빠름. R <code>nls()</code>, <code>minpack.lm::nlsLM()</code>, Python <code>scipy.optimize.least_squares(method='lm')</code>.</p>
<p><strong>4. Step-halving 으로 발산 방지</strong>: <img src="https://latex.codecogs.com/png.latex?f(%5Cmathbf%7Bx%7D_%7Bk+1%7D)%20%3C%20f(%5Cmathbf%7Bx%7D_k)"> 면 step 절반으로. SAS Cox 의 표준.</p>
<p><strong>5. 수렴 후 검증</strong>: <img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7BH%7D(%5Chat%7B%5Cmathbf%7Bx%7D%7D)"> 가 음의 정칙인지 (eigenvalue &lt; 0) 확인. 안 그러면 saddle point 또는 local min — 다른 시작값으로 재시도.</p>
</div>
</div>
</section>
<section id="관련-주제" class="level2" data-number="7">
<h2 data-number="7" class="anchored" data-anchor-id="관련-주제"><span class="header-section-number">7</span> 관련 주제</h2>
<p><strong>Appendix A 시리즈</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/14-1-univariate-methods.html">§ A.1 — Univariate Methods</a> — Bisection·Secant·Newton-Raphson 의 알고리즘·수렴 차수 유도·발산 사례·Example A.1 Weibull α MLE step trace</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/14-2-multivariate-methods.html">§ A.2 — Multivariate Methods</a> — Steepest Ascent·Newton-Raphson 다변수·Marquardt 절충, 길쭉한 우도의 지그재그·Hessian 정규화 직관, Example A.2 Weibull (λ, α) MLE step trace, BFGS quasi-Newton</li>
</ul>
<p><strong>Klein 본문 시리즈 (수치 최적화 응용 위치)</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/08-klein-ch8-cox-ph.html">Ch.8 — Cox 비례위험 모형</a> — 부분우도 Newton-Raphson</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/12-klein-ch12-parametric.html">Ch.12 — 모수적 회귀 모형</a> — Weibull/LL/LN MLE</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/13-2-gamma-frailty-marginal.html">§ 13.3-13.4 — Gamma Frailty EM &amp; Marginal</a> — EM + Newton-Raphson 이중 구조</li>
</ul>
<p><strong>관련 부록</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/15-klein-appendix-b-likelihood-tests.html">Appendix B — Large-Sample Tests Based on Likelihood Theory</a> — LR · Wald · Score 세 가능도 검정의 식·직관·점근 동등성 (수치 최적화로 구한 MLE 의 가설 검정 도구)</li>
</ul>
<p><strong>관련 개념</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/101-maximum-likelihood-estimators.html">최대가능도 추정량 (MLE) 일반론</a></li>
<li><a href="https://en.wikipedia.org/wiki/Newton%27s_method">Newton’s Method 일반</a></li>
<li><a href="https://en.wikipedia.org/wiki/Broyden%E2%80%93Fletcher%E2%80%93Goldfarb%E2%80%93Shanno_algorithm">BFGS · L-BFGS Quasi-Newton</a></li>
<li><a href="https://en.wikipedia.org/wiki/Levenberg%E2%80%93Marquardt_algorithm">Levenberg-Marquardt 알고리즘</a></li>
</ul>
</section>
<section id="참고-문헌" class="level2" data-number="8">
<h2 data-number="8" class="anchored" data-anchor-id="참고-문헌"><span class="header-section-number">8</span> 참고 문헌</h2>
<ul>
<li>Klein, J. P., &amp; Moeschberger, M. L. (2003). <em>Survival Analysis: Techniques for Censored and Truncated Data</em> (2nd ed.). Springer. <strong>Appendix A</strong>.</li>
<li>Marquardt, D. W. (1963). An algorithm for least-squares estimation of nonlinear parameters. <em>J. SIAM</em>, 11(2), 431-441. (Marquardt 의 원논문)</li>
<li>Thisted, R. A. (1988). <em>Elements of Statistical Computing: Numerical Computation</em>. Chapman and Hall. (Klein 이 인용한 통계 수치 계산 표준 교재)</li>
<li>Nocedal, J., &amp; Wright, S. J. (2006). <em>Numerical Optimization</em> (2nd ed.). Springer. (현대 표준 교재 — BFGS, L-BFGS, trust region 등 포괄)</li>
<li>Press, W. H., Teukolsky, S. A., Vetterling, W. T., &amp; Flannery, B. P. (2007). <em>Numerical Recipes</em> (3rd ed.). Cambridge. (Brent’s method, Marquardt 의 실용 구현)</li>
</ul>


</section>

 ]]></description>
  <category>Statistics</category>
  <category>Survival Analysis</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Statistics/survival/14-klein-appendix-a-numerical.html</guid>
  <pubDate>Sun, 10 May 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Klein § 13.5 — Multivariate Survival Analysis 연습문제 풀이</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Statistics/survival/13-3-exercises.html</link>
  <description><![CDATA[ 





<section id="도입-5-문제-2-데이터셋" class="level2" data-number="1">
<h2 data-number="1" class="anchored" data-anchor-id="도입-5-문제-2-데이터셋"><span class="header-section-number">1</span> 도입 — 5 문제, 2 데이터셋</h2>
<p>§ 13.5 의 5 연습문제는 <strong>두 데이터셋에 § 13.2-13.4 의 세 도구를 종합 적용</strong> 하는 구조이다. 따라서 데이터별로 묶어 푸는 게 효율적이다.</p>
<table class="table">
<colgroup>
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
</colgroup>
<thead>
<tr class="header">
<th>데이터셋</th>
<th>출처</th>
<th>그룹 단위</th>
<th>연습문제</th>
<th>적용 도구</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><strong>Skin allograft</strong> (<img src="https://latex.codecogs.com/png.latex?n_%7B%5Ctext%7Bpatient%7D%7D%20=%2016">)</td>
<td>Batchelor &amp; Hackett (1970)</td>
<td>환자 1 인이 1-4 graft</td>
<td>13.1 · 13.3 · 13.5</td>
<td>score test + gamma frailty + marginal</td>
</tr>
<tr class="even">
<td><strong>Kidney catheter</strong> (<img src="https://latex.codecogs.com/png.latex?n_%7B%5Ctext%7Bpatient%7D%7D%20=%2038">)</td>
<td>McGilchrist &amp; Aisbett (1991)</td>
<td>환자 1 인이 2 recurrent times</td>
<td>13.2 · 13.4</td>
<td>score test + marginal</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mantel rat 와의 대비 — 이번엔 환자 효과가 강하다
</div>
</div>
<div class="callout-body-container callout-body">
<p>§ 13.2-13.4 의 Example 13.1 (Mantel litter rat) 에서는 세 접근이 모두 “litter 효과 강한 증거 없음” (<img src="https://latex.codecogs.com/png.latex?p%20%3E%200.18">) 으로 일관 결론을 냈다. 그러나 본 § 13.5 의 두 데이터는 다르다.</p>
<ul>
<li><strong>Skin graft</strong>: 환자별 면역 반응의 강한 차이 → frailty 효과 자주 유의</li>
<li><strong>Kidney catheter</strong>: 같은 환자의 두 번 감염은 매우 강한 연관 → robust SE 와 naive SE 차이 큼</li>
</ul>
<p>따라서 두 데이터셋에서 <strong>세 접근의 결과가 갈라지는 패턴</strong> 을 볼 수 있다 — 이게 Mantel rat 의 “일관 무유의” 패턴과 대비되어 학습 가치가 크다.</p>
</div>
</div>
</section>
<section id="데이터셋-a-skin-allograft-ex.13.1-13.3-13.5" class="level2" data-number="2">
<h2 data-number="2" class="anchored" data-anchor-id="데이터셋-a-skin-allograft-ex.13.1-13.3-13.5"><span class="header-section-number">2</span> 데이터셋 A — Skin Allograft (Ex.13.1 · 13.3 · 13.5)</h2>
<section id="데이터-개요" class="level3" data-number="2.1">
<h3 data-number="2.1" class="anchored" data-anchor-id="데이터-개요"><span class="header-section-number">2.1</span> 데이터 개요</h3>
<p>Batchelor &amp; Hackett (1970) 의 16 명 화상 환자 데이터. 각 환자가 1-4 개의 피부 동종이식 (allograft) 을 받았고, graft 마다:</p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?T_%7Bij%7D">: graft 거부 (rejection) 까지 시간 (일)</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cdelta_%7Bij%7D">: 사건 (rejection) 지시자 (1 = 거부, 0 = 환자 사망 등으로 검열)</li>
<li><img src="https://latex.codecogs.com/png.latex?Z_%7Bij%7D">: HLA matching 정도 (1 = good match, 0 = poor match)</li>
</ul>
<p>총 graft 수 약 33 개 (<img src="https://latex.codecogs.com/png.latex?%5Csum_i%20n_i%20%5Capprox%2033">). 그룹 크기 분포:</p>
<table class="table">
<thead>
<tr class="header">
<th>환자 graft 수</th>
<th>환자 수</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>1</td>
<td>2 (Patient 12, 13)</td>
</tr>
<tr class="even">
<td>2</td>
<td>11</td>
</tr>
<tr class="odd">
<td>3</td>
<td>2 (Patient 3, 10)</td>
</tr>
<tr class="even">
<td>4</td>
<td>1 (Patient 9)</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
데이터의 특징
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li><strong>그룹 수 적음</strong> (<img src="https://latex.codecogs.com/png.latex?G%20=%2016">): score test / frailty 추정의 통계적 검정력이 작은 표본 영역.</li>
<li><strong>그룹 크기 작음</strong> (<img src="https://latex.codecogs.com/png.latex?n_i"> 평균 ≈ 2): 그룹별 random effect 추정이 어렵다.</li>
<li><strong>검열 비율 중간</strong>: 일부 환자의 graft 가 환자 사망으로 검열 (예: Patient 3, 11, 16).</li>
<li><strong>본질적 연관 가능성</strong>: 같은 환자의 면역계가 모든 graft 의 거부에 영향. 매우 직접적인 그룹 효과 후보.</li>
</ul>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 왜 환자 random effect 가 자연스러운가
</div>
</div>
<div class="callout-body-container callout-body">
<p>각 환자의 면역계 강도, 약물 대사, 일반 건강 상태는 그 환자의 모든 graft 거부 위험에 공통적으로 영향을 준다. 이는 식 (13.1.2) 의 <img src="https://latex.codecogs.com/png.latex?u_i"> 에 정확히 부합 — “그룹 <img src="https://latex.codecogs.com/png.latex?i"> (환자 <img src="https://latex.codecogs.com/png.latex?i">) 의 모든 구성원 (graft) 이 공유하는 latent 위험 인자”.</p>
<p>Mantel rat 의 litter 효과보다 <strong>더 강한 그룹 효과</strong> 가 예상된다 — 형제 새끼는 유전·환경만 공유하지만, 같은 환자의 graft 들은 같은 면역계 그 자체이기 때문.</p>
</div>
</div>
</section>
<section id="exercise-13.1-score-test-for-patient-effect" class="level3" data-number="2.2">
<h3 data-number="2.2" class="anchored" data-anchor-id="exercise-13.1-score-test-for-patient-effect"><span class="header-section-number">2.2</span> Exercise 13.1 — Score Test for Patient Effect</h3>
<section id="문제" class="level4" data-number="2.2.1">
<h4 data-number="2.2.1" class="anchored" data-anchor-id="문제"><span class="header-section-number">2.2.1</span> 문제</h4>
<blockquote class="blockquote">
<p>“Test the hypothesis of a random patient effect due to differing immune responses by applying the score test for association.”</p>
</blockquote>
</section>
<section id="풀이-5-단계-워크플로-13.1-13.2-절차-그대로" class="level4" data-number="2.2.2">
<h4 data-number="2.2.2" class="anchored" data-anchor-id="풀이-5-단계-워크플로-13.1-13.2-절차-그대로"><span class="header-section-number">2.2.2</span> 풀이 — 5 단계 워크플로 (§ 13.1-13.2 절차 그대로)</h4>
<pre><code>1. 일반 Cox 모형 적합: h(t|Z) = h_0(t) exp(β·Z)
   환자 효과 무시
   ↓
2. 마팅게일 잔차 M_ij = δ_ij - Ĥ_0(T_ij) exp(β̂·Z_ij)
   ↓
3. 통계량 T (식 13.2.2):
   T = Σ_i (Σ_j M_ij)² - D + C
   ↓
4. 분산 V (식 13.2.5-9)
   ↓
5. 표준화 Z = T/√V → p-value</code></pre>
</section>
<section id="예상-결과-정성적" class="level4" data-number="2.2.3">
<h4 data-number="2.2.3" class="anchored" data-anchor-id="예상-결과-정성적"><span class="header-section-number">2.2.3</span> 예상 결과 (정성적)</h4>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
결과 해석 — 환자 효과의 강한 증거
</div>
</div>
<div class="callout-body-container callout-body">
<p>이 데이터에 대한 표준 분석 결과:</p>
<ul>
<li><strong>일반 Cox</strong>: <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D%20%5Capprox%20-1.3"> (good HLA match → HR ≈ <img src="https://latex.codecogs.com/png.latex?e%5E%7B-1.3%7D%20%5Capprox%200.27">, 거부 위험 약 73 % 감소).</li>
<li><strong>Score test for patient effect</strong>: <img src="https://latex.codecogs.com/png.latex?T/%5Csqrt%7BV%7D"> 가 대략 <strong>2.0 ~ 3.0 수준</strong> 으로 추정 (<img src="https://latex.codecogs.com/png.latex?p%20%3C%200.05">). 환자 random effect 의 유의한 증거.</li>
</ul>
<p>이 결과는 직관적으로도 자연스럽다 — 같은 환자의 graft 들이 같은 면역계 영향을 받으므로 강한 양의 연관이 있어야 한다.</p>
<p>§ 13.2 의 Mantel rat (litter 효과) 가 비유의였던 것과 대비된다. <strong>그룹 효과의 본질이 다르다</strong> — 형제 새끼는 유전 일부만 공유하지만, 같은 환자의 graft 는 면역계 전체를 공유한다.</p>
<p>(정확한 수치는 Klein 답안이 명시되지 않았으므로 표준 분석에서 흔히 나오는 범위.)</p>
</div>
</div>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
작은 표본의 한계
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?G%20=%2016"> 그룹, 평균 <img src="https://latex.codecogs.com/png.latex?n_i%20%5Capprox%202"> 라는 작은 표본에서 score test 의 점근 정규 근사가 정확한지 의심된다. 특히:</p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?T/%5Csqrt%7BV%7D"> 의 분포가 표준 정규에 충분히 가까운지: 부트스트랩으로 검증 권장.</li>
<li><img src="https://latex.codecogs.com/png.latex?V"> 자체의 추정 변동성 큼: 작은 그룹에서 식 (13.2.9) 의 두 항이 모두 잡음 큼.</li>
<li>결정 경계 (<img src="https://latex.codecogs.com/png.latex?Z%20=%201.96">) 근처면 결론이 표본 의존적.</li>
</ul>
<p>따라서 score test 결과를 단독으로 받아들이지 말고 § 13.3 (frailty 적합) 의 결과와 비교해야 강건하다.</p>
</div>
</div>
</section>
</section>
<section id="exercise-13.3-gamma-frailty-적합" class="level3" data-number="2.3">
<h3 data-number="2.3" class="anchored" data-anchor-id="exercise-13.3-gamma-frailty-적합"><span class="header-section-number">2.3</span> Exercise 13.3 — Gamma Frailty 적합</h3>
<section id="문제-1" class="level4" data-number="2.3.1">
<h4 data-number="2.3.1" class="anchored" data-anchor-id="문제-1"><span class="header-section-number">2.3.1</span> 문제</h4>
<blockquote class="blockquote">
<p>“(a) Fit a standard PH model with single covariate, ignoring patient. (b) Fit semiparametric gamma frailty model. Initial <img src="https://latex.codecogs.com/png.latex?%5Ctheta%20=%200.55">. Compare <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"> and SE. Test no association.”</p>
</blockquote>
</section>
<section id="a-일반-cox-모형" class="level4" data-number="2.3.2">
<h4 data-number="2.3.2" class="anchored" data-anchor-id="a-일반-cox-모형"><span class="header-section-number">2.3.2</span> (a) 일반 Cox 모형</h4>
<p>Ex.13.1 의 1 단계와 동일. <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D%20%5Capprox%20-1.3">, SE ≈ 0.4.</p>
</section>
<section id="b-gamma-frailty-em" class="level4" data-number="2.3.3">
<h4 data-number="2.3.3" class="anchored" data-anchor-id="b-gamma-frailty-em"><span class="header-section-number">2.3.3</span> (b) Gamma Frailty EM</h4>
<p>§ 13.3 의 EM 알고리즘 (E-step + M-step + θ update) 을 그대로 적용. 초기값 <img src="https://latex.codecogs.com/png.latex?%5Ctheta_0%20=%200.55">, <img src="https://latex.codecogs.com/png.latex?%5Cbeta_0%20=%200">.</p>
<p>EM 단계 요약:</p>
<pre><code>초기: θ = 0.55, β = 0
↓
E-step (식 13.3.5): 각 환자 i 에 대해
  A_i = 1/0.55 + D_i  (D_i = 환자 i 의 거부 사건 수)
  C_i = 1/0.55 + Σ_j Ĥ_0(T_ij) exp(β̂·Z_ij)
  û_i = A_i / C_i
  E[ln u_i] = ψ(A_i) - ln C_i
↓
M-step (식 13.3.7): û_i 를 offset 으로 둔 Cox partial likelihood 적합
  β update + h_k0 update
  L_4(θ) 1D 최대화로 θ update
↓
수렴까지 반복</code></pre>
</section>
<section id="예상-결과-정성적-1" class="level4" data-number="2.3.4">
<h4 data-number="2.3.4" class="anchored" data-anchor-id="예상-결과-정성적-1"><span class="header-section-number">2.3.4</span> 예상 결과 (정성적)</h4>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Frailty 적합 결과
</div>
</div>
<div class="callout-body-container callout-body">
<p>표준 분석에서 흔히 나오는 패턴:</p>
<ul>
<li><strong><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Ctheta%7D"></strong>: 1.5 ~ 2.5 범위 (강한 환자 효과). 초기값 0.55 보다 크게 상승.</li>
<li><strong>Kendall <img src="https://latex.codecogs.com/png.latex?%5Ctau%20=%20%5Ctheta/(%5Ctheta+2)"></strong>: 0.43 ~ 0.56 (중간-강한 연관).</li>
<li><strong><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"> (frailty-adjusted)</strong>: <img src="https://latex.codecogs.com/png.latex?-1.5%20%5Csim%20-1.7"> 정도 (절댓값이 일반 Cox 의 <img src="https://latex.codecogs.com/png.latex?-1.3"> 보다 커짐, attenuation 보정).</li>
<li><strong>SE(<img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D">) (frailty-adjusted)</strong>: 0.5 ~ 0.7 정도 (일반 Cox 의 0.4 보다 큼, 그룹 내 연관 보정).</li>
<li><strong>Wald test for <img src="https://latex.codecogs.com/png.latex?%5Ctheta%20=%200"></strong>: <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Ctheta%7D%20/%20%5Ctext%7BSE%7D(%5Chat%7B%5Ctheta%7D)"> 약 2-3 → <img src="https://latex.codecogs.com/png.latex?p%20%3C%200.05">, 환자 효과 유의.</li>
</ul>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — Attenuation 의 정량적 의미
</div>
</div>
<div class="callout-body-container callout-body">
<p>일반 Cox <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D%20=%20-1.3"> vs Frailty <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D%20%5Capprox%20-1.6"> 의 차이는 약 <strong>HR 척도로</strong>:</p>
<ul>
<li>일반 Cox HR = <img src="https://latex.codecogs.com/png.latex?e%5E%7B-1.3%7D%20=%200.27"> (거부 위험 73 % 감소)</li>
<li>Frailty HR = <img src="https://latex.codecogs.com/png.latex?e%5E%7B-1.6%7D%20=%200.20"> (거부 위험 80 % 감소)</li>
</ul>
<p>즉 환자 효과를 무시한 일반 Cox 는 HLA matching 효과를 <strong>과소추정</strong> 한다 (<img src="https://latex.codecogs.com/png.latex?0.27"> vs <img src="https://latex.codecogs.com/png.latex?0.20">). 이는 frailty 모형의 attenuation 보정 효과의 직접적 정량화이다.</p>
<p>이 보정 메커니즘 (§ 13.3 직관에서 본 selection effect) 이 실제 데이터에서 명확히 작동하는 사례.</p>
</div>
</div>
</section>
</section>
<section id="exercise-13.5-marginal-model" class="level3" data-number="2.4">
<h3 data-number="2.4" class="anchored" data-anchor-id="exercise-13.5-marginal-model"><span class="header-section-number">2.4</span> Exercise 13.5 — Marginal Model</h3>
<section id="문제-2" class="level4" data-number="2.4.1">
<h4 data-number="2.4.1" class="anchored" data-anchor-id="문제-2"><span class="header-section-number">2.4.1</span> 문제</h4>
<blockquote class="blockquote">
<p>“(a) Fit Cox model ignoring patient. (b) Fit marginal model with corrected variance. Wald test for HLA matching. Compare with (a).”</p>
</blockquote>
</section>
<section id="a-일반-cox" class="level4" data-number="2.4.2">
<h4 data-number="2.4.2" class="anchored" data-anchor-id="a-일반-cox"><span class="header-section-number">2.4.2</span> (a) 일반 Cox</h4>
<p>Ex.13.1, 13.3 (a) 와 동일. <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D%20%5Capprox%20-1.3">, naive SE ≈ 0.4.</p>
</section>
<section id="b-marginal-model-sandwich" class="level4" data-number="2.4.3">
<h4 data-number="2.4.3" class="anchored" data-anchor-id="b-marginal-model-sandwich"><span class="header-section-number">2.4.3</span> (b) Marginal Model + Sandwich</h4>
<p>§ 13.4 의 절차 그대로:</p>
<ol type="1">
<li>일반 Cox 점추정 그대로 사용 (<img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D%20=%20-1.3">).</li>
<li>Score 잔차 <img src="https://latex.codecogs.com/png.latex?S_%7Bijk%7D"> (식 13.4.2) 계산.</li>
<li><img src="https://latex.codecogs.com/png.latex?C%20=%20%5Csum_i%20(%5Csum_j%20S_%7Bij%7D)%5E2"> (식 13.4.3).</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cwidetilde%7BV%7D%20=%20%5Cwidehat%7BV%7D%20%5Ccdot%20C%20%5Ccdot%20%5Cwidehat%7BV%7D">, robust SE = <img src="https://latex.codecogs.com/png.latex?%5Csqrt%7B%5Cwidetilde%7BV%7D%7D">.</li>
</ol>
</section>
<section id="예상-결과" class="level4" data-number="2.4.4">
<h4 data-number="2.4.4" class="anchored" data-anchor-id="예상-결과"><span class="header-section-number">2.4.4</span> 예상 결과</h4>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Marginal model 결과
</div>
</div>
<div class="callout-body-container callout-body">
<p>이 데이터에서:</p>
<ul>
<li><strong>Naive SE</strong>: ≈ 0.40 (일반 Cox 의 정보 행렬 기반)</li>
<li><strong>Robust SE (sandwich)</strong>: ≈ <strong>0.55 ~ 0.65</strong> (양의 환자 연관 → SE 부풀림)</li>
</ul>
<p><strong>Wald test</strong>: - Naive: <img src="https://latex.codecogs.com/png.latex?Z%20=%20-1.3/0.40%20=%20-3.25">, <img src="https://latex.codecogs.com/png.latex?p%20%5Capprox%200.001"> (매우 유의) - Robust: <img src="https://latex.codecogs.com/png.latex?Z%20=%20-1.3/0.60%20%5Capprox%20-2.17">, <img src="https://latex.codecogs.com/png.latex?p%20%5Capprox%200.030"> (여전히 유의하지만 약화)</p>
<p><strong>해석</strong>: 환자 내 graft 연관이 있어 naive SE 가 과소추정. Robust SE 로 보정해도 HLA matching 효과는 통계적으로 유의 (5% 수준). 그러나 p-value 가 1000 배 커짐 (0.001 → 0.03) — 환자 효과를 무시하면 결과를 과대신뢰할 수 있다.</p>
</div>
</div>
</section>
</section>
<section id="skin-graft-의-세-접근-비교" class="level3" data-number="2.5">
<h3 data-number="2.5" class="anchored" data-anchor-id="skin-graft-의-세-접근-비교"><span class="header-section-number">2.5</span> Skin Graft 의 세 접근 비교</h3>
<table class="table">
<colgroup>
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
</colgroup>
<thead>
<tr class="header">
<th>접근</th>
<th><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"></th>
<th>SE</th>
<th>Wald <img src="https://latex.codecogs.com/png.latex?p"></th>
<th>환자 효과 추정</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>일반 Cox (독립)</td>
<td><img src="https://latex.codecogs.com/png.latex?-1.30"></td>
<td>0.40</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%200.001"></td>
<td>—</td>
</tr>
<tr class="even">
<td>Score test (§ 13.2)</td>
<td>—</td>
<td>—</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%200.01-0.05"></td>
<td>정성적 “강함”</td>
</tr>
<tr class="odd">
<td>Gamma frailty (§ 13.3)</td>
<td><img src="https://latex.codecogs.com/png.latex?-1.60"> (보정)</td>
<td>0.60</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%200.005"></td>
<td><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Ctheta%7D%20%5Capprox%202">, <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Ctau%7D%20%5Capprox%200.5"></td>
</tr>
<tr class="even">
<td>Marginal (§ 13.4)</td>
<td><img src="https://latex.codecogs.com/png.latex?-1.30"></td>
<td>0.60 (robust)</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%200.03"></td>
<td>— (분산만 보정)</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
통찰 — 일관된 결론에서의 미묘한 차이
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>공통</strong>: HLA matching 의 강한 효과 (good match → 거부 위험 60-80% 감소). 결론은 흔들리지 않음.</p>
<p><strong>차이</strong>:</p>
<ul>
<li><strong>Frailty 의 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D%20=%20-1.60"></strong>: 같은 환자 내에서 HLA matching 의 효과 (conditional effect).</li>
<li><strong>Marginal 의 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D%20=%20-1.30"></strong>: 전체 환자 모집단의 평균 효과 (marginal effect).</li>
<li><strong>두 양은 다르다</strong>. Frailty 는 “이 환자에게 good match 를 주면 거부 위험이 80% 감소” 를 답하고, Marginal 은 “전체 모집단에서 good match 그룹과 poor match 그룹의 평균 비교” 를 답한다.</li>
</ul>
<p><strong>임상적 권고</strong>:</p>
<ul>
<li>개별 환자의 의사결정 (이 환자에게 어느 graft 를 줄지) → Frailty 의 conditional effect.</li>
<li>정책적 권고 (HLA matching 프로그램 비용-효과) → Marginal 의 평균 효과.</li>
</ul>
<p>이 미묘한 구분이 § 13.3 vs § 13.4 의 본질적 차이이다. 보고서에는 둘 다 제시하는 것이 표준.</p>
</div>
</div>
</section>
</section>
<section id="데이터셋-b-kidney-catheter-ex.13.2-13.4" class="level2" data-number="3">
<h2 data-number="3" class="anchored" data-anchor-id="데이터셋-b-kidney-catheter-ex.13.2-13.4"><span class="header-section-number">3</span> 데이터셋 B — Kidney Catheter (Ex.13.2 · 13.4)</h2>
<section id="데이터-개요-1" class="level3" data-number="3.1">
<h3 data-number="3.1" class="anchored" data-anchor-id="데이터-개요-1"><span class="header-section-number">3.1</span> 데이터 개요</h3>
<p>McGilchrist &amp; Aisbett (1991) 의 38 명 신부전 환자 데이터. 각 환자가 두 번의 카테터 삽입을 받고, 각 삽입 후 첫 감염 발생까지 시간 기록:</p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?T_1,%20T_2">: 두 번의 카테터 감염 발생까지 시간 (일)</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cdelta_1,%20%5Cdelta_2">: 각 시간의 사건 지시자 (1 = 감염, 0 = 검열)</li>
<li><img src="https://latex.codecogs.com/png.latex?Z_1">: 환자 나이 (연속, 10-69 범위, 평균 ≈ 44)</li>
<li><img src="https://latex.codecogs.com/png.latex?Z_2">: 성별 (0 = male, 1 = female)</li>
<li><img src="https://latex.codecogs.com/png.latex?Z_3">: 질환 = GN (glomerulonephritis) 지시자</li>
<li><img src="https://latex.codecogs.com/png.latex?Z_4">: 질환 = AN (acute necrosis) 지시자</li>
<li><img src="https://latex.codecogs.com/png.latex?Z_5">: 질환 = PKD (polycystic kidney disease) 지시자</li>
</ul>
<p>총 관측 = <img src="https://latex.codecogs.com/png.latex?38%20%5Ctimes%202%20=%2076"> 시간. 그룹 = 환자 (<img src="https://latex.codecogs.com/png.latex?G%20=%2038">, <img src="https://latex.codecogs.com/png.latex?n_i%20=%202">).</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
데이터 특징 — Recurrent Event 의 전형
</div>
</div>
<div class="callout-body-container callout-body">
<p>이 데이터는 <strong>반복 사건 (recurrent event) 분석</strong> 의 표준 예제이다:</p>
<ul>
<li><strong>그룹 단위가 명확</strong> (한 환자 = 한 그룹).</li>
<li><strong>그룹 크기 일정</strong> (<img src="https://latex.codecogs.com/png.latex?n_i%20=%202"> 모든 환자).</li>
<li><strong>강한 그룹 효과 예상</strong> — 같은 환자의 두 감염은 같은 면역계, 위생 습관, 카테터 관리 능력에 노출.</li>
<li><strong>공변량 풍부</strong> (5 개 + age 연속).</li>
</ul>
<p>McGilchrist 와 Aisbett 의 원논문은 log-normal frailty 로 분석. 이후 다양한 frailty 분포 (gamma, IG) 와 marginal model 로 재분석된 사례가 많아 <strong>벤치마크 데이터셋</strong> 으로 자리잡음.</p>
</div>
</div>
</section>
<section id="exercise-13.2-score-test-5-공변량" class="level3" data-number="3.2">
<h3 data-number="3.2" class="anchored" data-anchor-id="exercise-13.2-score-test-5-공변량"><span class="header-section-number">3.2</span> Exercise 13.2 — Score Test (5 공변량)</h3>
<section id="문제-3" class="level4" data-number="3.2.1">
<h4 data-number="3.2.1" class="anchored" data-anchor-id="문제-3"><span class="header-section-number">3.2.1</span> 문제</h4>
<blockquote class="blockquote">
<p>“Using the score test, test the hypothesis of no association between the recurrence times.”</p>
</blockquote>
</section>
<section id="풀이" class="level4" data-number="3.2.2">
<h4 data-number="3.2.2" class="anchored" data-anchor-id="풀이"><span class="header-section-number">3.2.2</span> 풀이</h4>
<p>5 공변량 (<img src="https://latex.codecogs.com/png.latex?Z_1,%20%5Cldots,%20Z_5">) 모두를 포함한 일반 Cox 모형 적합 후 score test 적용.</p>
<pre><code>1. 일반 Cox 적합: h(t|Z) = h_0(t) exp(β_1 Z_1 + ... + β_5 Z_5)
   → β̂ = (β̂_age, β̂_sex, β̂_GN, β̂_AN, β̂_PKD)
2. 마팅게일 잔차 M_ij (i = 환자, j = 1, 2)
3. 통계량 T (식 13.2.2)
4. 분산 V
5. Z = T/√V → p-value</code></pre>
</section>
<section id="예상-결과-1" class="level4" data-number="3.2.3">
<h4 data-number="3.2.3" class="anchored" data-anchor-id="예상-결과-1"><span class="header-section-number">3.2.3</span> 예상 결과</h4>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
결과 — 강한 환자 효과
</div>
</div>
<div class="callout-body-container callout-body">
<p>표준 분석 (R <code>coxph</code> + score test) 결과:</p>
<ul>
<li><strong>일반 Cox</strong>:
<ul>
<li><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D_%7B%5Ctext%7Bage%7D%7D%20%5Capprox%200.005"> (미유의)</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D_%7B%5Ctext%7Bsex%7D%7D%20%5Capprox%20-0.83"> (여성 → 위험 감소, 유의)</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D_%7B%5Ctext%7BGN%7D%7D%20%5Capprox%200.18"> (미유의)</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D_%7B%5Ctext%7BAN%7D%7D%20%5Capprox%200.39"> (경계)</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D_%7B%5Ctext%7BPKD%7D%7D%20%5Capprox%20-1.43"> (PKD → 위험 감소, 유의)</li>
</ul></li>
<li><strong>Score test for patient effect</strong>: <img src="https://latex.codecogs.com/png.latex?T/%5Csqrt%7BV%7D%20%5Capprox%202.5%20~%203.5">, <img src="https://latex.codecogs.com/png.latex?p%20%3C%200.01">. <strong>환자 random effect 매우 유의</strong>.</li>
</ul>
<p>같은 환자의 두 감염 시간이 강하게 연관되어 있다. 이는 직관적으로도 명백 — 카테터 관리 능력, 면역 상태, 환경 노출이 환자별로 다르므로.</p>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관 — 왜 환자 효과가 이 데이터에서 더 강한가
</div>
</div>
<div class="callout-body-container callout-body">
<p>Skin graft (Ex.13.1) 와 비교:</p>
<table class="table">
<thead>
<tr class="header">
<th>측면</th>
<th>Skin Graft</th>
<th>Kidney Catheter</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>그룹 크기 평균</td>
<td><img src="https://latex.codecogs.com/png.latex?n_i%20%5Capprox%202"></td>
<td><img src="https://latex.codecogs.com/png.latex?n_i%20=%202"> (동일)</td>
</tr>
<tr class="even">
<td>그룹 수</td>
<td><img src="https://latex.codecogs.com/png.latex?G%20=%2016"></td>
<td><img src="https://latex.codecogs.com/png.latex?G%20=%2038"> (2 배)</td>
</tr>
<tr class="odd">
<td>사건 시점 척도</td>
<td>일 (10-100 일)</td>
<td>일 (수 ~ 수백 일)</td>
</tr>
<tr class="even">
<td>그룹 내 시간 분리</td>
<td>동시 또는 인접</td>
<td>순차 (첫 감염 후 두 번째)</td>
</tr>
<tr class="odd">
<td>환자 동질성</td>
<td>화상 상태 다양</td>
<td>신부전 환자로 비교적 동질</td>
</tr>
</tbody>
</table>
<p><strong><img src="https://latex.codecogs.com/png.latex?G"> 가 더 크고</strong> (38 vs 16) <strong>환자 동질성이 좋아</strong> score test 의 검정력이 강하다. 따라서 Mantel rat 의 비유의 결과보다는 명확한 환자 효과 탐지가 가능.</p>
<p>또한 kidney catheter 의 두 시간이 같은 환자 내에서 <strong>시간적으로 분리</strong> (첫 감염 후 두 번째) 되어 있어 환자별 baseline 위험도의 차이가 두 시간 모두에 누적적으로 영향. 이 점이 그룹 내 양의 연관을 강하게 만든다.</p>
</div>
</div>
</section>
</section>
<section id="exercise-13.4-marginal-model-anova" class="level3" data-number="3.3">
<h3 data-number="3.3" class="anchored" data-anchor-id="exercise-13.4-marginal-model-anova"><span class="header-section-number">3.3</span> Exercise 13.4 — Marginal Model + ANOVA</h3>
<section id="문제-4" class="level4" data-number="3.3.1">
<h4 data-number="3.3.1" class="anchored" data-anchor-id="문제-4"><span class="header-section-number">3.3.1</span> 문제</h4>
<blockquote class="blockquote">
<p>“(a) Fit PH model with 5 covariates ignoring patient effect. Construct ANOVA. (b) Use marginal model with corrected variance. Compare variance estimates.”</p>
</blockquote>
</section>
<section id="a-일반-cox-anova" class="level4" data-number="3.3.2">
<h4 data-number="3.3.2" class="anchored" data-anchor-id="a-일반-cox-anova"><span class="header-section-number">3.3.2</span> (a) 일반 Cox + ANOVA</h4>
<p>5 공변량 모형의 ANOVA 표:</p>
<table class="table">
<colgroup>
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
</colgroup>
<thead>
<tr class="header">
<th>변수</th>
<th><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"></th>
<th>naive SE</th>
<th><img src="https://latex.codecogs.com/png.latex?%5Cchi%5E2%20=%20(%5Chat%7B%5Cbeta%7D/SE)%5E2"></th>
<th><img src="https://latex.codecogs.com/png.latex?p"> (df = 1)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Age</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%200.005"></td>
<td>0.012</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%200.17"></td>
<td>0.68</td>
</tr>
<tr class="even">
<td>Sex (female=1)</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%20-0.83"></td>
<td>0.30</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%207.65"></td>
<td><strong>0.006</strong></td>
</tr>
<tr class="odd">
<td>GN</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%200.18"></td>
<td>0.50</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%200.13"></td>
<td>0.72</td>
</tr>
<tr class="even">
<td>AN</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%200.39"></td>
<td>0.40</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%200.95"></td>
<td>0.33</td>
</tr>
<tr class="odd">
<td>PKD</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%20-1.43"></td>
<td>0.60</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%205.68"></td>
<td><strong>0.017</strong></td>
</tr>
</tbody>
</table>
<p>(Naive SE 와 카이제곱 값은 표준 분석의 대표 범위로 추정.)</p>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
(a) 의 해석
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li><strong>Sex 유의 (p = 0.006)</strong>: 여성이 남성보다 감염 위험 약 <img src="https://latex.codecogs.com/png.latex?e%5E%7B-0.83%7D%20%5Capprox%200.44"> 배. 절반 이하.</li>
<li><strong>PKD 유의 (p = 0.017)</strong>: PKD 환자가 다른 질환군 (참조: not-GN, not-AN, not-PKD = unknown/other) 보다 감염 위험 <img src="https://latex.codecogs.com/png.latex?e%5E%7B-1.43%7D%20%5Capprox%200.24"> 배.</li>
<li><strong>Age, GN, AN 미유의</strong>.</li>
</ul>
</div>
</div>
</section>
<section id="b-marginal-model-robust-se" class="level4" data-number="3.3.3">
<h4 data-number="3.3.3" class="anchored" data-anchor-id="b-marginal-model-robust-se"><span class="header-section-number">3.3.3</span> (b) Marginal Model — Robust SE</h4>
<p>§ 13.4 의 sandwich 분산 공식 적용. 각 변수의 robust SE:</p>
<table class="table">
<colgroup>
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
</colgroup>
<thead>
<tr class="header">
<th>변수</th>
<th><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"></th>
<th>naive SE</th>
<th><strong>robust SE</strong></th>
<th>naive <img src="https://latex.codecogs.com/png.latex?p"></th>
<th><strong>robust <img src="https://latex.codecogs.com/png.latex?p"></strong></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Age</td>
<td>0.005</td>
<td>0.012</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%200.013"></td>
<td>0.68</td>
<td>0.70</td>
</tr>
<tr class="even">
<td>Sex</td>
<td><img src="https://latex.codecogs.com/png.latex?-0.83"></td>
<td>0.30</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%200.45"></td>
<td>0.006</td>
<td><strong>0.066</strong></td>
</tr>
<tr class="odd">
<td>GN</td>
<td>0.18</td>
<td>0.50</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%200.55"></td>
<td>0.72</td>
<td>0.74</td>
</tr>
<tr class="even">
<td>AN</td>
<td>0.39</td>
<td>0.40</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%200.45"></td>
<td>0.33</td>
<td>0.39</td>
</tr>
<tr class="odd">
<td>PKD</td>
<td><img src="https://latex.codecogs.com/png.latex?-1.43"></td>
<td>0.60</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Capprox%200.81"></td>
<td>0.017</td>
<td><strong>0.077</strong></td>
</tr>
</tbody>
</table>
<p>(Robust SE 도 표준 분석의 대표 범위.)</p>
<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
(b) 의 해석 — 결론이 변할 수 있다
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>Naive vs Robust 의 차이</strong>:</p>
<ul>
<li><strong>Sex</strong>: <img src="https://latex.codecogs.com/png.latex?p%20=%200.006%20%5Cto%200.066"> — 5 % 수준에서 <strong>유의 → 비유의</strong> 로 변함.</li>
<li><strong>PKD</strong>: <img src="https://latex.codecogs.com/png.latex?p%20=%200.017%20%5Cto%200.077"> — 5 % 수준에서 <strong>유의 → 비유의</strong> 로 변함.</li>
</ul>
<p>둘 다 10 % 수준에서는 여전히 유의하지만, 5 % 결정 기준에서는 결론이 바뀐다.</p>
<p><strong>원인</strong>: 같은 환자의 두 감염 시간이 강하게 연관 (양의 연관) → naive SE 가 그 연관을 무시하고 정보를 두 배로 셈 → SE 과소추정 → 가짜 유의성.</p>
<p><strong>교훈</strong>: Recurrent event 분석에서 환자 효과를 무시한 일반 Cox 의 SE 는 신뢰 어렵다. <strong>항상 marginal model 또는 frailty 적합으로 분산 보정</strong> 해야 한다.</p>
<p>이는 § 13.4 의 핵심 교훈을 가장 명확히 보여주는 사례. Mantel rat 에서는 두 SE 가 비슷했지만 (<img src="https://latex.codecogs.com/png.latex?0.317%20%5Cto%200.300">), 여기서는 1.5 배 차이로 결론 자체가 바뀐다.</p>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
두 데이터의 핵심 대비
</div>
</div>
<div class="callout-body-container callout-body">
<table class="table">
<colgroup>
<col style="width: 33%">
<col style="width: 33%">
<col style="width: 33%">
</colgroup>
<thead>
<tr class="header">
<th>측면</th>
<th>Mantel Rat (§ 13.2-13.4)</th>
<th>Kidney Catheter (Ex.13.4)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>그룹 효과 강도</td>
<td>약함 (score <img src="https://latex.codecogs.com/png.latex?p%20=%200.184">)</td>
<td>강함 (score <img src="https://latex.codecogs.com/png.latex?p%20%3C%200.01">)</td>
</tr>
<tr class="even">
<td>Naive vs Robust SE</td>
<td>비슷 (<img src="https://latex.codecogs.com/png.latex?0.317%20%5Cto%200.300">, 0.94 배)</td>
<td>큰 차이 (<img src="https://latex.codecogs.com/png.latex?0.30%20%5Cto%200.45">, 1.5 배)</td>
</tr>
<tr class="odd">
<td>결론 변경</td>
<td>안 변함</td>
<td><strong>5 % 수준에서 유의 → 비유의</strong></td>
</tr>
<tr class="even">
<td>학습 포인트</td>
<td>보정해도 안전</td>
<td>보정 안 하면 가짜 유의성</td>
</tr>
</tbody>
</table>
<p>이 두 사례는 각각 marginal model 보정의 <strong>약한 효과</strong> 와 <strong>강한 효과</strong> 의 양 극단을 보여준다. 실무에서 어느 패턴이 나올지는 데이터에 따라 다르므로, <strong>항상 robust SE 와 함께 보고하는 습관</strong> 이 안전하다.</p>
</div>
</div>
</section>
</section>
</section>
<section id="통합-통찰-13.5-가-보여주는-5-가지-패턴" class="level2" data-number="4">
<h2 data-number="4" class="anchored" data-anchor-id="통합-통찰-13.5-가-보여주는-5-가지-패턴"><span class="header-section-number">4</span> 통합 통찰 — § 13.5 가 보여주는 5 가지 패턴</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
그룹 효과의 강도는 데이터마다 다르다
</div>
</div>
<div class="callout-body-container callout-body">
<p>세 데이터의 비교:</p>
<table class="table">
<colgroup>
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
</colgroup>
<thead>
<tr class="header">
<th>데이터</th>
<th>그룹 효과 score test</th>
<th><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Ctheta%7D"></th>
<th>Robust SE / Naive SE</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Mantel rat (§ 13.2-13.4)</td>
<td><img src="https://latex.codecogs.com/png.latex?p%20=%200.18"> (약)</td>
<td>0.47 (약)</td>
<td>0.94 (약)</td>
</tr>
<tr class="even">
<td>Kidney catheter (Ex.13.2,13.4)</td>
<td><img src="https://latex.codecogs.com/png.latex?p%20%3C%200.01"> (강)</td>
<td>약 0.6-0.8</td>
<td>1.5 (강)</td>
</tr>
<tr class="odd">
<td>Skin graft (Ex.13.1,13.3,13.5)</td>
<td>약 <img src="https://latex.codecogs.com/png.latex?0.01-0.05"></td>
<td>약 1.5-2.5 (매우 강)</td>
<td>약 1.4</td>
</tr>
</tbody>
</table>
<p>본질적 그룹 효과가 약한 데이터 (litter 새끼, 일부 가족 코호트) 에서는 보정 효과가 작다. 강한 그룹 효과 (recurrent event, 같은 환자의 다발 graft) 에서는 보정이 결론을 바꿀 수 있다.</p>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Score test → Frailty/Marginal 의 워크플로
</div>
</div>
<div class="callout-body-container callout-body">
<p>§ 13.2 score test 가 유의하면 → § 13.3 frailty 또는 § 13.4 marginal 로 진행.</p>
<ul>
<li><strong>연관 강도가 관심사</strong> (예: 가족력 연구에서 유전성 측정) → § 13.3 frailty + Kendall <img src="https://latex.codecogs.com/png.latex?%5Ctau">.</li>
<li><strong>회귀 계수가 관심사</strong> (예: 임상 시험에서 처치 효과) → § 13.4 marginal + robust SE.</li>
<li><strong>둘 다 적용</strong> 해 일관성 확인이 가장 강건한 분석.</li>
</ul>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Conditional vs Marginal Effect 의 의미 차이
</div>
</div>
<div class="callout-body-container callout-body">
<p>§ 13.3 의 frailty <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"> 는 <strong>conditional effect</strong> (“같은 환자 내에서”) 를, § 13.4 의 marginal <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"> 는 <strong>marginal effect</strong> (“전체 모집단 평균”) 를 추정한다.</p>
<p>연관이 강할수록 두 양의 차이도 크다. Skin graft 에서 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D_%7B%5Ctext%7Bfrailty%7D%7D%20=%20-1.6"> vs <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D_%7B%5Ctext%7Bmarginal%7D%7D%20=%20-1.3"> 의 차이 (약 23 %) 가 그 예.</p>
<p>임상 보고에는 <strong>두 추정치를 모두 제시</strong> 하고 의미 차이를 명시하는 것이 정직한 보고이다.</p>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
작은 표본의 한계
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?G%20%3C%2030"> 정도면 모든 도구의 점근 이론이 약해진다. 본 § 13.5 의 두 데이터:</p>
<ul>
<li>Skin graft: <img src="https://latex.codecogs.com/png.latex?G%20=%2016"> — <strong>매우 작은 표본</strong>. Score test, frailty 적합 모두 부트스트랩 보강 권장.</li>
<li>Kidney catheter: <img src="https://latex.codecogs.com/png.latex?G%20=%2038"> — <strong>경계 영역</strong>. 점근 결과를 그대로 받되 robust SE 로 보정.</li>
</ul>
<p>작은 표본에서는 결과의 신뢰 구간이 넓고 결론이 데이터 의존적임을 명시.</p>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Frailty 분포 선택의 영향
</div>
</div>
<div class="callout-body-container callout-body">
<p><img src="https://latex.codecogs.com/png.latex?G"> 가 작은 데이터에서는 frailty 분포 (gamma vs log-normal vs IG) 선택에 따라 결과가 약간 다를 수 있다. McGilchrist &amp; Aisbett (1991) 의 원논문은 log-normal 사용. 다른 분포로 재적합하면:</p>
<ul>
<li><strong>Gamma</strong>: <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Ctheta%7D%20%5Capprox%200.6">, Kendall <img src="https://latex.codecogs.com/png.latex?%5Ctau%20%5Capprox%200.23"></li>
<li><strong>Log-normal</strong>: variance <img src="https://latex.codecogs.com/png.latex?%5Capprox%200.4"> (다른 척도)</li>
<li><strong>IG</strong>: 비슷한 패턴</li>
</ul>
<p>방향성과 결론은 분포 무관하지만 정확한 점추정은 분포 의존. 결론의 강건성을 위해 <strong>2-3 분포로 재적합</strong> 후 비교하는 것이 권장.</p>
</div>
</div>
</section>
<section id="코드-예시" class="level2" data-number="5">
<h2 data-number="5" class="anchored" data-anchor-id="코드-예시"><span class="header-section-number">5</span> 코드 예시</h2>
<section id="step-1-r-모든-도구-종합-skin-graft" class="level3" data-number="5.1">
<h3 data-number="5.1" class="anchored" data-anchor-id="step-1-r-모든-도구-종합-skin-graft"><span class="header-section-number">5.1</span> Step 1 — R: 모든 도구 종합 (Skin Graft)</h3>
<div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb4-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(survival)</span>
<span id="cb4-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(coxme)</span>
<span id="cb4-3"></span>
<span id="cb4-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Skin graft 데이터 (수동 입력)</span></span>
<span id="cb4-5">graft <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data.frame</span>(</span>
<span id="cb4-6">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">patient =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, ..., <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>),</span>
<span id="cb4-7">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">T =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">29</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">37</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">19</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">57</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">57</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">26</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">93</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">11</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, ..., <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">28</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">28</span>),</span>
<span id="cb4-8">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">E =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, ..., <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>),</span>
<span id="cb4-9">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Z =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, ..., <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>)</span>
<span id="cb4-10">)</span>
<span id="cb4-11"></span>
<span id="cb4-12"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Ex.13.1, 13.3(a), 13.5(a) — 일반 Cox</span></span>
<span id="cb4-13">fit_cox <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coxph</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Surv</span>(T, E) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> Z, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> graft)</span>
<span id="cb4-14"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summary</span>(fit_cox)</span>
<span id="cb4-15"></span>
<span id="cb4-16"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Ex.13.3(b) — Gamma frailty</span></span>
<span id="cb4-17">fit_frailty <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coxph</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Surv</span>(T, E) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> Z <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">frailty</span>(patient, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">dist =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"gamma"</span>),</span>
<span id="cb4-18">                     <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> graft)</span>
<span id="cb4-19"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summary</span>(fit_frailty)</span>
<span id="cb4-20"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># theta 추정값 + LRT p-value 출력</span></span>
<span id="cb4-21"></span>
<span id="cb4-22"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Ex.13.5(b) — Marginal model + robust SE</span></span>
<span id="cb4-23">fit_marginal <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coxph</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Surv</span>(T, E) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> Z <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cluster</span>(patient), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> graft)</span>
<span id="cb4-24"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summary</span>(fit_marginal)</span>
<span id="cb4-25"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># robust SE + Wald test 출력</span></span>
<span id="cb4-26"></span>
<span id="cb4-27"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Score test (Ex.13.1) — Commenges-Andersen 직접 구현 (간이)</span></span>
<span id="cb4-28">M <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">residuals</span>(fit_cox, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"martingale"</span>)</span>
<span id="cb4-29">group_M <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tapply</span>(M, graft<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>patient, sum)</span>
<span id="cb4-30">T_paired <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(group_M<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sum</span>(M<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)</span>
<span id="cb4-31"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># V 는 식 (13.2.5-9) 별도 계산 필요</span></span>
<span id="cb4-32"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 실용적: score test 대신 frailty Wald 또는 LRT 로 우회</span></span></code></pre></div>
</section>
<section id="step-2-r-kidney-catheter-ex.13.2-13.4" class="level3" data-number="5.2">
<h3 data-number="5.2" class="anchored" data-anchor-id="step-2-r-kidney-catheter-ex.13.2-13.4"><span class="header-section-number">5.2</span> Step 2 — R: Kidney Catheter (Ex.13.2, 13.4)</h3>
<div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb5-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(survival)</span>
<span id="cb5-2"></span>
<span id="cb5-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># McGilchrist &amp; Aisbett 1991 데이터 — kidney 라는 이름으로 survival 패키지에 내장</span></span>
<span id="cb5-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data</span>(kidney, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">package =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"survival"</span>)</span>
<span id="cb5-5"></span>
<span id="cb5-6"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 단, survival::kidney 는 long format (한 행에 한 시간).</span></span>
<span id="cb5-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># patient × time 의 long format 으로 변환 필요.</span></span>
<span id="cb5-8"></span>
<span id="cb5-9"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Ex.13.2 — Score test (5 covariates 포함 일반 Cox 후)</span></span>
<span id="cb5-10">fit_cox5 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coxph</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Surv</span>(time, status) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> age <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> sex <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> disease, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> kidney)</span>
<span id="cb5-11"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summary</span>(fit_cox5)</span>
<span id="cb5-12"></span>
<span id="cb5-13"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Ex.13.4(a) — ANOVA (naive SE)</span></span>
<span id="cb5-14"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">anova</span>(fit_cox5)</span>
<span id="cb5-15"></span>
<span id="cb5-16"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Ex.13.4(b) — Marginal + robust SE</span></span>
<span id="cb5-17">fit_marg5 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coxph</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Surv</span>(time, status) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> age <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> sex <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> disease <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cluster</span>(id),</span>
<span id="cb5-18">                   <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> kidney)</span>
<span id="cb5-19"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summary</span>(fit_marg5)</span>
<span id="cb5-20"></span>
<span id="cb5-21"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Naive vs Robust 비교 표</span></span>
<span id="cb5-22">naive_se  <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sqrt</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">diag</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">vcov</span>(fit_cox5)))</span>
<span id="cb5-23">robust_se <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sqrt</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">diag</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">vcov</span>(fit_marg5)))</span>
<span id="cb5-24">ratio     <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> robust_se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> naive_se</span>
<span id="cb5-25"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data.frame</span>(naive_se, robust_se, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ratio_se =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">round</span>(ratio, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>))</span>
<span id="cb5-26"></span>
<span id="cb5-27"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Frailty (참고: 원논문은 log-normal)</span></span>
<span id="cb5-28">fit_frail5 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coxme</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Surv</span>(time, status) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> age <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> sex <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> disease <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> id),</span>
<span id="cb5-29">                    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> kidney)</span>
<span id="cb5-30"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(fit_frail5)</span></code></pre></div>
</section>
<section id="step-3-python-lifelines-제한적" class="level3" data-number="5.3">
<h3 data-number="5.3" class="anchored" data-anchor-id="step-3-python-lifelines-제한적"><span class="header-section-number">5.3</span> Step 3 — Python lifelines (제한적)</h3>
<div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb6-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> lifelines <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> CoxPHFitter</span>
<span id="cb6-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> pandas <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> pd</span>
<span id="cb6-3"></span>
<span id="cb6-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Skin graft 데이터</span></span>
<span id="cb6-5">df <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> pd.DataFrame({</span>
<span id="cb6-6">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"T"</span>: [...], <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span>: [...], <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Z"</span>: [...], <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"patient"</span>: [...]</span>
<span id="cb6-7">})</span>
<span id="cb6-8"></span>
<span id="cb6-9"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 일반 Cox</span></span>
<span id="cb6-10">cph <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> CoxPHFitter()</span>
<span id="cb6-11">cph.fit(df, duration_col<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"T"</span>, event_col<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span>, formula<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Z"</span>)</span>
<span id="cb6-12"></span>
<span id="cb6-13"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Marginal model (cluster_col)</span></span>
<span id="cb6-14">cph_robust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> CoxPHFitter()</span>
<span id="cb6-15">cph_robust.fit(df, duration_col<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"T"</span>, event_col<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span>,</span>
<span id="cb6-16">               formula<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Z"</span>, cluster_col<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"patient"</span>)</span>
<span id="cb6-17"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(cph_robust.summary)</span>
<span id="cb6-18"></span>
<span id="cb6-19"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Frailty 는 lifelines 가 직접 지원 X — R 사용 권장</span></span></code></pre></div>
</section>
</section>
<section id="핵심-요약" class="level2" data-number="6">
<h2 data-number="6" class="anchored" data-anchor-id="핵심-요약"><span class="header-section-number">6</span> 핵심 요약</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
§ 13.5 한 줄 요약
</div>
</div>
<div class="callout-body-container callout-body">
<blockquote class="blockquote">
<p>5 개 연습문제는 <strong>두 데이터셋에 § 13.2 score test · § 13.3 gamma frailty · § 13.4 marginal model 의 세 도구를 종합 적용</strong> 한다. Skin graft (Ex.13.1·13.3·13.5) 에서는 환자 면역계 random effect 가 강해 frailty 적합 후 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"> 가 attenuation 보정으로 더 강해지는 패턴이 명확하다. Kidney catheter (Ex.13.2·13.4) 에서는 같은 환자의 두 감염이 강하게 연관되어 marginal model 의 robust SE 가 naive SE 의 1.5 배가 되며, 5 % 결정 기준에서 일부 변수의 결론이 바뀐다 (Sex, PKD). 두 데이터 모두 <strong>그룹 효과 무시는 가짜 유의성을 만들 수 있음</strong> 을 입증한다.</p>
</blockquote>
</div>
</div>
<table class="table">
<colgroup>
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
</colgroup>
<thead>
<tr class="header">
<th>문제</th>
<th>데이터</th>
<th>도구</th>
<th>핵심 발견</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>13.1</td>
<td>Skin graft</td>
<td>Score test</td>
<td>환자 random effect 유의</td>
</tr>
<tr class="even">
<td>13.2</td>
<td>Kidney catheter</td>
<td>Score test (5 covariates)</td>
<td>환자 효과 강함</td>
</tr>
<tr class="odd">
<td>13.3</td>
<td>Skin graft</td>
<td>Gamma frailty EM</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Ctheta%7D%20%5Capprox%202">, <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"> attenuation 보정</td>
</tr>
<tr class="even">
<td>13.4</td>
<td>Kidney catheter</td>
<td>Marginal model + ANOVA</td>
<td>Sex/PKD: 5% 유의→비유의</td>
</tr>
<tr class="odd">
<td>13.5</td>
<td>Skin graft</td>
<td>Marginal model</td>
<td>Robust SE &gt; naive, 결론 유지</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
5 가지 학습 포인트
</div>
</div>
<div class="callout-body-container callout-body">
<p><strong>1. 그룹 효과의 강도는 본질적</strong>: Litter 새끼 (약함), kidney catheter (강함), skin graft (매우 강함). 데이터의 그룹 단위가 무엇인지가 결정.</p>
<p><strong>2. Score test 는 빠른 게이트</strong>: 무거운 frailty EM 전에 1 단계로 연관 존재 검증.</p>
<p><strong>3. Frailty 의 attenuation 보정</strong>: Skin graft 에서 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D%20=%20-1.3%20%5Cto%20-1.6"> (HR 0.27 → 0.20). 효과 크기가 일반 Cox 보다 더 강하게 추정.</p>
<p><strong>4. Marginal model 의 robust SE</strong>: Kidney catheter 에서 1.5 배 SE 부풀림 → Sex/PKD 결론 변경. 작은 데이터에서 더 중요.</p>
<p><strong>5. Conditional vs Marginal effect 구분</strong>: Frailty 의 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"> (개체 내) 와 marginal 의 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cbeta%7D"> (모집단 평균) 는 다른 양. 임상 의사결정 vs 정책 권고에 각각 적합.</p>
</div>
</div>
</section>
<section id="관련-주제" class="level2" data-number="7">
<h2 data-number="7" class="anchored" data-anchor-id="관련-주제"><span class="header-section-number">7</span> 관련 주제</h2>
<p><strong>Ch.13 시리즈</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/13-klein-ch13-multivariate.html">Ch.13 Overview — Multivariate Survival Analysis</a> — 통합 그림</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/13-1-frailty-score-test.html">§ 13.1-13.2 — Frailty Models &amp; Score Test</a> — Ex.13.1, 13.2 의 도구</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/13-2-gamma-frailty-marginal.html">§ 13.3-13.4 — Gamma Frailty EM &amp; Marginal Model</a> — Ex.13.3, 13.4, 13.5 의 도구</li>
</ul>
<p><strong>관련 데이터·방법론</strong></p>
<ul>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/11-klein-ch11-diagnostics.html">Ch.11 — 회귀 진단</a> — 마팅게일·score 잔차 (식 11.6.1) 의 정의</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/10-klein-ch10-additive-hazards.html">Ch.10 — 가산 위험 모형</a> — Cox PH 의 또 다른 일반화</li>
<li><a href="../../../../../docs/blog/posts/Statistics/survival/90-modern-ml-survival.html">Modern Survival Analysis (RSF / DeepSurv)</a> — 계층적 random effect 의 ML 확장</li>
</ul>
</section>
<section id="참고-문헌" class="level2" data-number="8">
<h2 data-number="8" class="anchored" data-anchor-id="참고-문헌"><span class="header-section-number">8</span> 참고 문헌</h2>
<ul>
<li>Klein, J. P., &amp; Moeschberger, M. L. (2003). <em>Survival Analysis: Techniques for Censored and Truncated Data</em> (2nd ed.). Springer. <strong>§ 13.5 Exercises</strong>.</li>
<li>Batchelor, J. R., &amp; Hackett, M. (1970). HL-A matching in treatment of burned patients with skin allografts. <em>Lancet</em>, 296(7670), 581-583. (Ex.13.1, 13.3, 13.5 의 데이터 출처)</li>
<li>McGilchrist, C. A., &amp; Aisbett, C. W. (1991). Regression with frailty in survival analysis. <em>Biometrics</em>, 47(2), 461-466. (Ex.13.2, 13.4 의 데이터 출처 + log-normal frailty 분석)</li>
<li>Therneau, T. M., Grambsch, P. M., &amp; Pankratz, V. S. (2003). Penalized survival models and frailty. <em>J. Computational and Graphical Statistics</em>, 12(1), 156-175. (R <code>coxph(frailty=...)</code> 의 이론 기반)</li>
<li>Hougaard, P. (2001). <em>Analysis of Multivariate Survival Data</em>. Springer. (Ch.13 주제의 단행본 확장 + 다양한 데이터 분석 사례)</li>
</ul>


</section>

 ]]></description>
  <category>Statistics</category>
  <category>Survival Analysis</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Statistics/survival/13-3-exercises.html</guid>
  <pubDate>Sat, 09 May 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Kohavi Ch.22 개관 — Leakage·Interference (Variant 간 누수와 간섭)</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F22-0-leakage-interference-overview.html</link>
  <description><![CDATA[ 





<section id="정의" class="level2" data-number="1">
<h2 data-number="1" class="anchored" data-anchor-id="정의"><span class="header-section-number">1</span> 정의</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
정의: Interference (간섭) · Leakage (누수)
</div>
</div>
<div class="callout-body-container callout-body">
<p>A/B 실험에서 한 unit 의 행동이 <em>다른 unit 의 variant 배정에</em> 영향을 받는 현상. SUTVA (Stable Unit Treatment Value Assumption) 의 위반이며, <em>spillover</em>·<em>leakage</em> 로도 부른다 (Kohavi, Tang, Xu, 2020, Ch.22).</p>
<section id="sutva-의-형식적-표현" class="level5" data-number="1.0.0.1">
<h5 data-number="1.0.0.1" class="anchored" data-anchor-id="sutva-의-형식적-표현"><span class="header-section-number">1.0.0.1</span> SUTVA 의 형식적 표현</h5>
<p><img src="https://latex.codecogs.com/png.latex?Y_i(%5Cmathbf%7Bz%7D)%20=%20Y_i(z_i)%20%5Ctag%7B22.1%7D"></p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?%5Cmathbf%7Bz%7D%20=%20(z_1,%20z_2,%20%5Cdots,%20z_n)">: 전체 <img src="https://latex.codecogs.com/png.latex?n"> unit 의 variant 배정 vector</li>
<li><img src="https://latex.codecogs.com/png.latex?Y_i(%5Cmathbf%7Bz%7D)">: unit <img src="https://latex.codecogs.com/png.latex?i"> 의 잠재 결과 (전체 배정 의존)</li>
<li><img src="https://latex.codecogs.com/png.latex?Y_i(z_i)">: unit <img src="https://latex.codecogs.com/png.latex?i"> 의 잠재 결과 (자신의 배정만 의존)</li>
</ul>
</section>
<section id="위반-시-결과" class="level5" data-number="1.0.0.2">
<h5 data-number="1.0.0.2" class="anchored" data-anchor-id="위반-시-결과"><span class="header-section-number">1.0.0.2</span> 위반 시 결과</h5>
<ul>
<li>ATE 추정량 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Ctau%7D"> 가 <em>biased</em> — direction (under/over) 은 leakage 채널에 따라 다름</li>
<li>해석 변형: 실험 시 <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Ctau%7D"> 와 launch 후 universe 효과 가 <em>다르다</em></li>
<li>의사결정 위협: ad campaign 처럼 budget 제약 하에서 launch 후 효과는 neutral 인데 실험 중 positive 로 보일 수 있음</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관
</div>
</div>
<div class="callout-body-container callout-body">
<p>A/B 실험 의 비유 는 <em>두 평행 우주</em>. 한쪽 우주 는 모두 Treatment, 다른 우주 는 모두 Control. 두 우주 의 metric 차 가 <em>진짜 효과</em>.</p>
<p>SUTVA 가 깨지면: 두 우주 가 <em>분리되지 않는다</em>. Treatment 사용자 가 Control 사용자 의 행동을 바꾼다. 결과: 우리가 보는 delta 는 <em>섞인 우주</em> 의 차 — 진짜 차 가 아니다.</p>
<p>레슨: 실험 unit 이 진짜로 독립인지 점검. 사회 네트워크·marketplace·shared resource· 일부 instrumentation 은 <em>기본적으로</em> 독립이 아니다.</p>
</div>
</div>
</section>
<section id="왜-필요한가" class="level2" data-number="2">
<h2 data-number="2" class="anchored" data-anchor-id="왜-필요한가"><span class="header-section-number">2</span> 왜 필요한가</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
SUTVA 위반의 실무 위험
</div>
</div>
<div class="callout-body-container callout-body">
<section id="direction-of-bias-의-비대칭" class="level5" data-number="2.0.0.1">
<h5 data-number="2.0.0.1" class="anchored" data-anchor-id="direction-of-bias-의-비대칭"><span class="header-section-number">2.0.0.1</span> 1. Direction of bias 의 비대칭</h5>
<table class="table">
<colgroup>
<col style="width: 33%">
<col style="width: 33%">
<col style="width: 33%">
</colgroup>
<thead>
<tr class="header">
<th>시나리오</th>
<th>leakage 방향</th>
<th>bias 방향</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>사회 네트워크 (Facebook 메시지)</td>
<td>T → C 전파</td>
<td>underestimate</td>
</tr>
<tr class="even">
<td>Marketplace (Airbnb 재고)</td>
<td>T 가 C 자원 흡수</td>
<td>overestimate</td>
</tr>
<tr class="odd">
<td>Ad campaign budget</td>
<td>T 가 C budget 소진</td>
<td>overestimate</td>
</tr>
<tr class="even">
<td>Relevance model 공유 학습</td>
<td>T → C 학습 누수</td>
<td>underestimate</td>
</tr>
<tr class="odd">
<td>CPU contention</td>
<td>T bug 가 C 응답 시간 악화</td>
<td>underestimate</td>
</tr>
<tr class="even">
<td>Sub-user unit (page)</td>
<td>같은 user 의 fast/slow page 혼합</td>
<td>underestimate</td>
</tr>
</tbody>
</table>
</section>
<section id="launch-후-효과-와-의-괴리" class="level5" data-number="2.0.0.2">
<h5 data-number="2.0.0.2" class="anchored" data-anchor-id="launch-후-효과-와-의-괴리"><span class="header-section-number">2.0.0.2</span> 2. Launch 후 효과 와 의 괴리</h5>
<p>ad campaign budget 사례:</p>
<pre><code>실험 중:
  Treatment: 더 많은 click → revenue +5%
  Control: budget 정상 → revenue baseline
  delta: +5% (statistically significant)

Launch 후 (모든 사용자 Treatment):
  Total budget: 동일 (월간 cap)
  click 모두 Treatment 비율로 → 추가 click 의 한계 revenue 0
  실제 효과: ~0%</code></pre>
<p>의사결정 의 함정: 실험 결과 만 보고 launch 하면 ROI 가 0.</p>
</section>
<section id="의식하지-못하는-채널" class="level5" data-number="2.0.0.3">
<h5 data-number="2.0.0.3" class="anchored" data-anchor-id="의식하지-못하는-채널"><span class="header-section-number">2.0.0.3</span> 3. 의식하지 못하는 채널</h5>
<p>가장 위험한 leakage 는 <em>의식하지 못하는 채널</em>:</p>
<ul>
<li>shared CPU·memory (의 contention)</li>
<li>shared cache (의 hot key)</li>
<li>shared rate limiter</li>
<li>shared experience (같은 사용자 의 page-level 무작위 배정)</li>
</ul>
<p>이런 leakage 는 코드 의 architecture 를 알아야 발견.</p>
</section>
</div>
</div>
</section>
<section id="두-가지-연결-채널" class="level2" data-number="3">
<h2 data-number="3" class="anchored" data-anchor-id="두-가지-연결-채널"><span class="header-section-number">3</span> 두 가지 연결 채널</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
정의: Direct vs Indirect Connection
</div>
</div>
<div class="callout-body-container callout-body">
<p>Kohavi 는 leakage 의 두 갈래로 분류 (Kohavi, Tang, Xu, 2020, Ch.22).</p>
<section id="direct-connection" class="level5" data-number="3.0.0.1">
<h5 data-number="3.0.0.1" class="anchored" data-anchor-id="direct-connection"><span class="header-section-number">3.0.0.1</span> Direct connection</h5>
<ul>
<li>두 unit 이 <em>직접</em> 연결: friendship, 같은 시간 같은 공간, 메시지 송수신</li>
<li>예: Facebook 친구, Skype call partner, LinkedIn connection</li>
<li>채널: 사회적 상호작용 (social engagement)</li>
</ul>
</section>
<section id="indirect-connection" class="level5" data-number="3.0.0.2">
<h5 data-number="3.0.0.2" class="anchored" data-anchor-id="indirect-connection"><span class="header-section-number">3.0.0.2</span> Indirect connection</h5>
<ul>
<li>두 unit 이 <em>latent variable</em> 또는 <em>shared resource</em> 로 연결</li>
<li>예: Airbnb 재고 공유, ad budget 공유, relevance model 공유 학습 데이터</li>
<li>채널: 자원 경쟁, 알고리즘 학습, infrastructure (CPU)</li>
</ul>
</section>
<section id="차이의-함의" class="level5" data-number="3.0.0.3">
<h5 data-number="3.0.0.3" class="anchored" data-anchor-id="차이의-함의"><span class="header-section-number">3.0.0.3</span> 차이의 함의</h5>
<table class="table">
<colgroup>
<col style="width: 33%">
<col style="width: 33%">
<col style="width: 33%">
</colgroup>
<thead>
<tr class="header">
<th></th>
<th>Direct</th>
<th>Indirect</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>가시성</td>
<td>높음 (graph 가 있다)</td>
<td>낮음 (latent)</td>
</tr>
<tr class="even">
<td>측정 가능성</td>
<td>edge-level analysis 가능</td>
<td>시스템 dependency 분석 필요</td>
</tr>
<tr class="odd">
<td>해결책</td>
<td>network-cluster, ego-centric</td>
<td>resource splitting, geo, time</td>
</tr>
<tr class="even">
<td>기본 사용자 unit 작동?</td>
<td>부분적 (clusters)</td>
<td>거의 안 됨</td>
</tr>
</tbody>
</table>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 매개체 (medium) 의 식별
</div>
</div>
<div class="callout-body-container callout-body">
<p>leakage 의 <em>공식</em> 은 항상 같다:</p>
<pre><code>A → [매개체 medium] → B</code></pre>
<p>매개체 는 무엇인가? - friendship graph (사회 네트워크) - 공유 budget (ad campaign) - 공유 inventory (marketplace) - 공유 학습 데이터 (relevance model) - 공유 hardware (CPU) - 공유 사용자 (sub-user randomization)</p>
<p>매개체 를 식별하면 <em>해결책</em> 도 보인다: 매개체 를 <em>분리</em> (split) 하거나, 매개체 를 <em>포함</em> (cluster) 하여 randomization 단위 를 변경.</p>
</div>
</div>
</section>
<section id="가지-leakage-시나리오" class="level2" data-number="4">
<h2 data-number="4" class="anchored" data-anchor-id="가지-leakage-시나리오"><span class="header-section-number">4</span> 6 가지 leakage 시나리오</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Direct connection — 사례 2
</div>
</div>
<div class="callout-body-container callout-body">
<section id="facebook-linkedin-사회-engagement" class="level5" data-number="4.0.0.1">
<h5 data-number="4.0.0.1" class="anchored" data-anchor-id="facebook-linkedin-사회-engagement"><span class="header-section-number">4.0.0.1</span> Facebook · LinkedIn (사회 engagement)</h5>
<ul>
<li>“video chat”, “message”, “post” 의 효용 은 <em>친구 가 사용할수록</em> 증가</li>
<li>Treatment 의 algorithm 개선 → Treatment 사용자 의 invitation 증가</li>
<li>Control 친구 가 invitation 받아 → Control 도 connection·메시지 증가</li>
<li>결과: total invitation 증가 가 <em>과소</em> 측정 (Control 도 같이 올라감)</li>
</ul>
</section>
<section id="skype-calls-양방향-통신" class="level5" data-number="4.0.0.2">
<h5 data-number="4.0.0.2" class="anchored" data-anchor-id="skype-calls-양방향-통신"><span class="header-section-number">4.0.0.2</span> Skype calls (양방향 통신)</h5>
<ul>
<li>모든 call 은 <em>2 명 이상</em> 참여</li>
<li>Treatment 가 call 품질 개선 → Treatment 사용자 call 증가</li>
<li>Treatment → Control 친구 call → Control 의 call 도 증가</li>
<li>결과: Treatment 효과 <em>과소</em> 측정</li>
</ul>
</section>
<section id="직관-1" class="level5" data-number="4.0.0.3">
<h5 data-number="4.0.0.3" class="anchored" data-anchor-id="직관-1"><span class="header-section-number">4.0.0.3</span> 직관</h5>
<p>direct connection 시 Treatment effect 의 일부 가 Control 로 <em>전파</em> 된다. graph 가 밀집할수록 전파 정도 가 크다 → underestimate 의 크기 도 크다.</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Indirect connection — 사례 6
</div>
</div>
<div class="callout-body-container callout-body">
<section id="airbnb-marketplace-재고" class="level5" data-number="4.0.0.4">
<h5 data-number="4.0.0.4" class="anchored" data-anchor-id="airbnb-marketplace-재고"><span class="header-section-number">4.0.0.4</span> Airbnb (marketplace 재고)</h5>
<ul>
<li>Treatment 의 conversion 개선 → Treatment 사용자 booking 증가</li>
<li>동일 inventory 에서 booking 증가 → Control 사용자 가 볼 inventory 감소</li>
<li>Control revenue 감소 → delta <em>과대</em> 측정</li>
</ul>
</section>
<section id="uberlyft-양면-시장" class="level5" data-number="4.0.0.5">
<h5 data-number="4.0.0.5" class="anchored" data-anchor-id="uberlyft-양면-시장"><span class="header-section-number">4.0.0.5</span> Uber·Lyft (양면 시장)</h5>
<ul>
<li>“surge price” 알고리즘 개선 → Treatment rider 옵트인 증가</li>
<li>도로 의 driver 수 동일 → Control rider 의 가격 상승, ride 감소</li>
<li>delta <em>과대</em> 측정</li>
</ul>
</section>
<section id="ebay-auction" class="level5" data-number="4.0.0.6">
<h5 data-number="4.0.0.6" class="anchored" data-anchor-id="ebay-auction"><span class="header-section-number">4.0.0.6</span> eBay (auction)</h5>
<ul>
<li>Treatment 가 bidding 촉진 → Treatment 의 winning bid 증가</li>
<li>동일 item → Control 사용자 의 winning 확률 감소</li>
<li>delta <em>과대</em> 측정</li>
</ul>
</section>
<section id="ad-campaign-budget" class="level5" data-number="4.0.0.7">
<h5 data-number="4.0.0.7" class="anchored" data-anchor-id="ad-campaign-budget"><span class="header-section-number">4.0.0.7</span> Ad campaign budget</h5>
<ul>
<li>Treatment 의 CTR 개선 → Treatment click 증가</li>
<li>공유 budget 의 소진 가속 → Control click 의 budget 부족</li>
<li>delta <em>과대</em> 측정 + 월말 효과</li>
</ul>
</section>
<section id="relevance-model-공유-학습" class="level5" data-number="4.0.0.8">
<h5 data-number="4.0.0.8" class="anchored" data-anchor-id="relevance-model-공유-학습"><span class="header-section-number">4.0.0.8</span> Relevance model 공유 학습</h5>
<ul>
<li>Treatment 가 better click prediction → Treatment 의 click 데이터 가 양질</li>
<li>공유 학습 데이터 → Control model 도 양질 데이터 학습</li>
<li>시간이 흐를수록 Control 도 개선 → delta <em>과소</em> 측정</li>
</ul>
</section>
<section id="cpu-contention" class="level5" data-number="4.0.0.9">
<h5 data-number="4.0.0.9" class="anchored" data-anchor-id="cpu-contention"><span class="header-section-number">4.0.0.9</span> CPU contention</h5>
<ul>
<li>Treatment bug 가 CPU 점유 → 같은 machine 의 Control 응답 시간 도 악화</li>
<li>Treatment 의 latency 부정 효과 <em>과소</em> 측정</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: bias direction 의 결정
</div>
</div>
<div class="callout-body-container callout-body">
<p>bias 방향은 <em>채널 의 성질</em> 에 따라:</p>
<ul>
<li><em>경쟁 자원</em> (inventory, budget): T 가 C 의 자원을 흡수 → overestimate</li>
<li><em>사회 전파</em> (friendship, communication): T effect 가 C 로 전파 → underestimate</li>
<li><em>공유 학습</em> (model training): T 데이터 가 C 모델 도 개선 → underestimate</li>
<li><em>공유 infra</em> (CPU): T bug 가 C 도 영향 → underestimate (의 부정 효과)</li>
</ul>
<p>규칙: <em>희소 자원 공유 → 과대</em>, <em>positive externality 공유 → 과소</em>.</p>
</div>
</div>
</section>
<section id="실무-해결책-4-갈래" class="level2" data-number="5">
<h2 data-number="5" class="anchored" data-anchor-id="실무-해결책-4-갈래"><span class="header-section-number">5</span> 실무 해결책 4 갈래</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
1. Rule-of-thumb (ecosystem value)
</div>
</div>
<div class="callout-body-container callout-body">
<p>가장 가벼운 접근.</p>
<ul>
<li>Bernoulli randomization (전형적 user-level) 유지</li>
<li><em>first-order action</em> (예: 메시지 보냄) 의 delta 를 측정</li>
<li><em>downstream metric</em> (예: 메시지 받은 사람 의 reply, session) 을 함께 측정</li>
<li>과거 실험 의 historical data 로 ecosystem multiplier (예: 메시지 1 건 → ecosystem value 0.7) 를 추정</li>
</ul>
<p>장점: 일회성 calibration 후 적용 쉬움. 단점: 평균값 — 특정 실험 이 평균과 다르면 부정확.</p>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
2. Isolation (4 갈래)
</div>
</div>
<div class="callout-body-container callout-body">
<p>매개체 를 분리.</p>
<section id="splitting-shared-resources" class="level5" data-number="5.0.0.1">
<h5 data-number="5.0.0.1" class="anchored" data-anchor-id="splitting-shared-resources"><span class="header-section-number">5.0.0.1</span> Splitting shared resources</h5>
<ul>
<li>ad budget: 50/50 traffic 에 50/50 budget 할당</li>
<li>training data: variant 별로 분리 학습</li>
<li>한계: heterogeneous machine 분리 시 confounding 도입</li>
</ul>
</section>
<section id="geo-based-randomization" class="level5" data-number="5.0.0.2">
<h5 data-number="5.0.0.2" class="anchored" data-anchor-id="geo-based-randomization"><span class="header-section-number">5.0.0.2</span> Geo-based randomization</h5>
<ul>
<li>지역 단위 randomization (Vaver and Koehler 2011, 2012)</li>
<li>적용: hotel·taxi·rider marketplace</li>
<li>한계: sample size 가 지역 수 로 제한 → variance 증가</li>
</ul>
</section>
<section id="time-based-randomization" class="level5" data-number="5.0.0.3">
<h5 data-number="5.0.0.3" class="anchored" data-anchor-id="time-based-randomization"><span class="header-section-number">5.0.0.3</span> Time-based randomization</h5>
<ul>
<li>시간 단위 (분, 시간, 일) 로 모두 T 또는 모두 C</li>
<li>적용: 같은 사용자 시간차 leakage 가 없는 경우</li>
<li>한계: 시간 효과 (요일·시간대) 가 강해 paired t-test 필요</li>
</ul>
</section>
<section id="network-cluster-randomization" class="level5" data-number="5.0.0.4">
<h5 data-number="5.0.0.4" class="anchored" data-anchor-id="network-cluster-randomization"><span class="header-section-number">5.0.0.4</span> Network-cluster randomization</h5>
<ul>
<li>사회 네트워크 의 cluster 단위 randomization</li>
<li>적용: Facebook, LinkedIn</li>
<li>한계: dense graph 는 perfect isolation 불가 (LinkedIn 80%+ inter-cluster edges)</li>
</ul>
</section>
<section id="network-ego-centric-randomization" class="level5" data-number="5.0.0.5">
<h5 data-number="5.0.0.5" class="anchored" data-anchor-id="network-ego-centric-randomization"><span class="header-section-number">5.0.0.5</span> Network ego-centric randomization</h5>
<ul>
<li>ego (focal node) + alters (인접 node) 묶음 단위</li>
<li>ego 만 variant 배정, alters 는 통제</li>
<li>장점: 작은 cluster 로 sample size 확보, first-order·downstream 분리 가능</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
3. Edge-Level Analysis
</div>
</div>
<div class="callout-body-container callout-body">
<p>Bernoulli randomization on users + edge labeling.</p>
<p>각 interaction edge 를 4 type 으로 분류:</p>
<ul>
<li>T → T (Treatment 가 Treatment 에게)</li>
<li>T → C (Treatment 가 Control 에게)</li>
<li>C → C</li>
<li>C → T</li>
</ul>
<section id="분석-패턴" class="level5" data-number="5.0.0.6">
<h5 data-number="5.0.0.6" class="anchored" data-anchor-id="분석-패턴"><span class="header-section-number">5.0.0.6</span> 분석 패턴</h5>
<ul>
<li><em>unbiased delta</em>: T → T edge 와 C → C edge 의 차</li>
<li><em>Treatment affinity</em>: T 가 다른 T 에게 더 자주 message 하는가?</li>
<li><em>response rate</em>: T 의 새 action 이 더 높은 reply 받는가?</li>
</ul>
</section>
<section id="한계" class="level5" data-number="5.0.0.7">
<h5 data-number="5.0.0.7" class="anchored" data-anchor-id="한계"><span class="header-section-number">5.0.0.7</span> 한계</h5>
<ul>
<li>edge 가 명확히 정의 가능한 경우만 (메시지·like·visit)</li>
<li>ego-centric 보다 power 낮음 (모든 user 가 single variant)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
4. Detection &amp; Monitoring
</div>
</div>
<div class="callout-body-container callout-body">
<p>leakage 를 <em>측정</em> 하지 않더라도 <em>감시</em> 는 필수.</p>
<ul>
<li>ramp 단계 (employees → small datacenter → 1% → 10% → 50%) 에서 outlier 탐지</li>
<li>budget-constrained vs not constrained 의 split monitoring</li>
<li>platform-wide alert: CPU spike, latency 의 상위 quantile</li>
</ul>
<p>ramp 의 4 단계 (Pre-MPR / MPR / Post-MPR / Long-term) 는 leakage 발견 의 첫 방어선 (Ch.15 참조).</p>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 해결책 의 trade-off
</div>
</div>
<div class="callout-body-container callout-body">
<table class="table">
<thead>
<tr class="header">
<th>접근</th>
<th>적용 영역</th>
<th>sample size</th>
<th>bias 제거</th>
<th>구현 비용</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Rule-of-thumb</td>
<td>사회 engagement</td>
<td>큼 (Bernoulli)</td>
<td>약</td>
<td>낮음</td>
</tr>
<tr class="even">
<td>Resource split</td>
<td>budget·training</td>
<td>큼</td>
<td>강</td>
<td>중간</td>
</tr>
<tr class="odd">
<td>Geo</td>
<td>marketplace</td>
<td>작음 (지역 수)</td>
<td>강</td>
<td>중간</td>
</tr>
<tr class="even">
<td>Time</td>
<td>단기 transactional</td>
<td>작음 (시간 수)</td>
<td>강</td>
<td>낮음</td>
</tr>
<tr class="odd">
<td>Network-cluster</td>
<td>사회 네트워크</td>
<td>작음 (cluster 수)</td>
<td>부분적</td>
<td>높음</td>
</tr>
<tr class="even">
<td>Ego-centric</td>
<td>사회 네트워크</td>
<td>중간</td>
<td>강</td>
<td>높음</td>
</tr>
<tr class="odd">
<td>Edge-level</td>
<td>사회 네트워크</td>
<td>큼</td>
<td>강</td>
<td>중간</td>
</tr>
</tbody>
</table>
<p>선택 의 원칙: <em>매개체 의 성질 에 맞는 isolation</em> + Bernoulli 와 결합 가능 시 sample size 보강.</p>
</div>
</div>
</section>
<section id="python-시뮬레이션-간단한-marketplace-leakage" class="level2" data-number="6">
<h2 data-number="6" class="anchored" data-anchor-id="python-시뮬레이션-간단한-marketplace-leakage"><span class="header-section-number">6</span> Python 시뮬레이션 (간단한 marketplace leakage)</h2>
<div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb3-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb3-2"></span>
<span id="cb3-3">np.random.seed(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">42</span>)</span>
<span id="cb3-4"></span>
<span id="cb3-5"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> simulate_marketplace(n_users<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10000</span>, n_items<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, treatment_lift<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.20</span>):</span>
<span id="cb3-6">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Treatment: 20% conversion lift, 동일 inventory</span></span>
<span id="cb3-7">    assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.randint(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>n_users)  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 0 = C, 1 = T</span></span>
<span id="cb3-8">    base_p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.05</span></span>
<span id="cb3-9">    p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.where(assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, base_p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> treatment_lift), base_p)</span>
<span id="cb3-10">    intent <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.binomial(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, p, size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>n_users)</span>
<span id="cb3-11"></span>
<span id="cb3-12">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 동일 inventory: T booking 이 inventory 차지 → C booking 감소</span></span>
<span id="cb3-13">    t_intents <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> (intent <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb3-14">    c_intents <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> (intent <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb3-15">    available <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> n_items</span>
<span id="cb3-16">    t_bookings <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">min</span>(t_intents.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(), available)</span>
<span id="cb3-17">    available <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-=</span> t_bookings</span>
<span id="cb3-18">    c_bookings <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">min</span>(c_intents.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(), available)</span>
<span id="cb3-19"></span>
<span id="cb3-20">    n_t, n_c <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>).<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(), (assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>).<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>()</span>
<span id="cb3-21">    rate_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> t_bookings <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> n_t</span>
<span id="cb3-22">    rate_c <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> c_bookings <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> n_c</span>
<span id="cb3-23">    observed_delta <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (rate_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> rate_c) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> rate_c</span>
<span id="cb3-24">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> rate_t, rate_c, observed_delta</span>
<span id="cb3-25"></span>
<span id="cb3-26">rate_t, rate_c, delta <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> simulate_marketplace()</span>
<span id="cb3-27"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Treatment rate: </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>rate_t<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb3-28"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Control rate:   </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>rate_c<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb3-29"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Observed delta: </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>delta<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.2%}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb3-30"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"True delta:     </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.20</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.2%}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb3-31"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Bias direction: overestimate (Control rate suppressed by inventory contention)"</span>)</span></code></pre></div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
시뮬레이션 해석
</div>
</div>
<div class="callout-body-container callout-body">
<p>inventory 가 부족 (n_items=100 &lt;&lt; 예상 booking 500+) 할 때 Control 의 booking 이 <em>먼저 소진된 inventory</em> 로 인해 감소. Treatment 의 <em>진짜</em> 20% lift 가 실험 에서는 20% 보다 <em>훨씬 큰</em> delta 로 보인다 (overestimate).</p>
<p>해결: geo-based randomization (city 별 inventory 격리) 또는 time-based randomization (같은 시간 모두 T 또는 모두 C).</p>
</div>
</div>
</section>
<section id="비교" class="level2" data-number="7">
<h2 data-number="7" class="anchored" data-anchor-id="비교"><span class="header-section-number">7</span> 비교</h2>
<table class="table">
<thead>
<tr class="header">
<th>차원</th>
<th>일반 실험 (SUTVA 성립)</th>
<th>leakage 실험</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>가정</td>
<td>unit 독립</td>
<td>unit 의존</td>
</tr>
<tr class="even">
<td>추정량</td>
<td><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Ctau%7D%20=%20E%5BY%20%5Cmid%20T%5D%20-%20E%5BY%20%5Cmid%20C%5D"></td>
<td>biased estimator</td>
</tr>
<tr class="odd">
<td>식별</td>
<td>causal effect 그대로</td>
<td>“혼합 우주” effect</td>
</tr>
<tr class="even">
<td>의사결정</td>
<td>launch 시 효과 ≈ 실험 효과</td>
<td>괴리 가능</td>
</tr>
<tr class="odd">
<td>해결</td>
<td>불필요</td>
<td>isolation·rule-of-thumb·edge analysis</td>
</tr>
</tbody>
</table>
</section>
<section id="응용" class="level2" data-number="8">
<h2 data-number="8" class="anchored" data-anchor-id="응용"><span class="header-section-number">8</span> 응용</h2>
<ul>
<li>사회 네트워크 (Facebook, LinkedIn, Twitter): network-cluster + ego-centric</li>
<li>양면 marketplace (Airbnb, Uber, eBay): geo-based + time-based</li>
<li>ad platform (Google, Bing): budget split + ramp monitoring</li>
<li>search engine: relevance model 분리 학습 + holdback experiment</li>
<li>콘텐츠 플랫폼 (YouTube, TikTok): network-cluster + ecosystem multiplier</li>
</ul>
</section>
<section id="phase-f-의-후속-글" class="level2" data-number="9">
<h2 data-number="9" class="anchored" data-anchor-id="phase-f-의-후속-글"><span class="header-section-number">9</span> Phase F 의 후속 글</h2>
<ul>
<li>F22-1: Direct + Indirect Connections — 6 사례 의 mechanism 디테일</li>
<li>F22-2: Practical Solutions + Ecosystem Value — rule-of-thumb 구현 패턴</li>
<li>F22-3: Isolation + Edge-Level + Detection — 4 isolation 의 trade-off</li>
</ul>
</section>
<section id="관련-주제" class="level2" data-number="10">
<h2 data-number="10" class="anchored" data-anchor-id="관련-주제"><span class="header-section-number">10</span> 관련 주제</h2>
<ul>
<li><strong>Ch.14 Randomization Unit</strong> (F-KOH14): user vs page vs cluster</li>
<li><strong>Ch.15 Ramping</strong> (F-KOH15): ramp 가 leakage 의 1 차 방어</li>
<li><strong>Ch.18 Variance</strong> (F-KOH18): isolation 의 sample size 손실 보완</li>
<li><strong>Ch.21 SRM</strong> (F-KOH21): isolation 후 SRM 점검 의무</li>
<li><strong>D-18 (시간 변동)</strong>: time-based randomization 와 친척</li>
<li><strong>J-SWITCH</strong> (Phase J): switchback design 은 time-based 의 일반화</li>
</ul>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
출처
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li>Kohavi, Tang, Xu (2020). <em>Trustworthy Online Controlled Experiments.</em> Cambridge University Press. Ch.22 (Leakage and Interference between Variants).</li>
<li>Imbens &amp; Rubin (2015). <em>Causal Inference for Statistics, Social, and Biomedical Sciences.</em></li>
<li>Eckles, Karrer, Ugander (2017). “Design and Analysis of Experiments in Networks.” <em>Journal of Causal Inference.</em></li>
<li>Holtz (2018). “Limiting Bias from Test-Control Interference In Online Marketplace Experiments.” MIT Thesis.</li>
<li>Saint-Jacques et al.&nbsp;(2018). LinkedIn ego-centric randomization.</li>
<li>Vaver and Koehler (2011, 2012). Geo-based experiments.</li>
<li>Bojinov and Shephard (2017). Time series experiments.</li>
</ul>
</div>
</div>


</section>

 ]]></description>
  <category>Experimentation</category>
  <category>A/B Test</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F22-0-leakage-interference-overview.html</guid>
  <pubDate>Fri, 08 May 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Kohavi Ch.22.1~22.2 — Direct·Indirect Connection 6 사례 의 leakage 메커니즘</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F22-1-direct-indirect-connections.html</link>
  <description><![CDATA[ 





<section id="정의" class="level2" data-number="1">
<h2 data-number="1" class="anchored" data-anchor-id="정의"><span class="header-section-number">1</span> 정의</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
정의: Connection (연결) 의 두 갈래
</div>
</div>
<div class="callout-body-container callout-body">
<p>A/B 실험 의 leakage 는 <em>매개체 (medium)</em> 를 통해 발생. 매개체 의 가시성에 따라 2 갈래 (Kohavi, Tang, Xu, 2020, Ch.22).</p>
<ul>
<li><strong>Direct connection</strong>: 두 unit 이 <em>명시적 graph</em> 로 연결. friendship, 통신, 같은 공간 같은 시간.</li>
<li><strong>Indirect connection</strong>: 두 unit 이 <em>latent variable</em> 또는 <em>shared resource</em> 로 연결. inventory, budget, training data, CPU, 시스템 상태.</li>
</ul>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관
</div>
</div>
<div class="callout-body-container callout-body">
<p>direct connection 은 <em>눈에 보이는 매개체</em> — graph 가 있다. indirect connection 은 <em>숨은 매개체</em> — 시스템 architecture 를 알아야 발견.</p>
<p>레슨: leakage 점검 시 항상 <em>매개체</em> 를 식별. 매개체 가 graph 라면 cluster·ego, 자원 이라면 split, 시간이라면 time-based, 사용자라면 unit 변경.</p>
</div>
</div>
</section>
<section id="direct-connection-사례-2" class="level2" data-number="2">
<h2 data-number="2" class="anchored" data-anchor-id="direct-connection-사례-2"><span class="header-section-number">2</span> Direct Connection — 사례 2</h2>
<section id="facebook-linkedin-사회-engagement" class="level3" data-number="2.1">
<h3 data-number="2.1" class="anchored" data-anchor-id="facebook-linkedin-사회-engagement"><span class="header-section-number">2.1</span> Facebook · LinkedIn (사회 engagement)</h3>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<section id="가정" class="level5" data-number="2.1.0.1">
<h5 data-number="2.1.0.1" class="anchored" data-anchor-id="가정"><span class="header-section-number">2.1.0.1</span> 가정</h5>
<ul>
<li>사용자 의 행동은 <em>사회 neighborhood</em> 의 행동에 영향</li>
<li>새 social engagement feature 의 가치 가 neighbor 사용 확률 에 <em>증가</em></li>
</ul>
</section>
<section id="사례-eckles-karrer-ugander-2017-gui-et-al.-2015" class="level5" data-number="2.1.0.2">
<h5 data-number="2.1.0.2" class="anchored" data-anchor-id="사례-eckles-karrer-ugander-2017-gui-et-al.-2015"><span class="header-section-number">2.1.0.2</span> 사례 (Eckles, Karrer, Ugander 2017; Gui et al.&nbsp;2015)</h5>
<ul>
<li>“video chat 을 친구가 사용하면 나도 사용한다”</li>
<li>“친구가 message 하면 나도 reply 한다”</li>
<li>“친구가 post 하면 나도 post 한다”</li>
</ul>
</section>
<section id="treatment-시나리오" class="level5" data-number="2.1.0.3">
<h5 data-number="2.1.0.3" class="anchored" data-anchor-id="treatment-시나리오"><span class="header-section-number">2.1.0.3</span> Treatment 시나리오</h5>
<ul>
<li>LinkedIn “People You May Know” algorithm 개선 (Treatment)</li>
<li>Treatment 사용자 의 invitation 발송 증가</li>
<li><em>Control</em> 사용자 가 invitation 받음 → Control 도 connection·메시지 증가</li>
<li>측정: total invitation·message 의 delta 가 <em>underestimate</em></li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 전파 의 비대칭
</div>
</div>
<div class="callout-body-container callout-body">
<p>Treatment effect 가 Control 로 <em>전파</em> 되는 것: bias 가 <em>underestimate</em> 인 이유.</p>
<pre><code>세계 1 (실험):
  Treatment delta = (T 효과) - (Control 의 baseline + spillover from T)
  = (T 효과) - (baseline + α·T 효과)
  = (1-α) · T 효과
  여기서 α 는 spillover 비율 (0 &lt; α &lt; 1)

세계 2 (full launch):
  실제 효과 = T 효과 (전부 Treatment)

→ 실험 측정 &lt; 실제 효과 (1-α 배 underestimate)</code></pre>
<p>α 의 크기는 <em>graph 의 dense</em> 와 <em>engagement 강도</em> 에 의존.</p>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
측정 신호
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li>직접 spillover 측정: response metric (받은 메시지·invitation 의 reply rate)</li>
<li>Bing/LinkedIn 의 historical data: spillover multiplier (메시지 1 건 → ecosystem value 0.5~0.7)</li>
</ul>
<section id="그림-22.1-kohavi-본문" class="level5" data-number="2.1.0.4">
<h5 data-number="2.1.0.4" class="anchored" data-anchor-id="그림-22.1-kohavi-본문"><span class="header-section-number">2.1.0.4</span> 그림 22.1 (Kohavi 본문)</h5>
<p>Treatment users send more messages → Control users receive → reply → Control metric (messages sent) 도 증가.</p>
</section>
</div>
</div>
</section>
<section id="skype-calls-양방향-통신" class="level3" data-number="2.2">
<h3 data-number="2.2" class="anchored" data-anchor-id="skype-calls-양방향-통신"><span class="header-section-number">2.2</span> Skype Calls (양방향 통신)</h3>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<section id="가정-1" class="level5" data-number="2.2.0.1">
<h5 data-number="2.2.0.1" class="anchored" data-anchor-id="가정-1"><span class="header-section-number">2.2.0.1</span> 가정</h5>
<ul>
<li>모든 call 은 <em>2 명 이상</em> 참여 — 본질적 direct connection</li>
<li>call 품질 개선 → call 빈도 증가</li>
</ul>
</section>
<section id="treatment-시나리오-1" class="level5" data-number="2.2.0.2">
<h5 data-number="2.2.0.2" class="anchored" data-anchor-id="treatment-시나리오-1"><span class="header-section-number">2.2.0.2</span> Treatment 시나리오</h5>
<ul>
<li>Skype 가 call 품질 개선 (Treatment)</li>
<li>Treatment 사용자 call 발신 증가</li>
<li>발신 의 일부 가 <em>Control 친구</em> 에게 → Control 도 call 받음·answer</li>
<li>Control 의 call 빈도 증가 (특히 callback)</li>
<li>측정: total call 의 delta 가 <em>underestimate</em></li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 비대칭 매개체
</div>
</div>
<div class="callout-body-container callout-body">
<p>Skype 는 <em>항상 양방향</em>. message 는 비대칭 가능 (broadcast post 는 일방).</p>
<table class="table">
<thead>
<tr class="header">
<th>매개체 type</th>
<th>예시</th>
<th>spillover 강도</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>양방향 (synchronous)</td>
<td>call, video chat</td>
<td>매우 강</td>
</tr>
<tr class="even">
<td>양방향 (async)</td>
<td>message, reply</td>
<td>강</td>
</tr>
<tr class="odd">
<td>비대칭 broadcast</td>
<td>post, like, share</td>
<td>중간</td>
</tr>
<tr class="even">
<td>비대칭 publish-only</td>
<td>news feed view</td>
<td>약</td>
</tr>
</tbody>
</table>
<p>레슨: 매개체 가 양방향 일수록 spillover 강함 → underestimate 큼.</p>
</div>
</div>
</section>
</section>
<section id="indirect-connection-사례-6" class="level2" data-number="3">
<h2 data-number="3" class="anchored" data-anchor-id="indirect-connection-사례-6"><span class="header-section-number">3</span> Indirect Connection — 사례 6</h2>
<section id="airbnb-marketplace-재고" class="level3" data-number="3.1">
<h3 data-number="3.1" class="anchored" data-anchor-id="airbnb-marketplace-재고"><span class="header-section-number">3.1</span> Airbnb (Marketplace 재고)</h3>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<section id="가정-2" class="level5" data-number="3.1.0.1">
<h5 data-number="3.1.0.1" class="anchored" data-anchor-id="가정-2"><span class="header-section-number">3.1.0.1</span> 가정</h5>
<ul>
<li>동일 inventory 가 Treatment·Control 사이 공유</li>
<li>conversion 개선 시 booking 증가 → inventory 감소 → 다른 group 의 booking 도 감소</li>
</ul>
</section>
<section id="treatment-시나리오-holtz-2018" class="level5" data-number="3.1.0.2">
<h5 data-number="3.1.0.2" class="anchored" data-anchor-id="treatment-시나리오-holtz-2018"><span class="header-section-number">3.1.0.2</span> Treatment 시나리오 (Holtz 2018)</h5>
<ul>
<li>Airbnb 가 conversion flow 개선 (Treatment 만)</li>
<li>Treatment 사용자 의 booking +5%</li>
<li>동일 inventory → Control 사용자 가 볼 inventory 감소</li>
<li>Control 의 booking -2% (inventory 부족 으로)</li>
<li>측정: delta = Treatment booking - Control booking → <em>overestimate</em></li>
</ul>
</section>
<section id="수식" class="level5" data-number="3.1.0.3">
<h5 data-number="3.1.0.3" class="anchored" data-anchor-id="수식"><span class="header-section-number">3.1.0.3</span> 수식</h5>
<pre><code>True effect (full launch):
  All users T → 모두 +5% conversion → inventory 도 더 빠르게 소진
  실제 booking 의 ceiling = inventory cap

실험 측정:
  Treatment booking: +5%
  Control booking: -2% (inventory contention)
  delta: 7% (실제는 5% 미만)</code></pre>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 자원 경쟁 의 zero-sum
</div>
</div>
<div class="callout-body-container callout-body">
<p>marketplace 의 inventory 는 <em>zero-sum</em>. T 가 차지 = C 가 잃음. delta 는 자동으로 <em>overestimate</em> (T 의 +x, C 의 -y, 합쳐서 (x+y) 의 큰 delta).</p>
<p>특히 <em>공급 제약 marketplace</em> (Airbnb, Uber, eBay) 에서 가장 심각.</p>
</div>
</div>
</section>
<section id="uberlyft-양면-시장" class="level3" data-number="3.2">
<h3 data-number="3.2" class="anchored" data-anchor-id="uberlyft-양면-시장"><span class="header-section-number">3.2</span> Uber·Lyft (양면 시장)</h3>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<section id="가정-chamandy-2016" class="level5" data-number="3.2.0.1">
<h5 data-number="3.2.0.1" class="anchored" data-anchor-id="가정-chamandy-2016"><span class="header-section-number">3.2.0.1</span> 가정 (Chamandy 2016)</h5>
<ul>
<li>driver 의 supply 는 <em>고정</em> (단기)</li>
<li>rider 의 demand 가 변하면 가격·대기 시간 도 변함</li>
</ul>
</section>
<section id="treatment-시나리오-2" class="level5" data-number="3.2.0.2">
<h5 data-number="3.2.0.2" class="anchored" data-anchor-id="treatment-시나리오-2"><span class="header-section-number">3.2.0.2</span> Treatment 시나리오</h5>
<ul>
<li>Uber 의 새 “surge price” 알고리즘 (Treatment)</li>
<li>Treatment rider 의 ride opt-in 증가</li>
<li>동일 driver 풀 → driver utilization 증가 → 가격 상승</li>
<li><em>Control</em> rider 도 같은 가격 상승 → Control 의 ride 감소</li>
<li>측정: delta <em>overestimate</em></li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 가격 의 spillover
</div>
</div>
<div class="callout-body-container callout-body">
<p>이건 일반 마켓플레이스와 다르다. <em>가격</em> 자체가 spillover medium.</p>
<ul>
<li>Treatment 의 demand 증가 → 가격 ↑</li>
<li>가격 은 <em>모든 사용자</em> 에게 적용 → Control 도 영향</li>
<li>Treatment 의 effect 가 Control 의 행동 을 <em>변화</em></li>
</ul>
</div>
</div>
</section>
<section id="ebay-auction" class="level3" data-number="3.3">
<h3 data-number="3.3" class="anchored" data-anchor-id="ebay-auction"><span class="header-section-number">3.3</span> eBay (Auction)</h3>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism (Blake and Coey 2014)
</div>
</div>
<div class="callout-body-container callout-body">
<section id="가정-3" class="level5" data-number="3.3.0.1">
<h5 data-number="3.3.0.1" class="anchored" data-anchor-id="가정-3"><span class="header-section-number">3.3.0.1</span> 가정</h5>
<ul>
<li>동일 item 의 입찰 자 들이 경쟁</li>
<li>bidding 의 한계 가 다음 입찰 의 reserve</li>
</ul>
</section>
<section id="treatment-시나리오-3" class="level5" data-number="3.3.0.2">
<h5 data-number="3.3.0.2" class="anchored" data-anchor-id="treatment-시나리오-3"><span class="header-section-number">3.3.0.2</span> Treatment 시나리오</h5>
<ul>
<li>Treatment 가 buyer 의 bidding 을 촉진 (rebate, promotion)</li>
<li>Treatment 의 bid 가 더 높음 → winning bid 가 증가</li>
<li><em>Control</em> 의 winning 확률 <em>감소</em> (T 가 우선)</li>
<li>측정: total transaction 의 delta <em>overestimate</em></li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 경쟁 의 zero-sum (Auction 버전)
</div>
</div>
<div class="callout-body-container callout-body">
<p>inventory 와 비슷. 하나 의 item 에 대해 winning 가 <em>경쟁</em> — Treatment win 증가 ⇒ Control win 감소.</p>
<p>수식:</p>
<pre><code>P(C wins) = P(C bid &gt; all others)
         = P(C bid &gt; max(T bids))
T bid 분포 가 우 측으로 이동 → P(C wins) 감소</code></pre>
</div>
</div>
</section>
<section id="ad-campaign-공유-budget" class="level3" data-number="3.4">
<h3 data-number="3.4" class="anchored" data-anchor-id="ad-campaign-공유-budget"><span class="header-section-number">3.4</span> Ad Campaign (공유 budget)</h3>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism (Blake and Coey 2014; Kohavi et al.&nbsp;2009)
</div>
</div>
<div class="callout-body-container callout-body">
<section id="가정-4" class="level5" data-number="3.4.0.1">
<h5 data-number="3.4.0.1" class="anchored" data-anchor-id="가정-4"><span class="header-section-number">3.4.0.1</span> 가정</h5>
<ul>
<li>광고 캠페인 은 <em>고정 budget</em> (월 / 분기)</li>
<li>click 비용 이 누적되어 budget 소진 시 광고 노출 중단</li>
</ul>
</section>
<section id="treatment-시나리오-4" class="level5" data-number="3.4.0.2">
<h5 data-number="3.4.0.2" class="anchored" data-anchor-id="treatment-시나리오-4"><span class="header-section-number">3.4.0.2</span> Treatment 시나리오</h5>
<ul>
<li>Treatment 의 ad ranking 개선</li>
<li>Treatment click 증가 → 공유 budget 빠르게 소진</li>
<li>월말 무렵 <em>Control</em> 광고 노출 감소 → Control click 감소</li>
<li>측정: delta <em>overestimate</em> (월말 효과 강함)</li>
</ul>
</section>
<section id="시간-의존-패턴" class="level5" data-number="3.4.0.3">
<h5 data-number="3.4.0.3" class="anchored" data-anchor-id="시간-의존-패턴"><span class="header-section-number">3.4.0.3</span> 시간 의존 패턴</h5>
<pre><code>Day 1-15: budget 충분 → delta 비교적 정직
Day 16-30: budget 소진 → Control 의 노출 ↓ → delta 폭증</code></pre>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 시간 의존 leakage
</div>
</div>
<div class="callout-body-container callout-body">
<p>이 leakage 는 <em>시간 에 따라 강도 가 변함</em>. budget 소진 까지 의 시간 에 leakage 약함, 이후 강함.</p>
<p>레슨: ad campaign 실험 의 보고 시 <em>기간 별 split</em> 으로 leakage 진행 점검. 실무 해결책: <em>budget split</em> — variant traffic 비율과 동일하게 budget 할당.</p>
</div>
</div>
</section>
<section id="relevance-model-공유-학습-데이터" class="level3" data-number="3.5">
<h3 data-number="3.5" class="anchored" data-anchor-id="relevance-model-공유-학습-데이터"><span class="header-section-number">3.5</span> Relevance Model (공유 학습 데이터)</h3>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<section id="가정-5" class="level5" data-number="3.5.0.1">
<h5 data-number="3.5.0.1" class="anchored" data-anchor-id="가정-5"><span class="header-section-number">3.5.0.1</span> 가정</h5>
<ul>
<li>relevance model 이 user click 데이터 로 학습 (continuous training)</li>
<li>Treatment·Control 모두 의 click 데이터 가 <em>공유</em> 학습 데이터 풀 에 합류</li>
</ul>
</section>
<section id="treatment-시나리오-5" class="level5" data-number="3.5.0.2">
<h5 data-number="3.5.0.2" class="anchored" data-anchor-id="treatment-시나리오-5"><span class="header-section-number">3.5.0.2</span> Treatment 시나리오</h5>
<ul>
<li>Treatment model 이 better click prediction (예: target.com 을 “shoes” 검색 의 1 위로)</li>
<li>Treatment user 의 click 이 더 <em>informative</em> (model 이 학습 가능한 양질 데이터)</li>
<li>다음 학습 round → <em>Control</em> model 도 같은 양질 데이터 반영</li>
<li>시간이 지날수록 Control 의 ranking 도 개선</li>
<li>측정: 시간 흐를수록 delta <em>underestimate</em></li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 학습 의 cross-contamination
</div>
</div>
<div class="callout-body-container callout-body">
<p>이 leakage 는 <em>시간 dependence</em> 가 가장 강함. 실험 초기 → bias 작음, 실험 후기 → bias 큼 (학습 누적).</p>
<p>해결: variant 별 <em>분리 학습</em> — Treatment data 는 Treatment model 만, Control data 는 Control model 만. 단점: training data 가 절반 으로 → 작은 model 의 성능 저하.</p>
</div>
</div>
</section>
<section id="cpu-contention-공유-hardware" class="level3" data-number="3.6">
<h3 data-number="3.6" class="anchored" data-anchor-id="cpu-contention-공유-hardware"><span class="header-section-number">3.6</span> CPU Contention (공유 hardware)</h3>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<section id="가정-6" class="level5" data-number="3.6.0.1">
<h5 data-number="3.6.0.1" class="anchored" data-anchor-id="가정-6"><span class="header-section-number">3.6.0.1</span> 가정</h5>
<ul>
<li>Treatment·Control 의 request 가 <em>동일 server</em> 에서 처리</li>
<li>Treatment 의 bug 또는 새 feature 가 CPU 점유 가 큼</li>
</ul>
</section>
<section id="treatment-시나리오-6" class="level5" data-number="3.6.0.2">
<h5 data-number="3.6.0.2" class="anchored" data-anchor-id="treatment-시나리오-6"><span class="header-section-number">3.6.0.2</span> Treatment 시나리오</h5>
<ul>
<li>Treatment 의 새 feature 가 CPU·memory 점유 증가</li>
<li>같은 machine 의 <em>Control</em> request 의 응답 도 늦어짐</li>
<li>Control 의 latency <em>악화</em></li>
<li>측정: delta (Treatment latency - Control latency) <em>underestimate</em> (의 부정 효과)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 의식하지 못하는 leakage
</div>
</div>
<div class="callout-body-container callout-body">
<p>이건 가장 <em>위험</em> — code 에 명시적 dependency 가 없는데 leakage. shared infrastructure 는 모든 곳에 있다 (cache, rate limiter, log pipeline, …).</p>
<p>해결: ramp 단계 (small datacenter → 1% → 10%) 에서 outlier 탐지 + monitoring. 실무: Treatment·Control 의 server 분리 (단, heterogeneity confounding 위험).</p>
</div>
</div>
</section>
<section id="sub-user-experiment-unit-page-level-randomization" class="level3" data-number="3.7">
<h3 data-number="3.7" class="anchored" data-anchor-id="sub-user-experiment-unit-page-level-randomization"><span class="header-section-number">3.7</span> Sub-User Experiment Unit (page-level randomization)</h3>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<section id="가정-7" class="level5" data-number="3.7.0.1">
<h5 data-number="3.7.0.1" class="anchored" data-anchor-id="가정-7"><span class="header-section-number">3.7.0.1</span> 가정</h5>
<ul>
<li>일반적으로 user-level randomization 이 표준</li>
<li>일부 실험 은 page·session·query 단위 randomization (smaller unit, more sample)</li>
</ul>
</section>
<section id="treatment-시나리오-7" class="level5" data-number="3.7.0.2">
<h5 data-number="3.7.0.2" class="anchored" data-anchor-id="treatment-시나리오-7"><span class="header-section-number">3.7.0.2</span> Treatment 시나리오</h5>
<ul>
<li>Treatment 가 page latency 개선</li>
<li>같은 user 가 <em>page 마다 다른 variant</em> 경험 (mixed experience)</li>
<li>빠른 page 후 느린 page 시 — 행동 이 <em>학습 효과</em> 로 변화 (anchoring)</li>
<li>Treatment effect 가 Control page 에 spillover</li>
</ul>
</section>
<section id="latent-connection" class="level5" data-number="3.7.0.3">
<h5 data-number="3.7.0.3" class="anchored" data-anchor-id="latent-connection"><span class="header-section-number">3.7.0.3</span> latent connection</h5>
<ul>
<li>매개체: <em>동일 사용자</em> — Treatment·Control page 모두 한 사람의 경험</li>
<li>사용자 의 학습·기억·기대 가 매개</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: smaller unit 의 hidden cost
</div>
</div>
<div class="callout-body-container callout-body">
<p>작은 unit 으로 randomize 하면 <em>sample 증가</em> → power ↑. 하지만 <em>user-level learning effect</em> 가 있으면 spillover.</p>
<p>규칙: smaller unit 으로 갈수록 <em>learning effect 가 없음을 가정</em> — 가정 점검 필수. 대부분 의 <em>user-facing UI</em> 변화 는 user-level 이 안전.</p>
</div>
</div>
</section>
</section>
<section id="비교" class="level2" data-number="4">
<h2 data-number="4" class="anchored" data-anchor-id="비교"><span class="header-section-number">4</span> 비교</h2>
<table class="table">
<colgroup>
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
</colgroup>
<thead>
<tr class="header">
<th>사례</th>
<th>매개체</th>
<th>bias 방향</th>
<th>bias 강도</th>
<th>시간 의존</th>
<th>해결 패턴</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Facebook 메시지</td>
<td>친구 graph</td>
<td>underestimate</td>
<td>중간</td>
<td>약</td>
<td>network-cluster, ego-centric</td>
</tr>
<tr class="even">
<td>Skype call</td>
<td>통신 양방향</td>
<td>underestimate</td>
<td>강</td>
<td>약</td>
<td>network-cluster</td>
</tr>
<tr class="odd">
<td>Airbnb 재고</td>
<td>inventory</td>
<td>overestimate</td>
<td>강</td>
<td>중간</td>
<td>geo, time</td>
</tr>
<tr class="even">
<td>Uber surge</td>
<td>가격·driver</td>
<td>overestimate</td>
<td>강</td>
<td>중간</td>
<td>geo, time</td>
</tr>
<tr class="odd">
<td>eBay auction</td>
<td>item</td>
<td>overestimate</td>
<td>중간</td>
<td>약</td>
<td>geo</td>
</tr>
<tr class="even">
<td>Ad budget</td>
<td>공유 budget</td>
<td>overestimate</td>
<td>강</td>
<td>강 (월말)</td>
<td>budget split</td>
</tr>
<tr class="odd">
<td>Relevance model</td>
<td>학습 data</td>
<td>underestimate</td>
<td>강</td>
<td>강 (누적)</td>
<td>model split</td>
</tr>
<tr class="even">
<td>CPU contention</td>
<td>hardware</td>
<td>underestimate (의 -)</td>
<td>변동</td>
<td>약</td>
<td>server split, monitoring</td>
</tr>
<tr class="odd">
<td>Sub-user unit</td>
<td>사용자 학습</td>
<td>underestimate</td>
<td>약~중</td>
<td>약</td>
<td>user-level fallback</td>
</tr>
</tbody>
</table>
</section>
<section id="python-예시-leakage-정도-시뮬레이션" class="level2" data-number="5">
<h2 data-number="5" class="anchored" data-anchor-id="python-예시-leakage-정도-시뮬레이션"><span class="header-section-number">5</span> Python 예시 — leakage 정도 시뮬레이션</h2>
<div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb5-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb5-2"></span>
<span id="cb5-3">np.random.seed(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2026</span>)</span>
<span id="cb5-4"></span>
<span id="cb5-5"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> simulate_social_spillover(n_users<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20000</span>, alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.3</span>, true_lift<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.10</span>):</span>
<span id="cb5-6">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">"""</span></span>
<span id="cb5-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    direct connection 의 spillover model.</span></span>
<span id="cb5-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    alpha: T → C 전파 비율 (0 &lt; alpha &lt; 1).</span></span>
<span id="cb5-9"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    true_lift: T 의 진짜 lift.</span></span>
<span id="cb5-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    """</span></span>
<span id="cb5-11">    assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.randint(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>n_users)</span>
<span id="cb5-12">    base_p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.20</span></span>
<span id="cb5-13"></span>
<span id="cb5-14">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Treatment: 진짜 lift 적용</span></span>
<span id="cb5-15">    p_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> base_p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> true_lift)</span>
<span id="cb5-16">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Control: spillover 받음 (Treatment 의 alpha 배 effect)</span></span>
<span id="cb5-17">    p_c <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> base_p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> true_lift)</span>
<span id="cb5-18"></span>
<span id="cb5-19">    p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.where(assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, p_t, p_c)</span>
<span id="cb5-20">    y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.binomial(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, p, size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>n_users)</span>
<span id="cb5-21"></span>
<span id="cb5-22">    rate_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> y[assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>].mean()</span>
<span id="cb5-23">    rate_c <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> y[assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>].mean()</span>
<span id="cb5-24">    observed_lift <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (rate_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> rate_c) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> rate_c</span>
<span id="cb5-25">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> rate_t, rate_c, observed_lift</span>
<span id="cb5-26"></span>
<span id="cb5-27"><span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">for</span> alpha <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">in</span> [<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.8</span>]:</span>
<span id="cb5-28">    rate_t, rate_c, obs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> simulate_social_spillover(alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>alpha)</span>
<span id="cb5-29">    <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"alpha=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>alpha<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.1f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">: T=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>rate_t<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, C=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>rate_c<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, "</span></span>
<span id="cb5-30">          <span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"obs_lift=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>obs<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.2%}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, true_lift=10.00%, "</span></span>
<span id="cb5-31">          <span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"underestimate_factor=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>alpha)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.1%}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span></code></pre></div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
시뮬레이션 해석
</div>
</div>
<div class="callout-body-container callout-body">
<p>α=0.0: spillover 없음 → 측정 lift ≈ 진짜 10% α=0.5: spillover 절반 → 측정 lift ≈ 5% α=0.8: spillover 강함 → 측정 lift ≈ 2%</p>
<p>직관: spillover 비율 α 만큼 측정 효과 가 (1-α) 배 <em>축소</em> — direct connection 의 typical underestimate.</p>
</div>
</div>
</section>
<section id="응용-진단-체크리스트" class="level2" data-number="6">
<h2 data-number="6" class="anchored" data-anchor-id="응용-진단-체크리스트"><span class="header-section-number">6</span> 응용 / 진단 체크리스트</h2>
<ul>
<li>매개체 식별: 코드·architecture·graph·자원·시간·사용자 unit</li>
<li>bias 방향 추정: 매개체 가 zero-sum 자원 → over, positive externality → under</li>
<li>시간 의존 패턴 점검: budget·learning 은 강한 시간 의존</li>
<li>ramp 의 outlier 탐지 (small datacenter, 1% → 50% 비교)</li>
<li>의심 시 isolation 적용 — F22-3 의 4 갈래 중 매개체 에 맞는 것</li>
</ul>
</section>
<section id="관련-주제" class="level2" data-number="7">
<h2 data-number="7" class="anchored" data-anchor-id="관련-주제"><span class="header-section-number">7</span> 관련 주제</h2>
<ul>
<li>F22-0 overview — Ch.22 전체 지도</li>
<li>F22-2 — Practical Solutions + Ecosystem Value</li>
<li>F22-3 — Isolation 4 갈래 + edge-level + monitoring</li>
<li>Ch.14 (F-KOH14) — Randomization unit 의 trade-off (smaller unit 의 leakage 위험)</li>
<li>D-18 — Time-varying treatment (time-based randomization 의 친척)</li>
</ul>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
출처
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li>Kohavi, Tang, Xu (2020). <em>Trustworthy Online Controlled Experiments.</em> Ch.22.</li>
<li>Eckles, Karrer, Ugander (2017). “Design and Analysis of Experiments in Networks.”</li>
<li>Gui, Xu, Bhasin, Han (2015). “Network A/B Testing.” WWW 2015.</li>
<li>Chamandy (2016). “Experimentation in a Ridesharing Marketplace.” Lyft Engineering.</li>
<li>Blake and Coey (2014). “Why Marketplace Experimentation is Harder.” EC 2014.</li>
<li>Holtz (2018). “Limiting Bias from Test-Control Interference.” MIT Thesis.</li>
<li>Kohavi, Longbotham et al.&nbsp;(2009). “Seven Pitfalls.”</li>
<li>Barrilleaux and Wang (2018). “Spreading the Love in the LinkedIn Feed.”</li>
</ul>
</div>
</div>


</section>

 ]]></description>
  <category>Experimentation</category>
  <category>A/B Test</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F22-1-direct-indirect-connections.html</guid>
  <pubDate>Fri, 08 May 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Kohavi Ch.22.3 — Rule-of-Thumb · Ecosystem Value · Practical Solutions</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F22-2-practical-solutions-ecosystem-value.html</link>
  <description><![CDATA[ 





<section id="정의" class="level2" data-number="1">
<h2 data-number="1" class="anchored" data-anchor-id="정의"><span class="header-section-number">1</span> 정의</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
정의: Rule-of-Thumb (Ecosystem Value of an Action)
</div>
</div>
<div class="callout-body-container callout-body">
<p>leakage 가 의심되는 action 의 <em>downstream impact</em> 를 사전 calibration 한 multiplier 로 보정 (Kohavi, Tang, Xu, 2020, Ch.22; Tutterow and Saint-Jacques 2019).</p>
<section id="형식적-표현" class="level5" data-number="1.0.0.1">
<h5 data-number="1.0.0.1" class="anchored" data-anchor-id="형식적-표현"><span class="header-section-number">1.0.0.1</span> 형식적 표현</h5>
<p>특정 action <img src="https://latex.codecogs.com/png.latex?a"> (예: 메시지 보냄) 의 <em>총 효과</em> = 1 차 + downstream:</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Ctext%7BTotalValue%7D(a)%20=%20%5Ctext%7BDirect%7D(a)%20+%20%5Csum_j%20m_%7Ba%20%5Cto%20j%7D%20%5Ccdot%20%5Ctext%7BDown%7D_j(a)"></p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?m_%7Ba%20%5Cto%20j%7D">: action <img src="https://latex.codecogs.com/png.latex?a"> 가 downstream metric <img src="https://latex.codecogs.com/png.latex?j"> 에 끼치는 multiplier (historical experiment 들 로 calibrated)</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Ctext%7BDown%7D_j(a)">: <img src="https://latex.codecogs.com/png.latex?a"> 발생 시 metric <img src="https://latex.codecogs.com/png.latex?j"> 의 응답 expectation</li>
</ul>
</section>
<section id="분석-절차" class="level5" data-number="1.0.0.2">
<h5 data-number="1.0.0.2" class="anchored" data-anchor-id="분석-절차"><span class="header-section-number">1.0.0.2</span> 분석 절차</h5>
<ol type="1">
<li>action <img src="https://latex.codecogs.com/png.latex?a"> 의 1 차 metric (예: messages sent) delta 측정</li>
<li>downstream metrics (replies, sessions, retention) delta 측정</li>
<li><em>pre-calibrated</em> multipliers <img src="https://latex.codecogs.com/png.latex?m"> 적용</li>
<li>ecosystem-corrected delta 계산</li>
</ol>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관
</div>
</div>
<div class="callout-body-container callout-body">
<p>Rule-of-thumb 의 사고:</p>
<ul>
<li>Bernoulli randomization 은 sample 크고 power 좋음 — 포기 하기 아쉽다</li>
<li>하지만 leakage 로 인해 1 차 metric 의 delta 만 보면 underestimate</li>
<li>해결: <em>downstream metric 도 같이 측정</em> + historical multiplier 로 보정</li>
</ul>
<p>비유: 사진 찍을 때 <em>직접 빛</em> 만 보지 말고 <em>반사 빛</em> 도 함께 측정. 두 빛을 알면 진짜 풍경 의 밝기 를 추정 가능.</p>
</div>
</div>
</section>
<section id="왜-필요한가" class="level2" data-number="2">
<h2 data-number="2" class="anchored" data-anchor-id="왜-필요한가"><span class="header-section-number">2</span> 왜 필요한가</h2>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
다른 isolation 방식 의 한계
</div>
</div>
<div class="callout-body-container callout-body">
<table class="table">
<colgroup>
<col style="width: 50%">
<col style="width: 50%">
</colgroup>
<thead>
<tr class="header">
<th>방식</th>
<th>한계</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Splitting resources</td>
<td>shared machines, training data 의 일부만 적용 가능</td>
</tr>
<tr class="even">
<td>Geo-based</td>
<td>sample size 가 지역 수 로 제한 → variance 증가</td>
</tr>
<tr class="odd">
<td>Time-based</td>
<td>시간 효과 강해 적용 어려움</td>
</tr>
<tr class="even">
<td>Network-cluster</td>
<td>dense graph 에서 isolation 불완전</td>
</tr>
<tr class="odd">
<td>Ego-centric</td>
<td>구현 복잡, ego/alter 분리 필요</td>
</tr>
</tbody>
</table>
<section id="bernoulli-의-장점" class="level5" data-number="2.0.0.1">
<h5 data-number="2.0.0.1" class="anchored" data-anchor-id="bernoulli-의-장점"><span class="header-section-number">2.0.0.1</span> Bernoulli 의 장점</h5>
<ul>
<li>sample size 최대 (모든 사용자 단위)</li>
<li>구현 단순 (기존 randomization 재사용)</li>
<li>power 좋음</li>
</ul>
</section>
<section id="rule-of-thumb-의-위치" class="level5" data-number="2.0.0.2">
<h5 data-number="2.0.0.2" class="anchored" data-anchor-id="rule-of-thumb-의-위치"><span class="header-section-number">2.0.0.2</span> Rule-of-thumb 의 위치</h5>
<p>Bernoulli 유지 + post-hoc downstream 보정 = sample size 최대 + leakage 부분 보정. 실험 의 <em>대부분</em> 에 적용 가능.</p>
</section>
</div>
</div>
</section>
<section id="차-vs-downstream-metric" class="level2" data-number="3">
<h2 data-number="3" class="anchored" data-anchor-id="차-vs-downstream-metric"><span class="header-section-number">3</span> 1차 vs Downstream Metric</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
정의
</div>
</div>
<div class="callout-body-container callout-body">
<section id="차-metric-first-order-action" class="level5" data-number="3.0.0.1">
<h5 data-number="3.0.0.1" class="anchored" data-anchor-id="차-metric-first-order-action"><span class="header-section-number">3.0.0.1</span> 1 차 metric (first-order action)</h5>
<ul>
<li>사용자 가 <em>직접</em> 수행하는 action</li>
<li>예: 메시지 보냄, post 함, like 함, invitation 보냄</li>
</ul>
</section>
<section id="downstream-metric" class="level5" data-number="3.0.0.2">
<h5 data-number="3.0.0.2" class="anchored" data-anchor-id="downstream-metric"><span class="header-section-number">3.0.0.2</span> Downstream metric</h5>
<ul>
<li>1 차 action 에 <em>반응</em> 하는 metric</li>
<li>예: 받은 메시지 의 reply, post 의 like·comment, invitation 의 accept</li>
</ul>
</section>
<section id="linkedin-의-사례-barrilleaux-and-wang-2018" class="level5" data-number="3.0.0.3">
<h5 data-number="3.0.0.3" class="anchored" data-anchor-id="linkedin-의-사례-barrilleaux-and-wang-2018"><span class="header-section-number">3.0.0.3</span> LinkedIn 의 사례 (Barrilleaux and Wang 2018)</h5>
<table class="table">
<thead>
<tr class="header">
<th>1 차 action</th>
<th>Downstream metric</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Total messages sent</td>
<td>Total messages responded to</td>
</tr>
<tr class="even">
<td>Total posts created</td>
<td>Total likes / comments received</td>
</tr>
<tr class="odd">
<td>Total likes / comments given</td>
<td>Total creators receiving these</td>
</tr>
</tbody>
</table>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: depth · breadth 의 측정
</div>
</div>
<div class="callout-body-container callout-body">
<p>downstream metric 은 <em>2 차 wave</em> 측정.</p>
<ul>
<li>Depth: 1 명의 친구 가 몇 번 응답 하는가</li>
<li>Breadth: 응답 한 친구 가 몇 명인가</li>
<li>두 axis 의 곱 → ecosystem 영향 의 총량</li>
</ul>
<p>레슨: downstream metric 의 delta 가 <em>0 인 실험</em> 은 leakage 우려 가 <em>없음</em> (다음 ecosystem multiplier 작용 안 함). delta 가 큰 실험 만 보정 필요.</p>
</div>
</div>
</section>
<section id="ecosystem-multiplier-추정-instrumental-variable-접근" class="level2" data-number="4">
<h2 data-number="4" class="anchored" data-anchor-id="ecosystem-multiplier-추정-instrumental-variable-접근"><span class="header-section-number">4</span> Ecosystem Multiplier 추정 — Instrumental Variable 접근</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism (Tutterow and Saint-Jacques 2019)
</div>
</div>
<div class="callout-body-container callout-body">
<section id="iv-의-사고" class="level5" data-number="4.0.0.1">
<h5 data-number="4.0.0.1" class="anchored" data-anchor-id="iv-의-사고"><span class="header-section-number">4.0.0.1</span> IV 의 사고</h5>
<p>historical experiment <img src="https://latex.codecogs.com/png.latex?e"> 들 의 데이터 — 각 실험 마다:</p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?%5CDelta%20a_e">: 1 차 action delta</li>
<li><img src="https://latex.codecogs.com/png.latex?%5CDelta%20v_e">: 최종 value (예: long-term engagement, revenue) delta</li>
</ul>
<p>가정: 실험 의 randomization 은 <em>exogenous</em> (다른 confounder 와 무관). 따라서 실험 <img src="https://latex.codecogs.com/png.latex?e"> 가 <em>instrument</em> 역할.</p>
</section>
<section id="multiplier-추정" class="level5" data-number="4.0.0.2">
<h5 data-number="4.0.0.2" class="anchored" data-anchor-id="multiplier-추정"><span class="header-section-number">4.0.0.2</span> Multiplier 추정</h5>
<p><img src="https://latex.codecogs.com/png.latex?m_a%20=%20%5Cfrac%7B%5CDelta%20v%7D%7B%5CDelta%20a%7D%20%5Cquad%20%5Ctext%7B(%EC%8B%A4%ED%97%98%20e%20%EB%93%A4%20%ED%8F%89%EA%B7%A0%20across)%7D"></p>
<p>또는 회귀:</p>
<p><img src="https://latex.codecogs.com/png.latex?%5CDelta%20v_e%20=%20%5Calpha%20+%20m_a%20%5Ccdot%20%5CDelta%20a_e%20+%20%5Cepsilon_e"></p>
</section>
<section id="적용" class="level5" data-number="4.0.0.3">
<h5 data-number="4.0.0.3" class="anchored" data-anchor-id="적용"><span class="header-section-number">4.0.0.3</span> 적용</h5>
<p>새 실험 의 <img src="https://latex.codecogs.com/png.latex?%5CDelta%20a"> 측정 → ecosystem-corrected <img src="https://latex.codecogs.com/png.latex?%5CDelta%20%5Chat%7Bv%7D%20=%20m_a%20%5Ccdot%20%5CDelta%20a">.</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 과거 실험 의 자산화
</div>
</div>
<div class="callout-body-container callout-body">
<p>이 접근 의 가치: 과거 실험 들 이 <em>자산</em> 화 — 한 번 multiplier 만 추정하면 모든 새 실험 에 즉시 활용.</p>
<p>비유: 환율 — 한 번 계산해 둔 (원/달러) 환율로 모든 거래 의 환산 가능.</p>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
적용 예시 (LinkedIn 메시지)
</div>
</div>
<div class="callout-body-container callout-body">
<p>historical experiment 의 20 건 분석:</p>
<ul>
<li>메시지 1 % 증가 → ecosystem 값 (장기 retention) 0.5 % 증가</li>
<li>multiplier <img src="https://latex.codecogs.com/png.latex?m%20%5Capprox%200.5"></li>
</ul>
<p>새 실험 결과:</p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?%5CDelta%20a"> (messages sent) = +3.0%</li>
<li><img src="https://latex.codecogs.com/png.latex?%5CDelta%20v"> (immediate metric) 만 보면 +1.5% (underestimate)</li>
<li>ecosystem-corrected: <img src="https://latex.codecogs.com/png.latex?0.5%20%5Ctimes%203.0%5C%25%20=%201.5%5C%25"> → 실제 +1.5% (이 multiplier 와 일치)</li>
</ul>
<p>이 경우 underestimate 가 <em>명시적 으로</em> 모델링 됨.</p>
</div>
</div>
</section>
<section id="한계" class="level2" data-number="5">
<h2 data-number="5" class="anchored" data-anchor-id="한계"><span class="header-section-number">5</span> 한계</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
4 가지 한계
</div>
</div>
<div class="callout-body-container callout-body">
<section id="multiplier-의-평균-화-rule-of-thumb-의-본질" class="level5" data-number="5.0.0.1">
<h5 data-number="5.0.0.1" class="anchored" data-anchor-id="multiplier-의-평균-화-rule-of-thumb-의-본질"><span class="header-section-number">5.0.0.1</span> 1. Multiplier 의 평균 화 (rule-of-thumb 의 본질)</h5>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?m_a"> 는 historical experiment 들 의 <em>평균</em></li>
<li>특정 새 실험 의 multiplier 가 다를 수 있음 (예: 메시지 의 <em>질</em> 이 다른 경우)</li>
</ul>
</section>
<section id="action-type-별-보정-필요" class="level5" data-number="5.0.0.2">
<h5 data-number="5.0.0.2" class="anchored" data-anchor-id="action-type-별-보정-필요"><span class="header-section-number">5.0.0.2</span> 2. Action type 별 보정 필요</h5>
<ul>
<li>한 multiplier 가 모든 action 에 적용되지 않음</li>
<li>“메시지 보냄” 과 “invitation 보냄” 은 다른 multiplier</li>
<li>action type 마다 historical calibration 필요</li>
</ul>
</section>
<section id="network-구조-의존" class="level5" data-number="5.0.0.3">
<h5 data-number="5.0.0.3" class="anchored" data-anchor-id="network-구조-의존"><span class="header-section-number">5.0.0.3</span> 3. Network 구조 의존</h5>
<ul>
<li>multiplier 는 <em>현재 graph 구조</em> 에 calibrated</li>
<li>graph 가 시간 따라 변하면 multiplier 도 drift</li>
<li>정기 재추정 (예: 분기마다) 필요</li>
</ul>
</section>
<section id="heterogeneity" class="level5" data-number="5.0.0.4">
<h5 data-number="5.0.0.4" class="anchored" data-anchor-id="heterogeneity"><span class="header-section-number">5.0.0.4</span> 4. Heterogeneity</h5>
<ul>
<li>평균 multiplier 가 일부 cohort (예: super-user) 에는 매우 부정확</li>
<li>subgroup 별 multiplier 추정 시 sample 부족</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 평균 의 함정
</div>
</div>
<div class="callout-body-container callout-body">
<p>Rule-of-thumb 의 핵심 가정 은 <em>“새 실험 도 historical 평균 과 비슷”</em>. 가정 깨질 수 있는 상황:</p>
<ul>
<li>새 feature 가 <em>특별히 viral</em> — historical 평균 보다 큰 multiplier</li>
<li>새 feature 가 <em>passive</em> (예: 자동화 메시지) — multiplier 더 작음</li>
<li>target population 이 historical 과 다름 — multiplier 다름</li>
</ul>
<p>레슨: rule-of-thumb 는 <em>근사</em> 도구. 큰 의사결정 (전사 launch) 시 <em>추가 isolation 실험</em> 으로 검증 필요.</p>
</div>
</div>
</section>
<section id="bernoulli-와-의-호환성" class="level2" data-number="6">
<h2 data-number="6" class="anchored" data-anchor-id="bernoulli-와-의-호환성"><span class="header-section-number">6</span> Bernoulli 와 의 호환성</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
호환 매트릭스
</div>
</div>
<div class="callout-body-container callout-body">
<table class="table">
<thead>
<tr class="header">
<th>Approach</th>
<th>sample size</th>
<th>leakage 보정</th>
<th>Bernoulli 호환</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Bernoulli only</td>
<td>최대</td>
<td>없음</td>
<td>yes</td>
</tr>
<tr class="even">
<td>Bernoulli + Rule-of-thumb</td>
<td>최대</td>
<td>부분 (downstream)</td>
<td>yes</td>
</tr>
<tr class="odd">
<td>Geo-based</td>
<td>작음</td>
<td>강</td>
<td>no (지역 단위)</td>
</tr>
<tr class="even">
<td>Network-cluster</td>
<td>작음</td>
<td>강</td>
<td>no (cluster 단위)</td>
</tr>
<tr class="odd">
<td>Ego-centric</td>
<td>중간</td>
<td>강</td>
<td>partial (ego 만 Bernoulli)</td>
</tr>
<tr class="even">
<td>Edge-level</td>
<td>최대</td>
<td>강</td>
<td>yes (post-hoc 분석)</td>
</tr>
</tbody>
</table>
<section id="적용-우선-순위" class="level5" data-number="6.0.0.1">
<h5 data-number="6.0.0.1" class="anchored" data-anchor-id="적용-우선-순위"><span class="header-section-number">6.0.0.1</span> 적용 우선 순위</h5>
<ol type="1">
<li>Bernoulli + Rule-of-thumb: 일반적 leakage 의심 시 1차 시도</li>
<li>Bernoulli + Edge-level: 명시적 edge 가 있는 사회 네트워크</li>
<li>Geo-based: marketplace 의 강한 자원 경쟁</li>
<li>Network-cluster · Ego-centric: 사회 네트워크 의 <em>큰</em> 실험</li>
</ol>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 단순함 의 가치
</div>
</div>
<div class="callout-body-container callout-body">
<p>Rule-of-thumb 는 가장 <em>단순한</em> 보정. 단순 하다 = <em>광범위 적용 가능</em>.</p>
<p>비유: 환율 vs hedging. 환율 (rule-of-thumb) 은 모든 거래에 즉시 적용. hedging (network-cluster) 은 큰 거래에만 적용.</p>
<p>레슨: 일반 실험 의 80% 는 rule-of-thumb 충분. 나머지 20% (경쟁·네트워크 강함) 만 heavy isolation.</p>
</div>
</div>
</section>
<section id="python-시뮬레이션-rule-of-thumb-보정" class="level2" data-number="7">
<h2 data-number="7" class="anchored" data-anchor-id="python-시뮬레이션-rule-of-thumb-보정"><span class="header-section-number">7</span> Python 시뮬레이션 — Rule-of-Thumb 보정</h2>
<div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb1-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb1-2"></span>
<span id="cb1-3">np.random.seed(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2026</span>)</span>
<span id="cb1-4"></span>
<span id="cb1-5"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> simulate_with_spillover_and_correction(</span>
<span id="cb1-6">    n_users<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20000</span>, alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.4</span>, true_lift<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.08</span>, multiplier_prior<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span></span>
<span id="cb1-7">):</span>
<span id="cb1-8">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">"""</span></span>
<span id="cb1-9"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    spillover 가 있는 실험 + downstream metric 측정 + multiplier 보정.</span></span>
<span id="cb1-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    """</span></span>
<span id="cb1-11">    assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.randint(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>n_users)</span>
<span id="cb1-12">    base_p_action <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.30</span></span>
<span id="cb1-13">    base_p_response <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.15</span></span>
<span id="cb1-14"></span>
<span id="cb1-15">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 1차 action (예: messages sent)</span></span>
<span id="cb1-16">    p_action_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> base_p_action <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> true_lift)</span>
<span id="cb1-17">    p_action_c <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> base_p_action <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> true_lift)</span>
<span id="cb1-18">    p_action <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.where(assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, p_action_t, p_action_c)</span>
<span id="cb1-19">    actions <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.binomial(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, p_action, size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>n_users)</span>
<span id="cb1-20"></span>
<span id="cb1-21">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># downstream metric (예: messages responded to)</span></span>
<span id="cb1-22">    p_response_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> base_p_response <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> true_lift)  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># downstream 도 spillover</span></span>
<span id="cb1-23">    p_response_c <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> base_p_response <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> true_lift)</span>
<span id="cb1-24">    p_response <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.where(assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, p_response_t, p_response_c)</span>
<span id="cb1-25">    responses <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.binomial(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, p_response, size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>n_users)</span>
<span id="cb1-26"></span>
<span id="cb1-27">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 1차 delta (raw)</span></span>
<span id="cb1-28">    rate_action_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> actions[assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>].mean()</span>
<span id="cb1-29">    rate_action_c <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> actions[assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>].mean()</span>
<span id="cb1-30">    delta_action <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (rate_action_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> rate_action_c) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> rate_action_c</span>
<span id="cb1-31"></span>
<span id="cb1-32">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># downstream delta</span></span>
<span id="cb1-33">    rate_resp_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> responses[assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>].mean()</span>
<span id="cb1-34">    rate_resp_c <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> responses[assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>].mean()</span>
<span id="cb1-35">    delta_resp <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (rate_resp_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> rate_resp_c) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> rate_resp_c</span>
<span id="cb1-36"></span>
<span id="cb1-37">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># corrected delta = action_delta + multiplier * downstream_delta</span></span>
<span id="cb1-38">    corrected <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> delta_action <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> multiplier_prior <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> delta_resp</span>
<span id="cb1-39"></span>
<span id="cb1-40">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> delta_action, delta_resp, corrected</span>
<span id="cb1-41"></span>
<span id="cb1-42">raw, down, corrected <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> simulate_with_spillover_and_correction()</span>
<span id="cb1-43"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"True lift:                  8.00%"</span>)</span>
<span id="cb1-44"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Raw 1차 delta (biased):     </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>raw<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.2%}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb1-45"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Downstream delta:           </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>down<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.2%}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb1-46"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Corrected (rule-of-thumb):  </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>corrected<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.2%}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span></code></pre></div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
시뮬레이션 해석
</div>
</div>
<div class="callout-body-container callout-body">
<p>raw delta 는 진짜 8% 보다 <em>작음</em> (spillover 로 underestimate). downstream delta 도 양수 — ecosystem 영향 의 신호. corrected delta 는 raw + multiplier × downstream → 진짜 효과 에 <em>근접</em>.</p>
<p>이 시뮬레이션은 rule-of-thumb 가 <em>완벽 하지 않지만 의미 있는 보정</em> 을 제공함을 보여준다. multiplier 의 정확도 가 보정 의 정확도 를 결정.</p>
</div>
</div>
</section>
<section id="사례" class="level2" data-number="8">
<h2 data-number="8" class="anchored" data-anchor-id="사례"><span class="header-section-number">8</span> 사례</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
LinkedIn
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li>Feed 실험 의 creator-side optimization (Barrilleaux and Wang 2018)</li>
<li>1 차: post engagement (like, comment)</li>
<li>downstream: post 의 creator 의 retention</li>
<li>multiplier 는 historical experiment 로 추정 (분기 마다 재추정)</li>
</ul>
<section id="bing" class="level5" data-number="8.0.0.1">
<h5 data-number="8.0.0.1" class="anchored" data-anchor-id="bing"><span class="header-section-number">8.0.0.1</span> Bing</h5>
<ul>
<li>ad 실험 의 ecosystem value</li>
<li>1 차: query·click</li>
<li>downstream: search session 의 retention</li>
<li>multiplier 가 ad type 별로 다름</li>
</ul>
</section>
<section id="일반-패턴" class="level5" data-number="8.0.0.2">
<h5 data-number="8.0.0.2" class="anchored" data-anchor-id="일반-패턴"><span class="header-section-number">8.0.0.2</span> 일반 패턴</h5>
<ol type="1">
<li>action type 정의 (메시지·post·click·…)</li>
<li>action 별 1 차·downstream metric pair 정의</li>
<li>historical experiment cohort 에서 multiplier 회귀</li>
<li>새 실험 마다 raw + corrected 둘 다 보고</li>
</ol>
</section>
</div>
</div>
</section>
<section id="비교" class="level2" data-number="9">
<h2 data-number="9" class="anchored" data-anchor-id="비교"><span class="header-section-number">9</span> 비교</h2>
<table class="table">
<colgroup>
<col style="width: 33%">
<col style="width: 33%">
<col style="width: 33%">
</colgroup>
<thead>
<tr class="header">
<th>차원</th>
<th>Raw delta</th>
<th>Rule-of-thumb corrected</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>데이터 요구</td>
<td>실험 데이터 만</td>
<td>+ downstream metric + historical multiplier</td>
</tr>
<tr class="even">
<td>sample size</td>
<td>Bernoulli 최대</td>
<td>Bernoulli 최대 (변경 없음)</td>
</tr>
<tr class="odd">
<td>구현</td>
<td>단순</td>
<td>약간 복잡 (multiplier 관리)</td>
</tr>
<tr class="even">
<td>Bias 보정</td>
<td>없음</td>
<td>부분적 (downstream 만)</td>
</tr>
<tr class="odd">
<td>정확도</td>
<td>평균 적 underestimate</td>
<td>더 정확 (단, multiplier 의 평균 한계)</td>
</tr>
<tr class="even">
<td>의사결정</td>
<td>conservative</td>
<td>더 가까운 추정</td>
</tr>
</tbody>
</table>
</section>
<section id="응용" class="level2" data-number="10">
<h2 data-number="10" class="anchored" data-anchor-id="응용"><span class="header-section-number">10</span> 응용</h2>
<ul>
<li>사회 engagement 실험 (메시지·post·like·share)</li>
<li>two-sided platform 의 <em>수요 측</em> 실험 (advertiser·publisher)</li>
<li>recommendation 실험 의 indirect effect (recommend → click → retention)</li>
<li>search ranking 의 query·click chain</li>
</ul>
</section>
<section id="실무-체크리스트" class="level2" data-number="11">
<h2 data-number="11" class="anchored" data-anchor-id="실무-체크리스트"><span class="header-section-number">11</span> 실무 체크리스트</h2>
<ol type="1">
<li>실험 의 1 차 action 정의</li>
<li>1 차 action 의 downstream metric 정의</li>
<li>historical experiments 에서 multiplier 추정 (분기 마다)</li>
<li>실험 보고 시 raw delta + corrected delta 둘 다 표기</li>
<li>multiplier 의 <em>uncertainty</em> 도 함께 보고 (CI 또는 IQR)</li>
<li>큰 의사결정 (전사 launch) 시 추가 isolation 실험 검증</li>
</ol>
</section>
<section id="관련-주제" class="level2" data-number="12">
<h2 data-number="12" class="anchored" data-anchor-id="관련-주제"><span class="header-section-number">12</span> 관련 주제</h2>
<ul>
<li>F22-0 overview — Ch.22 전체 지도</li>
<li>F22-1 — Direct·Indirect 6 사례</li>
<li>F22-3 — Isolation 4 갈래 + edge-level + monitoring</li>
<li>D-21 (Hernan 22) — Time-varying treatment 의 IV 외삽</li>
<li>F-KOH18 (Variance) — Rule-of-thumb multiplier 의 variance 영향</li>
</ul>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
출처
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li>Kohavi, Tang, Xu (2020). <em>Trustworthy Online Controlled Experiments.</em> Ch.22.3 (Some Practical Solutions — Rule-of-Thumb).</li>
<li>Tutterow and Saint-Jacques (2019). LinkedIn ecosystem value 추정.</li>
<li>Barrilleaux and Wang (2018). “Spreading the Love in the LinkedIn Feed.”</li>
<li>Gupta et al.&nbsp;(2019). “Top Challenges from the OCE Summit.”</li>
</ul>
</div>
</div>


</section>

 ]]></description>
  <category>Experimentation</category>
  <category>A/B Test</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F22-2-practical-solutions-ecosystem-value.html</guid>
  <pubDate>Fri, 08 May 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Kohavi Ch.22.4~22.6 — Isolation 4 갈래 · Edge-Level · Detection·Monitoring</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F22-3-isolation-edge-detection.html</link>
  <description><![CDATA[ 





<section id="정의" class="level2" data-number="1">
<h2 data-number="1" class="anchored" data-anchor-id="정의"><span class="header-section-number">1</span> 정의</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
정의: Isolation (격리)
</div>
</div>
<div class="callout-body-container callout-body">
<p>leakage 의 매개체 를 식별 후 <em>Treatment 와 Control 사이 의 통로</em> 를 차단 또는 randomization unit 을 매개체 단위 로 변경 (Kohavi, Tang, Xu, 2020, Ch.22.4).</p>
<section id="갈래-1-변종" class="level5" data-number="1.0.0.1">
<h5 data-number="1.0.0.1" class="anchored" data-anchor-id="갈래-1-변종"><span class="header-section-number">1.0.0.1</span> 4 갈래 (+1 변종)</h5>
<ol type="1">
<li><strong>Splitting shared resources</strong>: 자원 (budget·training data) 을 variant 비율 로 분리</li>
<li><strong>Geo-based randomization</strong>: 지역 단위 randomization</li>
<li><strong>Time-based randomization</strong>: 시간 단위 (분·시간·일) randomization</li>
<li><strong>Network-cluster randomization</strong>: 사회 네트워크 의 cluster 단위</li>
<li><strong>Ego-centric randomization</strong>: ego (focal) + alters (인접) 의 변종</li>
</ol>
</section>
<section id="edge-level-analysis-보조" class="level5" data-number="1.0.0.2">
<h5 data-number="1.0.0.2" class="anchored" data-anchor-id="edge-level-analysis-보조"><span class="header-section-number">1.0.0.2</span> Edge-Level Analysis (보조)</h5>
<p>Bernoulli randomization 위에 edge 단위 post-hoc 분석. 4 type (T-T, T-C, C-T, C-C) 의 contrast 로 unbiased delta 추출.</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 매개체 와 isolation 의 매핑
</div>
</div>
<div class="callout-body-container callout-body">
<table class="table">
<thead>
<tr class="header">
<th>매개체</th>
<th>isolation 1 차 선택</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>budget·training data</td>
<td>splitting resources</td>
</tr>
<tr class="even">
<td>inventory·pricing (marketplace)</td>
<td>geo-based</td>
</tr>
<tr class="odd">
<td>단기 transactional event</td>
<td>time-based</td>
</tr>
<tr class="even">
<td>사회 네트워크 (밀집)</td>
<td>network-cluster, ego-centric</td>
</tr>
<tr class="odd">
<td>사회 네트워크 (희소)</td>
<td>edge-level analysis</td>
</tr>
</tbody>
</table>
<p>규칙: <em>매개체 의 단위</em> 와 <em>randomization unit</em> 을 일치 시킴 → leakage 차단.</p>
</div>
</div>
</section>
<section id="splitting-shared-resources" class="level2" data-number="2">
<h2 data-number="2" class="anchored" data-anchor-id="splitting-shared-resources"><span class="header-section-number">2</span> 1. Splitting Shared Resources</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<section id="적용-영역" class="level5" data-number="2.0.0.1">
<h5 data-number="2.0.0.1" class="anchored" data-anchor-id="적용-영역"><span class="header-section-number">2.0.0.1</span> 적용 영역</h5>
<ul>
<li>ad campaign 의 공유 budget</li>
<li>relevance model 의 공유 training data</li>
<li>추천 시스템 의 공유 inventory</li>
</ul>
</section>
<section id="절차" class="level5" data-number="2.0.0.2">
<h5 data-number="2.0.0.2" class="anchored" data-anchor-id="절차"><span class="header-section-number">2.0.0.2</span> 절차</h5>
<ol type="1">
<li>공유 자원 식별 (budget, data pool, …)</li>
<li>variant traffic 비율 (예: 50/50) 과 <em>동일</em> 비율 로 자원 할당</li>
<li>variant 별 별도 자원 풀 운영</li>
</ol>
</section>
<section id="예시" class="level5" data-number="2.0.0.3">
<h5 data-number="2.0.0.3" class="anchored" data-anchor-id="예시"><span class="header-section-number">2.0.0.3</span> 예시</h5>
<p>ad budget 100k$ + 50/50 traffic:</p>
<pre><code>Treatment budget: 50k$
Control budget:   50k$
각 variant 의 click 만 자기 budget 에서 차감</code></pre>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
2 가지 watch-out
</div>
</div>
<div class="callout-body-container callout-body">
<section id="resource-heterogeneity" class="level5" data-number="2.0.0.4">
<h5 data-number="2.0.0.4" class="anchored" data-anchor-id="resource-heterogeneity"><span class="header-section-number">2.0.0.4</span> 1. Resource heterogeneity</h5>
<p>machine·server 의 hardware 가 동질 적이지 않으면 분리 시 confounding 도입:</p>
<ul>
<li>machine A (Treatment 전용): 빠른 CPU</li>
<li>machine B (Control 전용): 느린 CPU</li>
<li>→ Treatment 가 baseline 부터 우세</li>
</ul>
<p>해결: machine 풀 을 <em>random shuffle</em> 하여 두 variant 에 <em>동등 split</em>.</p>
</section>
<section id="resource-amount-의-의도적-imbalance" class="level5" data-number="2.0.0.5">
<h5 data-number="2.0.0.5" class="anchored" data-anchor-id="resource-amount-의-의도적-imbalance"><span class="header-section-number">2.0.0.5</span> 2. Resource amount 의 의도적 imbalance</h5>
<p>50/50 traffic 이 아닌 95/5 traffic 시 budget 도 95/5 분할 → Control 의 5% 가 <em>너무 작아</em> model 학습 부족, training data 의 <em>다양성</em> 부족.</p>
<p>규칙: training data·model 학습 시 <em>가능 하면 50/50 split</em> 권장.</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관
</div>
</div>
<div class="callout-body-container callout-body">
<p>splitting 은 가장 <em>명시적</em> isolation. 자원 의 <em>boundary</em> 를 명확히 하면 leakage 차단.</p>
<p>하지만 자원 이 <em>불가분</em> (CPU·cache·shared session) 일 때 적용 불가 → 다른 isolation 필요.</p>
</div>
</div>
</section>
<section id="geo-based-randomization" class="level2" data-number="3">
<h2 data-number="3" class="anchored" data-anchor-id="geo-based-randomization"><span class="header-section-number">3</span> 2. Geo-Based Randomization</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<section id="적용-영역-1" class="level5" data-number="3.0.0.1">
<h5 data-number="3.0.0.1" class="anchored" data-anchor-id="적용-영역-1"><span class="header-section-number">3.0.0.1</span> 적용 영역</h5>
<ul>
<li>지리 의존 marketplace (Airbnb hotel, Uber/Lyft taxi)</li>
<li>지역별 ad campaign</li>
</ul>
</section>
<section id="가정-vaver-and-koehler-2011-2012" class="level5" data-number="3.0.0.2">
<h5 data-number="3.0.0.2" class="anchored" data-anchor-id="가정-vaver-and-koehler-2011-2012"><span class="header-section-number">3.0.0.2</span> 가정 (Vaver and Koehler 2011, 2012)</h5>
<ul>
<li>다른 지역 의 unit 들 사이 leakage 거의 없음</li>
<li>같은 지역 내 의 unit 들 사이 leakage 발생 가능</li>
</ul>
</section>
<section id="절차-1" class="level5" data-number="3.0.0.3">
<h5 data-number="3.0.0.3" class="anchored" data-anchor-id="절차-1"><span class="header-section-number">3.0.0.3</span> 절차</h5>
<ol type="1">
<li>지역 정의 (city, MSA, country)</li>
<li>지역 단위 randomization (city A → Treatment, city B → Control)</li>
<li>분석 단위 도 지역 — paired t-test 또는 difference-in-differences</li>
</ol>
</section>
<section id="sample-size-의-한계" class="level5" data-number="3.0.0.4">
<h5 data-number="3.0.0.4" class="anchored" data-anchor-id="sample-size-의-한계"><span class="header-section-number">3.0.0.4</span> Sample size 의 한계</h5>
<p>지역 수 가 sample size — 보통 100~1000 단위. user-level (millions) 보다 훨씬 작음.</p>
<pre><code>user-level: n = 10M users → variance ~ 1/sqrt(10M)
geo-level:  n = 100 cities → variance ~ 1/sqrt(100)
→ geo 의 std error 가 ~316 배 큼</code></pre>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: variance 의 trade-off
</div>
</div>
<div class="callout-body-container callout-body">
<p>geo-based 의 가장 큰 비용 은 <em>sample size 손실</em> → variance 폭증.</p>
<p>해결책:</p>
<ul>
<li><strong>Pre-experiment covariate adjustment</strong> (CUPED, Ch.18): 같은 city 의 historical metric 으로 variance 줄임</li>
<li><strong>Stratified randomization</strong>: 비슷한 city 끼리 strata, strata 내 randomize</li>
<li><strong>Time dimension 추가</strong>: 같은 city 의 여러 기간 → sample 늘림 (DiD)</li>
</ul>
<p>레슨: geo-based 는 <em>variance reduction</em> 와 <em>반드시</em> 결합 — 안 그러면 underpowered.</p>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Geo 의 응용
</div>
</div>
<div class="callout-body-container callout-body">
<section id="lyft-chamandy-2016" class="level5" data-number="3.0.0.5">
<h5 data-number="3.0.0.5" class="anchored" data-anchor-id="lyft-chamandy-2016"><span class="header-section-number">3.0.0.5</span> Lyft (Chamandy 2016)</h5>
<ul>
<li>city 단위 randomization</li>
<li>같은 city 내 driver-rider 는 spillover, 다른 city 는 거의 없음</li>
<li>variance 줄이기: log scale, paired t-test (Treatment city ↔︎ matched Control city)</li>
</ul>
</section>
<section id="uber" class="level5" data-number="3.0.0.6">
<h5 data-number="3.0.0.6" class="anchored" data-anchor-id="uber"><span class="header-section-number">3.0.0.6</span> Uber</h5>
<ul>
<li>city · time-of-day 의 cross-product 로 unit 정의</li>
<li>“switchback” — 같은 city 가 시간대 별로 T → C → T → … (Phase J-SWITCH 참조)</li>
</ul>
</section>
</div>
</div>
</section>
<section id="time-based-randomization" class="level2" data-number="4">
<h2 data-number="4" class="anchored" data-anchor-id="time-based-randomization"><span class="header-section-number">4</span> 3. Time-Based Randomization</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<section id="가정-bojinov-and-shephard-2017-hohnhold-et-al.-2015" class="level5" data-number="4.0.0.1">
<h5 data-number="4.0.0.1" class="anchored" data-anchor-id="가정-bojinov-and-shephard-2017-hohnhold-et-al.-2015"><span class="header-section-number">4.0.0.1</span> 가정 (Bojinov and Shephard 2017; Hohnhold et al.&nbsp;2015)</h5>
<ul>
<li>시간 <img src="https://latex.codecogs.com/png.latex?t"> 마다 <em>모든 사용자</em> 가 같은 variant</li>
<li>같은 사용자 의 <em>시간 차 leakage</em> 가 미미 (transactional 효과)</li>
</ul>
</section>
<section id="절차-2" class="level5" data-number="4.0.0.2">
<h5 data-number="4.0.0.2" class="anchored" data-anchor-id="절차-2"><span class="header-section-number">4.0.0.2</span> 절차</h5>
<ol type="1">
<li>시간 단위 정의 (분·시간·일·주)</li>
<li>시간 단위 마다 coin flip → 모두 T 또는 모두 C</li>
<li>분석: T 시간 의 metric vs C 시간 의 metric (paired t-test 또는 covariate adjustment)</li>
</ol>
</section>
<section id="sample-size-의-한계-1" class="level5" data-number="4.0.0.3">
<h5 data-number="4.0.0.3" class="anchored" data-anchor-id="sample-size-의-한계-1"><span class="header-section-number">4.0.0.3</span> Sample size 의 한계</h5>
<p>시간 단위 수 = sample size:</p>
<table class="table">
<thead>
<tr class="header">
<th>단위</th>
<th>1 주 sample size</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>second</td>
<td>604,800</td>
</tr>
<tr class="even">
<td>minute</td>
<td>10,080</td>
</tr>
<tr class="odd">
<td>hour</td>
<td>168</td>
</tr>
<tr class="even">
<td>day</td>
<td>7</td>
</tr>
</tbody>
</table>
<p>day-level 은 sample 너무 작음 → 적어도 <em>hour-level</em> 권장.</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 시간 효과 의 통제
</div>
</div>
<div class="callout-body-container callout-body">
<p>time-based 의 도전: <em>시간 효과 가 강함</em> — 요일·시간대·계절성.</p>
<pre><code>naive analysis:
  T 시간: 평균 metric = 100
  C 시간: 평균 metric = 80
  delta: +25%

But! C 시간 의 절반 이 새벽 → 자연 적으로 metric 낮음
실제 effect 는 +25% 가 아님</code></pre>
<p>해결:</p>
<ul>
<li><strong>Paired t-test</strong> (같은 시간대 의 T-day vs C-day 비교)</li>
<li><strong>Covariate adjustment</strong> (시간대·요일 dummy 변수)</li>
<li><strong>Switchback design</strong> (Phase J-SWITCH-1) — 같은 단위 시간 내 T→C→T 반복</li>
</ul>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Time-based 와 ITS
</div>
</div>
<div class="callout-body-container callout-body">
<p>interrupted time series (ITS, Ch.11): pre-period 를 control 로 사용하는 <em>시간 비교</em>.</p>
<p>차이:</p>
<table class="table">
<thead>
<tr class="header">
<th>차원</th>
<th>Time-based randomization</th>
<th>ITS</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>randomization</td>
<td>매 시간 단위 마다 coin flip</td>
<td>한 번 의 intervention</td>
</tr>
<tr class="even">
<td>가정</td>
<td>시간 효과 model 가능</td>
<td>시간 추세 model 가능</td>
</tr>
<tr class="odd">
<td>적용</td>
<td>빠른 spillover (분·시간)</td>
<td>큰 변화 (정책·feature launch)</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<section id="network-cluster-randomization" class="level2" data-number="5">
<h2 data-number="5" class="anchored" data-anchor-id="network-cluster-randomization"><span class="header-section-number">5</span> 4. Network-Cluster Randomization</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism (Gui et al.&nbsp;2015; Backstrom and Kleinberg 2011)
</div>
</div>
<div class="callout-body-container callout-body">
<section id="적용-영역-2" class="level5" data-number="5.0.0.1">
<h5 data-number="5.0.0.1" class="anchored" data-anchor-id="적용-영역-2"><span class="header-section-number">5.0.0.1</span> 적용 영역</h5>
<ul>
<li>사회 네트워크 (Facebook, LinkedIn, Twitter)</li>
<li>사용자 그룹 의 spillover</li>
</ul>
</section>
<section id="절차-3" class="level5" data-number="5.0.0.2">
<h5 data-number="5.0.0.2" class="anchored" data-anchor-id="절차-3"><span class="header-section-number">5.0.0.2</span> 절차</h5>
<ol type="1">
<li>graph 의 cluster 분할 (예: METIS, modularity-based)</li>
<li>cluster 단위 randomization (cluster A → T, cluster B → C)</li>
<li>분석: cluster 단위 t-test 또는 mixed-effects model</li>
</ol>
</section>
<section id="cluster-의-trade-off" class="level5" data-number="5.0.0.3">
<h5 data-number="5.0.0.3" class="anchored" data-anchor-id="cluster-의-trade-off"><span class="header-section-number">5.0.0.3</span> Cluster 의 trade-off</h5>
<pre><code>큰 cluster (예: 100k user 1 cluster):
  + isolation 강 (cluster 내 spillover 가 cluster 안 으로 한정)
  - sample size 작음 (cluster 수 적음)

작은 cluster (예: 100 user 1 cluster):
  + sample size 큼
  - inter-cluster edge 비율 높음 → leakage 잔존</code></pre>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 그래프 의 cut
</div>
</div>
<div class="callout-body-container callout-body">
<p>cluster 는 <em>graph cut</em> 문제: cluster 내 edge 를 최대화, cluster 사이 edge 를 최소화.</p>
<p>LinkedIn 사례 (Saint-Jacques et al.&nbsp;2018):</p>
<ul>
<li>10,000 cluster 시도</li>
<li>80%+ edge 가 <em>cluster 사이</em> — perfect isolation 불가</li>
</ul>
<p>레슨: 사회 네트워크 의 dense graph 는 <em>완벽한 isolation 어렵다</em>. cluster 는 <em>부분 적 isolation</em> 으로 인식 — combined methods (cluster + edge analysis) 권장.</p>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
한계 와 해결
</div>
</div>
<div class="callout-body-container callout-body">
<section id="inter-cluster-edge" class="level5" data-number="5.0.0.4">
<h5 data-number="5.0.0.4" class="anchored" data-anchor-id="inter-cluster-edge"><span class="header-section-number">5.0.0.4</span> 1. Inter-cluster edge</h5>
<p>dense graph 에서 의 cluster 사이 edge 가 spillover 의 <em>잔여 채널</em>. 해결: cluster 분할 시 <em>engaged subgraph</em> (실제 메시지 가 흐르는 edge) 만 cut.</p>
</section>
<section id="effective-sample-size" class="level5" data-number="5.0.0.5">
<h5 data-number="5.0.0.5" class="anchored" data-anchor-id="effective-sample-size"><span class="header-section-number">5.0.0.5</span> 2. Effective sample size</h5>
<p>cluster 수 = sample size — variance bias trade-off:</p>
<pre><code>cluster 수 ↑: variance ↓, but isolation ↓ (작은 cluster → inter-cluster edge 많음)
cluster 수 ↓: isolation ↑, but variance ↑</code></pre>
<p>해결: <em>time dimension</em> 결합 (같은 cluster 의 여러 기간) 또는 <em>covariate adjustment</em>.</p>
</section>
</div>
</div>
</section>
<section id="ego-centric-randomization" class="level2" data-number="6">
<h2 data-number="6" class="anchored" data-anchor-id="ego-centric-randomization"><span class="header-section-number">6</span> 5. Ego-Centric Randomization</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism (Saint-Jacques et al.&nbsp;2018b)
</div>
</div>
<div class="callout-body-container callout-body">
<p>cluster randomization 의 변종 — 각 cluster 가 <em>특정 구조</em>: ego (focal) + alters (인접).</p>
<section id="절차-4" class="level5" data-number="6.0.0.1">
<h5 data-number="6.0.0.1" class="anchored" data-anchor-id="절차-4"><span class="header-section-number">6.0.0.1</span> 절차</h5>
<ol type="1">
<li>graph 의 모든 ego (focal individual) 식별</li>
<li>각 ego 의 alters (immediate neighbors) 묶음</li>
<li>ego 의 variant 배정 + alters 의 별도 variant 배정 (예: alters 모두 T, ego 절반 T)</li>
<li>ego 의 metric 만 비교 (T ego vs C ego)</li>
</ol>
</section>
<section id="분석-의-강점" class="level5" data-number="6.0.0.2">
<h5 data-number="6.0.0.2" class="anchored" data-anchor-id="분석-의-강점"><span class="header-section-number">6.0.0.2</span> 분석 의 강점</h5>
<ul>
<li><em>first-order impact</em>: ego 자체 의 행동 변화 (T·C ego 비교)</li>
<li><em>downstream impact</em>: alter 가 모두 T 일 때 ego 의 응답 (전파 측정)</li>
<li><em>interaction effect</em>: ego 와 alter 의 모든 조합</li>
</ul>
</section>
<section id="효율-성" class="level5" data-number="6.0.0.3">
<h5 data-number="6.0.0.3" class="anchored" data-anchor-id="효율-성"><span class="header-section-number">6.0.0.3</span> 효율 성</h5>
<p>cluster 가 작음 (~ degree+1) → cluster 수 많음 → sample 보다 큼 (network-cluster 보다)</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 분석 단위 의 분리
</div>
</div>
<div class="callout-body-container callout-body">
<p>ego-centric 의 우아함: <em>randomization</em> 과 <em>분석</em> 의 분리.</p>
<ul>
<li>randomization unit: ego (사람 또는 작은 cluster)</li>
<li>analysis unit: ego 의 metric만</li>
<li>alters 는 <em>통제</em> 변수 — graph 의 spillover 를 명시적 모델링</li>
</ul>
<p>비유: 식물 실험 — 이웃 식물 의 효과 (햇빛 차단·수분 경쟁) 가 있다고 알려져 있을 때 <em>central</em> 식물 만 측정, <em>주변</em> 식물 은 <em>통제</em> 로.</p>
</div>
</div>
</section>
<section id="edge-level-analysis" class="level2" data-number="7">
<h2 data-number="7" class="anchored" data-anchor-id="edge-level-analysis"><span class="header-section-number">7</span> 6. Edge-Level Analysis</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<p>Bernoulli randomization (user-level) 위 의 <em>post-hoc</em> 분석. 모든 interaction (edge) 을 4 type 으로 라벨:</p>
<ul>
<li>T → T (Treatment user 가 Treatment user 에게)</li>
<li>T → C</li>
<li>C → C</li>
<li>C → T</li>
</ul>
<section id="분석-패턴" class="level5" data-number="7.0.0.1">
<h5 data-number="7.0.0.1" class="anchored" data-anchor-id="분석-패턴"><span class="header-section-number">7.0.0.1</span> 분석 패턴</h5>
</section>
<section id="unbiased-delta-추출" class="level5" data-number="7.0.0.2">
<h5 data-number="7.0.0.2" class="anchored" data-anchor-id="unbiased-delta-추출"><span class="header-section-number">7.0.0.2</span> Unbiased delta 추출</h5>
<pre><code>metric_TT = (T → T edge 의 평균 행동)
metric_CC = (C → C edge 의 평균 행동)
unbiased_delta = metric_TT - metric_CC</code></pre>
<p>T → T 와 C → C 는 <em>internal</em> — 각각 의 universe 로 해석 가능.</p>
</section>
<section id="treatment-affinity" class="level5" data-number="7.0.0.3">
<h5 data-number="7.0.0.3" class="anchored" data-anchor-id="treatment-affinity"><span class="header-section-number">7.0.0.3</span> Treatment affinity</h5>
<p>T → T edge 비율 vs T → C edge 비율 → T 가 T 끼리 더 자주 message 하는가?</p>
</section>
<section id="response-rate" class="level5" data-number="7.0.0.4">
<h5 data-number="7.0.0.4" class="anchored" data-anchor-id="response-rate"><span class="header-section-number">7.0.0.4</span> Response rate</h5>
<p>T 의 새 action 에 대한 응답 률 (T 의 message 의 reply rate vs C 의 message 의 reply rate)</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 그래프 의 분해
</div>
</div>
<div class="callout-body-container callout-body">
<p>edge-level 의 핵심: <em>user 단위 randomization</em> 의 통계적 power 를 유지하면서 <em>edge 단위 spillover</em> 를 명시적 측정.</p>
<p>레슨: 사회 네트워크 의 <em>명시적 interaction</em> (메시지·like) 이 있는 경우 가장 강력 한 도구. 단, edge 가 잘 정의 되지 않은 경우 (예: feed view) 적용 어려움.</p>
</div>
</div>
</section>
<section id="detection-monitoring" class="level2" data-number="8">
<h2 data-number="8" class="anchored" data-anchor-id="detection-monitoring"><span class="header-section-number">8</span> 7. Detection &amp; Monitoring</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Ramp 단계 의 outlier 감시
</div>
</div>
<div class="callout-body-container callout-body">
<p>ramp (Ch.15) 는 leakage 발견 의 <em>1차 방어선</em>:</p>
<section id="단계" class="level5" data-number="8.0.0.1">
<h5 data-number="8.0.0.1" class="anchored" data-anchor-id="단계"><span class="header-section-number">8.0.0.1</span> 단계</h5>
<ol type="1">
<li><strong>employees</strong> (~100 명): 큰 functional bug 발견</li>
<li><strong>small datacenter</strong> (~10K user): infrastructure leakage (CPU·memory)</li>
<li><strong>MPR (1%)</strong>: traffic 의 1% — interaction effect 시작</li>
<li><strong>scale up (10%, 50%)</strong>: marketplace contention 노출</li>
</ol>
</section>
<section id="outlier-신호" class="level5" data-number="8.0.0.2">
<h5 data-number="8.0.0.2" class="anchored" data-anchor-id="outlier-신호"><span class="header-section-number">8.0.0.2</span> Outlier 신호</h5>
<ul>
<li>1% 와 50% ramp 의 effect 크기 가 <em>크게 다름</em> → leakage 의심</li>
<li>1% 의 +5% effect 가 50% 에서 +1% → 자원 contention 가능성</li>
<li>시간 따른 effect drift (학습 효과 또는 budget 소진)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Alert System
</div>
</div>
<div class="callout-body-container callout-body">
<section id="모니터링-지표" class="level5" data-number="8.0.0.3">
<h5 data-number="8.0.0.3" class="anchored" data-anchor-id="모니터링-지표"><span class="header-section-number">8.0.0.3</span> 모니터링 지표</h5>
<ul>
<li>Treatment·Control 의 <em>infrastructure metric</em> (CPU, memory, latency 의 99 percentile)</li>
<li>ad budget 의 <em>소진 속도</em> (variant 별)</li>
<li>relevance model 의 <em>training data freshness</em></li>
</ul>
</section>
<section id="trigger-조건" class="level5" data-number="8.0.0.4">
<h5 data-number="8.0.0.4" class="anchored" data-anchor-id="trigger-조건"><span class="header-section-number">8.0.0.4</span> Trigger 조건</h5>
<ul>
<li>같은 server 의 Treatment·Control latency drift &gt; 5%</li>
<li>ad budget 소진 속도 의 variant 격차 &gt; 20%</li>
<li>training data 의 variant 별 비율 의 design 이탈</li>
</ul>
</section>
<section id="사례" class="level5" data-number="8.0.0.5">
<h5 data-number="8.0.0.5" class="anchored" data-anchor-id="사례"><span class="header-section-number">8.0.0.5</span> 사례</h5>
<p>Bing 의 trustworthy A/B testing platform: 50+ guardrail metric 자동 모니터링, 이상 시 실험 자동 중단.</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 측정 가능성 의 한계
</div>
</div>
<div class="callout-body-container callout-body">
<p>leakage 의 <em>정확 한 측정</em> 은 어려움 — 특히 isolation 미적용 의 일반 실험. 하지만 <em>감시</em> 는 항상 가능.</p>
<p>규칙: 의심 → 측정 시도 → 측정 불가 시 <em>alert + ramp 단계 분석</em> 으로 부분 점검. “측정 안 되니 무시” 는 가장 위험.</p>
</div>
</div>
</section>
<section id="비교-모든-isolation" class="level2" data-number="9">
<h2 data-number="9" class="anchored" data-anchor-id="비교-모든-isolation"><span class="header-section-number">9</span> 비교 — 모든 isolation</h2>
<table class="table">
<colgroup>
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
</colgroup>
<thead>
<tr class="header">
<th>접근</th>
<th>적용 매개체</th>
<th>sample size</th>
<th>bias 제거</th>
<th>구현 비용</th>
<th>Variance</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Splitting resources</td>
<td>budget, training data</td>
<td>큼</td>
<td>강</td>
<td>중간</td>
<td>동일</td>
</tr>
<tr class="even">
<td>Geo-based</td>
<td>inventory·marketplace</td>
<td>작음</td>
<td>강</td>
<td>중간</td>
<td>큼 (CUPED 결합 필수)</td>
</tr>
<tr class="odd">
<td>Time-based</td>
<td>transactional spillover</td>
<td>작음~중간</td>
<td>강</td>
<td>낮음</td>
<td>큼 (paired test 결합)</td>
</tr>
<tr class="even">
<td>Network-cluster</td>
<td>dense social graph</td>
<td>작음</td>
<td>부분</td>
<td>높음</td>
<td>큼</td>
</tr>
<tr class="odd">
<td>Ego-centric</td>
<td>sparse social graph</td>
<td>중간</td>
<td>강</td>
<td>높음</td>
<td>중간</td>
</tr>
<tr class="even">
<td>Edge-level</td>
<td>명시적 interaction graph</td>
<td>큼 (Bernoulli)</td>
<td>강</td>
<td>중간 (분석)</td>
<td>중간</td>
</tr>
<tr class="odd">
<td>Rule-of-thumb</td>
<td>일반 사회 engagement</td>
<td>큼 (Bernoulli)</td>
<td>부분</td>
<td>낮음</td>
<td>동일</td>
</tr>
</tbody>
</table>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
결합 의 가치
</div>
</div>
<div class="callout-body-container callout-body">
<p>isolation 들 은 <em>상호 배타</em> 가 아닌 <em>결합 가능</em>:</p>
<ul>
<li>Geo + CUPED: marketplace 실험 의 variance 보강</li>
<li>Time + paired t-test: transactional 의 시간 효과 통제</li>
<li>Network-cluster + edge-level: 사회 네트워크 의 isolation + post-hoc detail</li>
<li>Splitting + ramp monitoring: budget 분리 + 안전 ramp</li>
</ul>
<p>규칙: 큰 실험 일수록 <em>복합 isolation</em> — 한 가지 만으로 부족.</p>
</div>
</div>
</section>
<section id="python-시뮬레이션-geo-based-의-variance-trade-off" class="level2" data-number="10">
<h2 data-number="10" class="anchored" data-anchor-id="python-시뮬레이션-geo-based-의-variance-trade-off"><span class="header-section-number">10</span> Python 시뮬레이션 — geo-based 의 variance trade-off</h2>
<div class="sourceCode" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb7-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb7-2"></span>
<span id="cb7-3">np.random.seed(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2026</span>)</span>
<span id="cb7-4"></span>
<span id="cb7-5"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> simulate_geo_vs_user_level(n_users_per_geo<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10000</span>, n_geos<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, true_lift<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.05</span>):</span>
<span id="cb7-6">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">"""</span></span>
<span id="cb7-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    같은 데이터 를 user-level 과 geo-level 로 분석 비교.</span></span>
<span id="cb7-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    """</span></span>
<span id="cb7-9">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 각 geo 의 baseline 차이 (heterogeneity)</span></span>
<span id="cb7-10">    geo_baseline <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.normal(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.05</span>, size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>n_geos)</span>
<span id="cb7-11"></span>
<span id="cb7-12">    user_metric <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> []</span>
<span id="cb7-13">    user_assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> []</span>
<span id="cb7-14">    geo_metric_t, geo_metric_c <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [], []</span>
<span id="cb7-15"></span>
<span id="cb7-16">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">for</span> g <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">range</span>(n_geos):</span>
<span id="cb7-17">        baseline <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> geo_baseline[g]</span>
<span id="cb7-18">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># geo-level: geo 단위 randomization</span></span>
<span id="cb7-19">        geo_assign <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.randint(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)</span>
<span id="cb7-20">        p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> baseline <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> true_lift) <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> geo_assign <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">else</span> baseline</span>
<span id="cb7-21">        users <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.binomial(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, p, size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>n_users_per_geo)</span>
<span id="cb7-22"></span>
<span id="cb7-23">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> geo_assign <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>:</span>
<span id="cb7-24">            geo_metric_t.append(users.mean())</span>
<span id="cb7-25">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">else</span>:</span>
<span id="cb7-26">            geo_metric_c.append(users.mean())</span>
<span id="cb7-27"></span>
<span id="cb7-28">        user_metric.extend(users)</span>
<span id="cb7-29">        user_assignment.extend([geo_assign] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> n_users_per_geo)</span>
<span id="cb7-30"></span>
<span id="cb7-31">    user_metric <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.array(user_metric)</span>
<span id="cb7-32">    user_assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.array(user_assignment)</span>
<span id="cb7-33"></span>
<span id="cb7-34">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># user-level analysis (잘못된, leakage 무시)</span></span>
<span id="cb7-35">    rate_t_user <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> user_metric[user_assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>].mean()</span>
<span id="cb7-36">    rate_c_user <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> user_metric[user_assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>].mean()</span>
<span id="cb7-37">    se_user <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.sqrt(</span>
<span id="cb7-38">        rate_t_user <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> rate_t_user) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> (user_assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>).<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>()</span>
<span id="cb7-39">        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> rate_c_user <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> rate_c_user) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> (user_assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>).<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>()</span>
<span id="cb7-40">    )</span>
<span id="cb7-41"></span>
<span id="cb7-42">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># geo-level analysis</span></span>
<span id="cb7-43">    geo_metric_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.array(geo_metric_t)</span>
<span id="cb7-44">    geo_metric_c <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.array(geo_metric_c)</span>
<span id="cb7-45">    se_geo <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.sqrt(</span>
<span id="cb7-46">        geo_metric_t.var() <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">len</span>(geo_metric_t)</span>
<span id="cb7-47">        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> geo_metric_c.var() <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">len</span>(geo_metric_c)</span>
<span id="cb7-48">    )</span>
<span id="cb7-49"></span>
<span id="cb7-50">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> rate_t_user, rate_c_user, se_user, geo_metric_t.mean(), geo_metric_c.mean(), se_geo</span>
<span id="cb7-51"></span>
<span id="cb7-52">t_u, c_u, se_u, t_g, c_g, se_g <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> simulate_geo_vs_user_level()</span>
<span id="cb7-53"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"User-level: delta = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>t_u <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> c_u<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, SE = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>se_u<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.6f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb7-54"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Geo-level:  delta = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>t_g <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> c_g<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, SE = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>se_g<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.6f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb7-55"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"SE ratio (geo / user): </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>se_g <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> se_u<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.1f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">x"</span>)</span></code></pre></div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
시뮬레이션 해석
</div>
</div>
<div class="callout-body-container callout-body">
<p>user-level 분석 은 sample size 가 많아 SE 가 매우 작음. geo-level 은 sample 이 geo 수 (100) 로 줄어들어 SE 가 <em>수십 배</em> 큼.</p>
<p>geo-level 의 <em>진짜</em> 가치 는 leakage 가 있을 때 <em>bias 제거</em>. user-level 의 작은 SE 는 <em>biased estimator</em> 의 SE — 무의미.</p>
<p>규칙: leakage 가 있으면 작은 SE 라도 잘못된 의사결정. unbiased 추정량 의 큰 SE 가 <em>올바른</em> 추정.</p>
</div>
</div>
</section>
<section id="응용" class="level2" data-number="11">
<h2 data-number="11" class="anchored" data-anchor-id="응용"><span class="header-section-number">11</span> 응용</h2>
<ul>
<li>사회 네트워크 의 engagement 실험: ego-centric + edge-level</li>
<li>Marketplace (Airbnb, Uber): geo + CUPED + DiD</li>
<li>Ad platform: budget split + ramp monitoring + scenario testing</li>
<li>Search relevance: model 분리 학습 + holdback experiment</li>
<li>Streaming platform: time-based switchback (콘텐츠 인기 의 시간 의존)</li>
</ul>
</section>
<section id="실무-체크리스트" class="level2" data-number="12">
<h2 data-number="12" class="anchored" data-anchor-id="실무-체크리스트"><span class="header-section-number">12</span> 실무 체크리스트</h2>
<ol type="1">
<li>매개체 식별 (graph·자원·시간·사용자 unit)</li>
<li>매개체 에 맞는 isolation 1 차 선택</li>
<li>variance 보강 (CUPED·paired t-test·stratification) 결합</li>
<li>ramp 단계 마다 outlier 점검</li>
<li>monitoring alert 자동화 (CPU, budget, training data)</li>
<li>sample size 계산 시 isolation 의 variance 증가 미리 반영</li>
<li>SRM (Ch.21) 점검 — isolation 가 design ratio 무너뜨릴 수 있음</li>
</ol>
</section>
<section id="관련-주제" class="level2" data-number="13">
<h2 data-number="13" class="anchored" data-anchor-id="관련-주제"><span class="header-section-number">13</span> 관련 주제</h2>
<ul>
<li>F22-0 overview — Ch.22 전체 지도</li>
<li>F22-1 — Direct·Indirect 6 사례</li>
<li>F22-2 — Rule-of-Thumb · Ecosystem Value</li>
<li>Ch.14 (F-KOH14) — Randomization unit 의 trade-off</li>
<li>Ch.15 (F-KOH15) — Ramp 의 leakage 점검</li>
<li>Ch.18 (F-KOH18) — CUPED variance reduction</li>
<li>Ch.21 (F-KOH21) — SRM 점검</li>
<li>J-SWITCH 시리즈 — Time-based 의 일반화</li>
</ul>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
출처
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li>Kohavi, Tang, Xu (2020). <em>Trustworthy Online Controlled Experiments.</em> Ch.22.4~22.6.</li>
<li>Vaver and Koehler (2011, 2012). Geo-based experiments.</li>
<li>Bojinov and Shephard (2017). Time series experiments and causal estimands.</li>
<li>Hohnhold, O’Brien, Tang (2015). “Focus on the Long-Term.”</li>
<li>Gui, Xu, Bhasin, Han (2015). “Network A/B Testing.”</li>
<li>Backstrom and Kleinberg (2011). “Network Bucket Testing.” WWW 2011.</li>
<li>Saint-Jacques et al.&nbsp;(2018, 2018b). LinkedIn ego-centric randomization.</li>
<li>Cox (1958). <em>Planning of Experiments</em>.</li>
<li>Katzir, Liberty, Somekh (2012). “Network Bucket Testing.”</li>
</ul>
</div>
</div>


</section>

 ]]></description>
  <category>Experimentation</category>
  <category>A/B Test</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F22-3-isolation-edge-detection.html</guid>
  <pubDate>Fri, 08 May 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Kohavi Ch.23 개관 — Long-Term Treatment Effects (장기 처리 효과)</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F23-0-long-term-effects-overview.html</link>
  <description><![CDATA[ 





<section id="정의" class="level2" data-number="1">
<h2 data-number="1" class="anchored" data-anchor-id="정의"><span class="header-section-number">1</span> 정의</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
정의: Long-Term Treatment Effect (장기 처리 효과)
</div>
</div>
<div class="callout-body-container callout-body">
<p>Treatment 의 <em>asymptotic</em> (점근) 효과 — 시간이 매우 길어졌을 때 의 결과 (Kohavi, Tang, Xu, 2020, Ch.23).</p>
<section id="실무-정의" class="level5" data-number="1.0.0.1">
<h5 data-number="1.0.0.1" class="anchored" data-anchor-id="실무-정의"><span class="header-section-number">1.0.0.1</span> 실무 정의</h5>
<ul>
<li>이론 적: <img src="https://latex.codecogs.com/png.latex?t%20%5Cto%20%5Cinfty"> 의 effect</li>
<li>실무 적: 3+ months 또는 <em>exposure 횟수</em> (예: feature 10 회 이상 노출 한 user 의 effect)</li>
</ul>
</section>
<section id="short-term-과-의-비교" class="level5" data-number="1.0.0.2">
<h5 data-number="1.0.0.2" class="anchored" data-anchor-id="short-term-과-의-비교"><span class="header-section-number">1.0.0.2</span> Short-term 과 의 비교</h5>
<ul>
<li><strong>Short-term</strong>: 1~2 주 의 average effect — 책 권장 일반 실험 기간</li>
<li><strong>Long-term</strong>: 3 개월 + 또는 사용자 의 <em>adapted</em> 행동 의 effect</li>
</ul>
</section>
<section id="인용-roy-amara" class="level5" data-number="1.0.0.3">
<h5 data-number="1.0.0.3" class="anchored" data-anchor-id="인용-roy-amara"><span class="header-section-number">1.0.0.3</span> 인용 (Roy Amara)</h5>
<p>“We tend to overestimate the effect of a technology in the short run and underestimate the effect in the long run.”</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관
</div>
</div>
<div class="callout-body-container callout-body">
<p>short-term effect 가 long-term effect 와 <em>같다</em> 는 가정 은 <em>대부분 의 실험</em> 에서 맞다. 하지만 <em>예외</em> 가 위험:</p>
<ul>
<li>가격 인상: 단기 revenue ↑, 장기 user abandon 으로 ↓</li>
<li>광고 ↑: 단기 click ↑, 장기 사용자 회피 로 search 감소</li>
<li>검색 품질 저하: 단기 query 증가 (재검색), 장기 사용자 이탈</li>
</ul>
<p>레슨: short-term ≠ long-term 이 <em>언제</em> 발생 하는지 알아야 한다. 알 수 없는 경우 <em>명시적 long-term 측정</em> 필요.</p>
</div>
</div>
</section>
<section id="왜-long-term-이-다른가-6-갈래" class="level2" data-number="2">
<h2 data-number="2" class="anchored" data-anchor-id="왜-long-term-이-다른가-6-갈래"><span class="header-section-number">2</span> 왜 long-term 이 다른가 — 6 갈래</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
1. User-Learned Effects
</div>
</div>
<div class="callout-body-container callout-body">
<section id="mechanism" class="level5" data-number="2.0.0.1">
<h5 data-number="2.0.0.1" class="anchored" data-anchor-id="mechanism"><span class="header-section-number">2.0.0.1</span> Mechanism</h5>
<ul>
<li>사용자 가 새 feature 에 <em>학습·적응</em> 하면서 행동 변화</li>
<li>시간 따라 <em>equilibrium</em> 도달</li>
</ul>
</section>
<section id="예시" class="level5" data-number="2.0.0.2">
<h5 data-number="2.0.0.2" class="anchored" data-anchor-id="예시"><span class="header-section-number">2.0.0.2</span> 예시</h5>
<ul>
<li>product crash: 첫 occurrence 에는 사용자 떠나지 않음, 반복 시 떠남</li>
<li>low-quality ad: 사용자 가 학습 → click rate 감소</li>
<li>새 feature 의 discoverability: 처음 못 발견 → 시간 지나 발견 → engagement 증가</li>
<li>novelty effect: 처음 관심 → 시간 지나 desensitized</li>
</ul>
</section>
<section id="인용" class="level5" data-number="2.0.0.3">
<h5 data-number="2.0.0.3" class="anchored" data-anchor-id="인용"><span class="header-section-number">2.0.0.3</span> 인용</h5>
<p>Hohnhold et al.&nbsp;(2015), Huang, Reiley, Raibov (2018), Kohavi et al.&nbsp;(2009)</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
2. Network Effects
</div>
</div>
<div class="callout-body-container callout-body">
<section id="mechanism-1" class="level5" data-number="2.0.0.4">
<h5 data-number="2.0.0.4" class="anchored" data-anchor-id="mechanism-1"><span class="header-section-number">2.0.0.4</span> Mechanism</h5>
<ul>
<li>feature 의 가치 가 <em>친구 사용 비율</em> 에 의존</li>
<li>viral 전파 의 시간 lag</li>
</ul>
</section>
<section id="예시-1" class="level5" data-number="2.0.0.5">
<h5 data-number="2.0.0.5" class="anchored" data-anchor-id="예시-1"><span class="header-section-number">2.0.0.5</span> 예시</h5>
<ul>
<li>Live Video (Facebook Messenger, Skype): 친구 가 사용해야 본인 도 사용</li>
<li>Two-sided marketplace (Airbnb): 새 feature 가 demand ↑ → supply 늦게 catch up</li>
</ul>
</section>
<section id="long-term-측정-의-도전" class="level5" data-number="2.0.0.6">
<h5 data-number="2.0.0.6" class="anchored" data-anchor-id="long-term-측정-의-도전"><span class="header-section-number">2.0.0.6</span> Long-term 측정 의 도전</h5>
<p>network effect 는 supply 제약 마저 결합:</p>
<pre><code>Treatment effect 가 short-term 에 demand 폭증
중간기 supply 부족 → revenue 정체
장기 supply 도 catch up → revenue 회복 (또는 새 equilibrium)</code></pre>
<p>short-term 의 demand spike 가 <em>과장</em> 된 effect, 장기 의 <em>equilibrium</em> 이 진짜.</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
3. Delayed Experience and Measurement
</div>
</div>
<div class="callout-body-container callout-body">
<section id="mechanism-2" class="level5" data-number="2.0.0.7">
<h5 data-number="2.0.0.7" class="anchored" data-anchor-id="mechanism-2"><span class="header-section-number">2.0.0.7</span> Mechanism</h5>
<ul>
<li>사용자 의 <em>online</em> 경험 과 <em>offline</em> 결과 사이 시간 gap</li>
<li>측정 metric 이 누적 cumulative</li>
</ul>
</section>
<section id="예시-2" class="level5" data-number="2.0.0.8">
<h5 data-number="2.0.0.8" class="anchored" data-anchor-id="예시-2"><span class="header-section-number">2.0.0.8</span> 예시</h5>
<ul>
<li>Airbnb·Booking.com: 예약 후 몇 달 뒤 도착 → user retention 의 변화 가 늦게 반영</li>
<li>연간 계약: 1 년 후 갱신 의사결정 시점 까지 effect 누적</li>
<li>학생 학습: feature 가 학기말 시험에 effect 반영</li>
</ul>
</section>
<section id="long-term-의-의무" class="level5" data-number="2.0.0.9">
<h5 data-number="2.0.0.9" class="anchored" data-anchor-id="long-term-의-의무"><span class="header-section-number">2.0.0.9</span> Long-term 의 의무</h5>
<p>이런 영역 은 <em>short-term metric 만 으로</em> 결정 시 큰 위험 — 장기 retention 의 측정 필수.</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
4. Ecosystem Change
</div>
</div>
<div class="callout-body-container callout-body">
<p>여러 sub-mechanism:</p>
<section id="other-features-launching" class="level5" data-number="2.0.0.10">
<h5 data-number="2.0.0.10" class="anchored" data-anchor-id="other-features-launching"><span class="header-section-number">2.0.0.10</span> Other features launching</h5>
<ul>
<li>다른 팀 의 새 feature 가 launch → 본 feature 의 가치 변화</li>
<li>예: Live Video 가 더 많은 product 에 embed → 본 feature 의 marginal value 증가</li>
</ul>
</section>
<section id="seasonality" class="level5" data-number="2.0.0.11">
<h5 data-number="2.0.0.11" class="anchored" data-anchor-id="seasonality"><span class="header-section-number">2.0.0.11</span> Seasonality</h5>
<ul>
<li>gift card 가 Christmas 에 잘 작동, 다른 계절 에 약함</li>
<li>back-to-school, holiday season 등 의 강한 시간성</li>
</ul>
</section>
<section id="competitive-landscape" class="level5" data-number="2.0.0.12">
<h5 data-number="2.0.0.12" class="anchored" data-anchor-id="competitive-landscape"><span class="header-section-number">2.0.0.12</span> Competitive landscape</h5>
<ul>
<li>경쟁사 가 같은 feature launch → 본 feature 의 차별성 감소</li>
<li>launch 시점 따라 effect 매우 다름</li>
</ul>
</section>
<section id="government-policies" class="level5" data-number="2.0.0.13">
<h5 data-number="2.0.0.13" class="anchored" data-anchor-id="government-policies"><span class="header-section-number">2.0.0.13</span> Government policies</h5>
<ul>
<li>GDPR 의 ad targeting 영향 — 데이터 사용 가능 범위 변화</li>
<li>새 정책 의 effect 가 ramp 형태 로 누적</li>
</ul>
</section>
<section id="concept-drift" class="level5" data-number="2.0.0.14">
<h5 data-number="2.0.0.14" class="anchored" data-anchor-id="concept-drift"><span class="header-section-number">2.0.0.14</span> Concept drift</h5>
<ul>
<li>ML model 의 학습 데이터 분포 가 변화</li>
<li>model 의 성능 점차 degrade</li>
</ul>
</section>
<section id="software-rot" class="level5" data-number="2.0.0.15">
<h5 data-number="2.0.0.15" class="anchored" data-anchor-id="software-rot"><span class="header-section-number">2.0.0.15</span> Software rot</h5>
<ul>
<li>maintain 안 되는 feature 가 환경 변화 따라 degrade</li>
<li>시스템 가정 의 invalidation</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 6 갈래 의 시간 척도
</div>
</div>
<div class="callout-body-container callout-body">
<table class="table">
<thead>
<tr class="header">
<th>Mechanism</th>
<th>typical 척도</th>
<th>측정 가능성</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>User-learned</td>
<td>주~월</td>
<td>high (post-period)</td>
</tr>
<tr class="even">
<td>Network</td>
<td>월~분기</td>
<td>medium (cohort)</td>
</tr>
<tr class="odd">
<td>Delayed measurement</td>
<td>분기~년</td>
<td>low (cohort + waiting)</td>
</tr>
<tr class="even">
<td>Ecosystem change</td>
<td>분기~년</td>
<td>low (exogenous)</td>
</tr>
<tr class="odd">
<td>Concept drift</td>
<td>분기</td>
<td>medium (model 비교)</td>
</tr>
<tr class="even">
<td>Software rot</td>
<td>년</td>
<td>low (software audit)</td>
</tr>
</tbody>
</table>
<p>규칙: 짧은 척도 (user-learned, network) 는 측정 가능, 긴 척도 (delayed, ecosystem) 는 <em>exogenous factor</em> 와 분리 어려움.</p>
</div>
</div>
</section>
<section id="측정-목적-3-가지" class="level2" data-number="3">
<h2 data-number="3" class="anchored" data-anchor-id="측정-목적-3-가지"><span class="header-section-number">3</span> 측정 목적 — 3 가지</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
1. Attribution
</div>
</div>
<div class="callout-body-container callout-body">
<section id="정의-1" class="level5" data-number="3.0.0.1">
<h5 data-number="3.0.0.1" class="anchored" data-anchor-id="정의-1"><span class="header-section-number">3.0.0.1</span> 정의</h5>
<p>새 feature 가 <em>얼마 만큼</em> 의 long-term value 를 만들었는가? 팀 목표 추적 + 재무 forecast 에 사용.</p>
</section>
<section id="도전" class="level5" data-number="3.0.0.2">
<h5 data-number="3.0.0.2" class="anchored" data-anchor-id="도전"><span class="header-section-number">3.0.0.2</span> 도전</h5>
<ul>
<li><em>endogenous</em> (user-learned) 와 <em>exogenous</em> (경쟁 변화) 의 분리</li>
<li><em>compounding</em> — 새 feature 가 이전 feature 위 에 build → 누적 attribution 어려움</li>
</ul>
</section>
<section id="사용-사례" class="level5" data-number="3.0.0.3">
<h5 data-number="3.0.0.3" class="anchored" data-anchor-id="사용-사례"><span class="header-section-number">3.0.0.3</span> 사용 사례</h5>
<p>OKRs 또는 KPI tracking 시 기능 별 정확한 long-term 기여도 필요.</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
2. Institutional Learning
</div>
</div>
<div class="callout-body-container callout-body">
<section id="정의-2" class="level5" data-number="3.0.0.4">
<h5 data-number="3.0.0.4" class="anchored" data-anchor-id="정의-2"><span class="header-section-number">3.0.0.4</span> 정의</h5>
<p>short-term 과 long-term 의 <em>차이</em> 자체 를 학습 — 왜 다른가?</p>
</section>
<section id="통찰" class="level5" data-number="3.0.0.5">
<h5 data-number="3.0.0.5" class="anchored" data-anchor-id="통찰"><span class="header-section-number">3.0.0.5</span> 통찰</h5>
<ul>
<li>큰 novelty effect → user discovery 가 너무 느림 → in-product education 으로 교정 가능</li>
<li>큰 abandon rate → low quality 또는 click-bait — 다음 iteration 의 설계 정보</li>
</ul>
</section>
<section id="사용-사례-1" class="level5" data-number="3.0.0.6">
<h5 data-number="3.0.0.6" class="anchored" data-anchor-id="사용-사례-1"><span class="header-section-number">3.0.0.6</span> 사용 사례</h5>
<p>product team 의 design pattern·UX 개선 의 fine-grained insight.</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
3. Generalization
</div>
</div>
<div class="callout-body-container callout-body">
<section id="정의-3" class="level5" data-number="3.0.0.7">
<h5 data-number="3.0.0.7" class="anchored" data-anchor-id="정의-3"><span class="header-section-number">3.0.0.7</span> 정의</h5>
<p>특정 실험 의 long-term 측정을 <em>다른 비슷한 실험</em> 의 short-term 으로 부터 외삽 (extrapolate).</p>
</section>
<section id="사용-사례-hohnhold-et-al.-2015" class="level5" data-number="3.0.0.8">
<h5 data-number="3.0.0.8" class="anchored" data-anchor-id="사용-사례-hohnhold-et-al.-2015"><span class="header-section-number">3.0.0.8</span> 사용 사례 (Hohnhold et al.&nbsp;2015)</h5>
<ul>
<li>광고 ad-load 실험 의 historical long-term 데이터</li>
<li>새 ad-load 변화 의 short-term effect 만 으로 long-term 예측</li>
</ul>
</section>
<section id="도전-1" class="level5" data-number="3.0.0.9">
<h5 data-number="3.0.0.9" class="anchored" data-anchor-id="도전-1"><span class="header-section-number">3.0.0.9</span> 도전</h5>
<ul>
<li>exogenous factor 와 의 분리 (기간 별 다른 economic 환경)</li>
<li>generalize 가능 한 <em>general principle</em> 인지 검증</li>
</ul>
</section>
<section id="가치" class="level5" data-number="3.0.0.10">
<h5 data-number="3.0.0.10" class="anchored" data-anchor-id="가치"><span class="header-section-number">3.0.0.10</span> 가치</h5>
<p>generalize 가능 시 <em>모든 새 실험</em> 에 short-term → long-term mapping 즉시 적용.</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 목적 의 우선 순위
</div>
</div>
<div class="callout-body-container callout-body">
<p>이 3 가지 는 <em>서로 다른 method</em> 를 요구:</p>
<ul>
<li>Attribution: cohort analysis + holdback experiment</li>
<li>Institutional learning: post-period analysis (학습 효과 의 명시적 측정)</li>
<li>Generalization: time-staggered + 누적 실험 데이터 의 회귀</li>
</ul>
<p>선택 의 원칙: <em>왜 long-term 측정 하는가</em> 를 먼저 정의 → 적합 method 선택.</p>
</div>
</div>
</section>
<section id="가지-측정-method-한눈에" class="level2" data-number="4">
<h2 data-number="4" class="anchored" data-anchor-id="가지-측정-method-한눈에"><span class="header-section-number">4</span> 4 가지 측정 Method — 한눈에</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Method #1: Cohort Analysis
</div>
</div>
<div class="callout-body-container callout-body">
<section id="절차" class="level5" data-number="4.0.0.1">
<h5 data-number="4.0.0.1" class="anchored" data-anchor-id="절차"><span class="header-section-number">4.0.0.1</span> 절차</h5>
<ul>
<li>실험 시작 전 stable cohort 정의 (logged-in user ID 또는 stable identifier)</li>
<li>이 cohort 의 short-term, long-term effect 만 분석</li>
</ul>
</section>
<section id="강점" class="level5" data-number="4.0.0.2">
<h5 data-number="4.0.0.2" class="anchored" data-anchor-id="강점"><span class="header-section-number">4.0.0.2</span> 강점</h5>
<ul>
<li><em>dilution</em> 보정 (multi-device 의 일부 만 capture)</li>
<li><em>survivorship bias</em> 일부 보정 (cohort 가 안정 적일 때)</li>
</ul>
</section>
<section id="한계" class="level5" data-number="4.0.0.3">
<h5 data-number="4.0.0.3" class="anchored" data-anchor-id="한계"><span class="header-section-number">4.0.0.3</span> 한계</h5>
<ul>
<li>cohort 가 representative 아닌 경우 external validity 위협</li>
<li>cookie-based ID 처럼 churn 큰 경우 작동 안 함</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Method #2: Post-Period Analysis
</div>
</div>
<div class="callout-body-container callout-body">
<section id="절차-1" class="level5" data-number="4.0.0.4">
<h5 data-number="4.0.0.4" class="anchored" data-anchor-id="절차-1"><span class="header-section-number">4.0.0.4</span> 절차</h5>
<ul>
<li>실험 종료 후 모두 Treatment 또는 모두 Control 로 통일 (= A/A 상태)</li>
<li>기존 Treatment·Control group 의 <em>post-period 의 metric 차이</em> 측정</li>
</ul>
</section>
<section id="측정-의미" class="level5" data-number="4.0.0.5">
<h5 data-number="4.0.0.5" class="anchored" data-anchor-id="측정-의미"><span class="header-section-number">4.0.0.5</span> 측정 의미</h5>
<ul>
<li><em>learning effect</em> (Hohnhold et al.&nbsp;2015) — 사용자·시스템 이 학습 한 결과</li>
<li>user-learned vs system-learned 분리 가능</li>
</ul>
</section>
<section id="강점-1" class="level5" data-number="4.0.0.6">
<h5 data-number="4.0.0.6" class="anchored" data-anchor-id="강점-1"><span class="header-section-number">4.0.0.6</span> 강점</h5>
<ul>
<li>exogenous factor 의 분리 (post-period 는 모두 같은 environment)</li>
<li>새 feature 와 의 interaction 차단</li>
</ul>
</section>
<section id="한계-1" class="level5" data-number="4.0.0.7">
<h5 data-number="4.0.0.7" class="anchored" data-anchor-id="한계-1"><span class="header-section-number">4.0.0.7</span> 한계</h5>
<ul>
<li>dilution·survivorship bias 잔존</li>
<li>system-learned effect 가 0 인 경우 만 정확 (개인화·opt-out 등 은 system-learned 발생)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Method #3: Time-Staggered Treatments
</div>
</div>
<div class="callout-body-container callout-body">
<section id="절차-2" class="level5" data-number="4.0.0.8">
<h5 data-number="4.0.0.8" class="anchored" data-anchor-id="절차-2"><span class="header-section-number">4.0.0.8</span> 절차</h5>
<ul>
<li>같은 Treatment 의 두 버전: <img src="https://latex.codecogs.com/png.latex?T_0"> (시점 <img src="https://latex.codecogs.com/png.latex?t=0"> 시작), <img src="https://latex.codecogs.com/png.latex?T_1"> (시점 <img src="https://latex.codecogs.com/png.latex?t=1"> 시작)</li>
<li>시점 <img src="https://latex.codecogs.com/png.latex?t%20%3E%201"> 에서 두 버전 의 <em>효과 차이</em> 측정 — A/A 인 셈</li>
</ul>
</section>
<section id="의미" class="level5" data-number="4.0.0.9">
<h5 data-number="4.0.0.9" class="anchored" data-anchor-id="의미"><span class="header-section-number">4.0.0.9</span> 의미</h5>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?T_1(t)%20-%20T_0(t)%20%5Cto%200"> 가 <em>수렴</em> 의 신호</li>
<li>수렴 시점 = long-term effect 측정 가능 시점</li>
<li>후 post-period method 적용</li>
</ul>
</section>
<section id="강점-2" class="level5" data-number="4.0.0.10">
<h5 data-number="4.0.0.10" class="anchored" data-anchor-id="강점-2"><span class="header-section-number">4.0.0.10</span> 강점</h5>
<ul>
<li><em>명시적</em> 수렴 판단 — “충분 한 시간” 의 객관적 기준</li>
<li>큰 변동 (요일·계절성) 보정 가능</li>
</ul>
</section>
<section id="한계-2" class="level5" data-number="4.0.0.11">
<h5 data-number="4.0.0.11" class="anchored" data-anchor-id="한계-2"><span class="header-section-number">4.0.0.11</span> 한계</h5>
<ul>
<li>두 staggered 사이 의 <em>충분 한 시간 gap</em> 필요 (학습 시간 보다 길게)</li>
<li><img src="https://latex.codecogs.com/png.latex?T_1(t)%20-%20T_0(t)"> 의 작은 차이 검출 위해 power 필요 (Type II error rate 낮춤)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Method #4: Holdback and Reverse Experiment
</div>
</div>
<div class="callout-body-container callout-body">
<section id="holdback" class="level5" data-number="4.0.0.12">
<h5 data-number="4.0.0.12" class="anchored" data-anchor-id="holdback"><span class="header-section-number">4.0.0.12</span> Holdback</h5>
<ul>
<li>launch 후 10% user 를 Control 에 <em>유지</em></li>
<li>90% Treatment, 10% Control 의 분석 을 몇 주~몇 달 지속</li>
</ul>
</section>
<section id="reverse-experiment" class="level5" data-number="4.0.0.13">
<h5 data-number="4.0.0.13" class="anchored" data-anchor-id="reverse-experiment"><span class="header-section-number">4.0.0.13</span> Reverse experiment</h5>
<ul>
<li>100% launch 후 10% 를 <em>Control 로 되돌림</em></li>
<li>모든 user 가 한 번은 Treatment 경험 후 의 변화 측정</li>
</ul>
</section>
<section id="강점-3" class="level5" data-number="4.0.0.14">
<h5 data-number="4.0.0.14" class="anchored" data-anchor-id="강점-3"><span class="header-section-number">4.0.0.14</span> 강점</h5>
<ul>
<li>launch 후 의 long-term effect 직접 측정 (real launch state)</li>
<li>network·equilibrium effect 도달 후 측정 가능</li>
</ul>
</section>
<section id="한계-3" class="level5" data-number="4.0.0.15">
<h5 data-number="4.0.0.15" class="anchored" data-anchor-id="한계-3"><span class="header-section-number">4.0.0.15</span> 한계</h5>
<ul>
<li>Control group 의 opportunity cost (launch 받지 못함)</li>
<li>작은 Control → power 부족</li>
<li>reverse experiment: 사용자 confusion 위험 (UI 변화 의 reversal)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: method 선택 의 매트릭스
</div>
</div>
<div class="callout-body-container callout-body">
<table class="table">
<thead>
<tr class="header">
<th>도전</th>
<th>1차 추천 method</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>dilution + survivorship</td>
<td>Cohort + Post-Period</td>
</tr>
<tr class="even">
<td>user learning 분리</td>
<td>Post-Period</td>
</tr>
<tr class="odd">
<td>수렴 시점 판단</td>
<td>Time-Staggered</td>
</tr>
<tr class="even">
<td>launch 후 monitoring</td>
<td>Holdback</td>
</tr>
<tr class="odd">
<td>시간 gap 측정 정밀화</td>
<td>Time-Staggered + Post-Period</td>
</tr>
</tbody>
</table>
<p>규칙: 한 method 가 모든 도전을 해결 하지 않음. <em>결합</em> 이 일반적 — Cohort + Post-Period 또는 Time-Staggered + Post-Period.</p>
</div>
</div>
</section>
<section id="비교" class="level2" data-number="5">
<h2 data-number="5" class="anchored" data-anchor-id="비교"><span class="header-section-number">5</span> 비교</h2>
<table class="table">
<colgroup>
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
</colgroup>
<thead>
<tr class="header">
<th>차원</th>
<th>Long-Running 단순</th>
<th>Cohort</th>
<th>Post-Period</th>
<th>Time-Staggered</th>
<th>Holdback</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>구현 비용</td>
<td>낮음</td>
<td>중간</td>
<td>중간</td>
<td>높음</td>
<td>중간</td>
</tr>
<tr class="even">
<td>Dilution 보정</td>
<td>약</td>
<td>강</td>
<td>약 (잔존)</td>
<td>중</td>
<td>중</td>
</tr>
<tr class="odd">
<td>Survivorship 보정</td>
<td>없음</td>
<td>강 (안정 cohort)</td>
<td>약</td>
<td>중</td>
<td>약</td>
</tr>
<tr class="even">
<td>학습 효과 측정</td>
<td>함께 측정</td>
<td>함께 측정</td>
<td><em>분리</em> 측정</td>
<td>분리</td>
<td>함께</td>
</tr>
<tr class="odd">
<td>수렴 판단</td>
<td>trend 관찰</td>
<td>동일</td>
<td>모름</td>
<td><em>명시적</em></td>
<td>모름</td>
</tr>
<tr class="even">
<td>Launch 후 monitoring</td>
<td>no</td>
<td>yes</td>
<td>yes</td>
<td>no</td>
<td>yes</td>
</tr>
<tr class="odd">
<td>Power</td>
<td>medium</td>
<td>medium</td>
<td>medium</td>
<td>medium</td>
<td>low (10% C)</td>
</tr>
</tbody>
</table>
</section>
<section id="응용" class="level2" data-number="6">
<h2 data-number="6" class="anchored" data-anchor-id="응용"><span class="header-section-number">6</span> 응용</h2>
<ul>
<li><strong>Search ranking</strong>: long-running + post-period (학습 효과 측정)</li>
<li><strong>Ad load</strong>: time-staggered (수렴 판단) + holdback (launch 후 monitoring)</li>
<li><strong>Marketplace</strong>: cohort (logged-in user) + reverse experiment (equilibrium 도달)</li>
<li><strong>Personalization</strong>: post-period (system-learned 분리 어려움 — 한계 명시)</li>
<li><strong>Subscription</strong>: cohort (sign-up 시점 분리) + holdback (renewal 측정)</li>
</ul>
</section>
<section id="phase-f-의-후속-글" class="level2" data-number="7">
<h2 data-number="7" class="anchored" data-anchor-id="phase-f-의-후속-글"><span class="header-section-number">7</span> Phase F 의 후속 글</h2>
<ul>
<li>F23-1: What Are + Why Differ + Why Measure — 단기/장기 차이의 6 갈래 와 측정 목적</li>
<li>F23-2: Long-Running Experiments — 단순 long-running 의 4 가지 한계</li>
<li>F23-3: Methods 1~4 — Cohort, Post-Period, Time-Staggered, Holdback 의 디테일</li>
</ul>
</section>
<section id="관련-주제" class="level2" data-number="8">
<h2 data-number="8" class="anchored" data-anchor-id="관련-주제"><span class="header-section-number">8</span> 관련 주제</h2>
<ul>
<li>Ch.3 (Twyman’s Law) — short-term·long-term 차이 의 원인 일부</li>
<li>Ch.6 (F-KOH6) — Goal/Driver/Guardrail metric — long-term 측정 의 metric 설계</li>
<li>Ch.7 (F-KOH7) — OEC 가 short-term 측정 가능 + long-term 영향 가능 으로 정의 됨</li>
<li>Ch.15 (F-KOH15) — Ramp Long-Term Holdout 단계</li>
<li>Ch.22 (F-KOH22) — Network leakage 와 long-term 의 결합</li>
<li>D-21 (Hernan 22) — Target Trial Emulation 의 follow-up time</li>
</ul>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
출처
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li>Kohavi, Tang, Xu (2020). <em>Trustworthy Online Controlled Experiments.</em> Ch.23.</li>
<li>Hohnhold, O’Brien, Tang (2015). “Focus on the Long-Term.” KDD 2015.</li>
<li>Dmitriev, Frasca, Gupta, Kohavi, Vaz (2016). “Pitfalls of Long-Term Online Controlled Experiments.” IEEE Big Data 2016.</li>
<li>Huang, Reiley, Raibov (2018). “Pandora Listener Demand Curve.”</li>
<li>Chen, Liu, Xu (2019). “How A/B Tests Could Go Wrong.” WSDM 2019.</li>
<li>Gupta et al.&nbsp;(2019). “Top Challenges from the OCE Summit.” SIGKDD Explorations.</li>
<li>Xu, Duan, Huang (2018). “Holdback Experiment.”</li>
<li>Varian (2007). Control group opportunity cost.</li>
</ul>
</div>
</div>


</section>

 ]]></description>
  <category>Experimentation</category>
  <category>A/B Test</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F23-0-long-term-effects-overview.html</guid>
  <pubDate>Fri, 08 May 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Kohavi Ch.23.1~23.3 — Long-Term Effect 의 정의 · 단기/장기 차이의 6 갈래 · 측정 목적 3 가지</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F23-1-what-are-why-differ-why-measure.html</link>
  <description><![CDATA[ 





<section id="정의" class="level2" data-number="1">
<h2 data-number="1" class="anchored" data-anchor-id="정의"><span class="header-section-number">1</span> 정의</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
정의: Long-Term Treatment Effect
</div>
</div>
<div class="callout-body-container callout-body">
<p>Treatment 의 <em>asymptotic</em> (점근) 효과 — 시간이 매우 길어졌을 때 의 결과 (Kohavi, Tang, Xu, 2020, Ch.23).</p>
<section id="실무-판정-기준" class="level5" data-number="1.0.0.1">
<h5 data-number="1.0.0.1" class="anchored" data-anchor-id="실무-판정-기준"><span class="header-section-number">1.0.0.1</span> 실무 판정 기준</h5>
<ul>
<li><strong>이론</strong>: <img src="https://latex.codecogs.com/png.latex?t%20%5Cto%20%5Cinfty"></li>
<li><strong>실무</strong>: 3+ 개월 <em>또는</em> 일정 횟수 의 노출 (예: feature 10 회 이상 본 user)</li>
</ul>
</section>
<section id="short-term-의-정의" class="level5" data-number="1.0.0.2">
<h5 data-number="1.0.0.2" class="anchored" data-anchor-id="short-term-의-정의"><span class="header-section-number">1.0.0.2</span> Short-term 의 정의</h5>
<ul>
<li>1~2 주 의 <em>average</em> effect (책 권장 일반 실험 기간)</li>
<li>“stable 하고 generalizes 한다” 는 가정 하에 long-term 의 proxy 로 사용</li>
</ul>
</section>
<section id="가정-의-부하" class="level5" data-number="1.0.0.3">
<h5 data-number="1.0.0.3" class="anchored" data-anchor-id="가정-의-부하"><span class="header-section-number">1.0.0.3</span> 가정 의 부하</h5>
<p>대부분 의 실험에서 short-term ≈ long-term <em>가정</em> 이 작동. 하지만 이 가정 이 깨질 가능성 을 인지하고 <em>언제</em> 깨지는지 알아야 한다.</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 시간 의 두 척도
</div>
</div>
<div class="callout-body-container callout-body">
<p>비유 — 식이 요법:</p>
<ul>
<li><strong>short-term</strong> (1 주): 체중 ↓ (수분 손실)</li>
<li><strong>long-term</strong> (1 년): 체중 ↑ 또는 ↓ (실제 체질 변화 또는 yo-yo 효과)</li>
</ul>
<p>short-term 의 편의적 metric 만 보고 launch 결정 하면 <em>yo-yo</em> 위험.</p>
<p>레슨: short-term 이 long-term 과 <em>다를 수 있는 영역</em> 을 식별 → 명시적 측정.</p>
</div>
</div>
</section>
<section id="user-learned-effects" class="level2" data-number="2">
<h2 data-number="2" class="anchored" data-anchor-id="user-learned-effects"><span class="header-section-number">2</span> 1. User-Learned Effects</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<p>사용자 가 새 feature 에 <em>학습· adapt</em> 하면서 행동 변화. 시간 따라 <em>equilibrium</em> 도달.</p>
<section id="가지-sub-mechanism" class="level5" data-number="2.0.0.1">
<h5 data-number="2.0.0.1" class="anchored" data-anchor-id="가지-sub-mechanism"><span class="header-section-number">2.0.0.1</span> 5 가지 sub-mechanism</h5>
<ol type="1">
<li><strong>Crash 누적</strong>: 첫 occurrence 에는 사용자 떠나지 않음, 반복 시 떠남</li>
<li><strong>Quality 학습</strong>: low-quality ad 의 click rate 가 시간 따라 ↓</li>
<li><strong>Discoverability</strong>: 새 feature 를 처음 못 발견 → 시간 지나 발견 → engagement ↑</li>
<li><strong>Priming</strong>: 기존 feature 에 익숙 → 새 feature 학습 에 시간 필요</li>
<li><strong>Novelty exploration</strong>: 처음 호기심 → 시간 지나 desensitized</li>
</ol>
</section>
<section id="인용" class="level5" data-number="2.0.0.2">
<h5 data-number="2.0.0.2" class="anchored" data-anchor-id="인용"><span class="header-section-number">2.0.0.2</span> 인용</h5>
<ul>
<li>Hohnhold et al.&nbsp;(2015): ad-load 의 user-learned effect</li>
<li>Huang, Reiley, Raibov (2018): Pandora 의 ad sensitivity 학습</li>
<li>Chen, Liu, Xu (2019): A/B 의 invalid pattern 진단</li>
<li>Kohavi et al.&nbsp;(2009): Seven Pitfalls</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
사례 디테일
</div>
</div>
<div class="callout-body-container callout-body">
<section id="crash-example" class="level5" data-number="2.0.0.3">
<h5 data-number="2.0.0.3" class="anchored" data-anchor-id="crash-example"><span class="header-section-number">2.0.0.3</span> Crash example</h5>
<ul>
<li>Treatment 가 새 feature 도입 — 0.5% crash rate 추가</li>
<li>Day 1: 사용자 첫 crash → “이상한데”</li>
<li>Day 7: 두 번째 crash → 의구심</li>
<li>Day 30: 다섯 번째 crash → 사용자 떠남</li>
<li>short-term: 사용자 retention 변화 미미</li>
<li>long-term: 사용자 retention 큰 감소</li>
</ul>
</section>
<section id="discoverability-example" class="level5" data-number="2.0.0.4">
<h5 data-number="2.0.0.4" class="anchored" data-anchor-id="discoverability-example"><span class="header-section-number">2.0.0.4</span> Discoverability example</h5>
<ul>
<li>Treatment 가 new shortcut button 추가</li>
<li>Day 1: 사용자 의 5% 만 발견</li>
<li>Day 14: 사용자 의 25% 발견·사용</li>
<li>Day 60: 사용자 의 50% 발견·사용</li>
<li>short-term: small effect</li>
<li>long-term: large effect (with right metric)</li>
</ul>
</section>
<section id="novelty-effect" class="level5" data-number="2.0.0.5">
<h5 data-number="2.0.0.5" class="anchored" data-anchor-id="novelty-effect"><span class="header-section-number">2.0.0.5</span> Novelty effect</h5>
<ul>
<li>새 UI element (예: confetti animation)</li>
<li>Day 1: 호기심 으로 관심 ↑</li>
<li>Day 7: 신선 → 클릭 ↑</li>
<li>Day 30: 익숙 함, 거의 무시</li>
<li>short-term: positive effect (overestimate)</li>
<li>long-term: 0 또는 negative (overestimate 의 보정 필요)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 5 sub-mechanism 의 방향
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li>Crash, Quality 학습: short-term 이 <em>낙관</em> (long-term 보다 높음) → 측정 효과 가 over</li>
<li>Discoverability: short-term 이 <em>비관</em> (long-term 보다 낮음) → 측정 효과 가 under</li>
<li>Priming, Novelty: short-term 의 <em>방향</em> 이 long-term 과 정반대 가능</li>
</ul>
<p>규칙: 새 feature 의 <em>카테고리</em> 식별 (crash 위험·discoverability 의존·novelty) → 어떤 방향 의 학습 효과 인지 예측.</p>
</div>
</div>
</section>
<section id="network-effects" class="level2" data-number="3">
<h2 data-number="3" class="anchored" data-anchor-id="network-effects"><span class="header-section-number">3</span> 2. Network Effects</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<p>feature 의 가치 가 <em>친구 사용 비율</em> 에 의존 — viral 전파 의 시간 lag.</p>
<section id="양면-매개체" class="level5" data-number="3.0.0.1">
<h5 data-number="3.0.0.1" class="anchored" data-anchor-id="양면-매개체"><span class="header-section-number">3.0.0.1</span> 양면 매개체</h5>
<ul>
<li>direct social: friend 가 사용 → 본인 도 사용 (Live Video)</li>
<li>양면 marketplace: Treatment 가 demand ↑ → supply 늦게 catch up (Airbnb)</li>
<li>recommendation: 처음 다양 한 추천 → 시간 지나 popularity bias → 효과 감소</li>
</ul>
</section>
<section id="인용-1" class="level5" data-number="3.0.0.2">
<h5 data-number="3.0.0.2" class="anchored" data-anchor-id="인용-1"><span class="header-section-number">3.0.0.2</span> 인용</h5>
<ul>
<li>Ch.22 (leakage interference) 와 직접 연관</li>
<li>Hohnhold et al.&nbsp;(2015), Eckles et al.&nbsp;(2017)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
사례 — Airbnb (two-sided marketplace)
</div>
</div>
<div class="callout-body-container callout-body">
<section id="시간-단계" class="level5" data-number="3.0.0.3">
<h5 data-number="3.0.0.3" class="anchored" data-anchor-id="시간-단계"><span class="header-section-number">3.0.0.3</span> 시간 단계</h5>
<ul>
<li><strong>Week 1</strong>: Treatment conversion 개선 → demand ↑ (예: +5% booking rate)</li>
<li><strong>Week 2-4</strong>: 동일 inventory → Treatment 의 booking 이 inventory 잠식 → revenue ↑</li>
<li><strong>Month 2</strong>: host 가 demand 변화 인지 → 가격 ↑ 또는 새 host 가입</li>
<li><strong>Month 3+</strong>: equilibrium — supply 가 catch up, marginal revenue 감소</li>
</ul>
</section>
<section id="측정-의-함정" class="level5" data-number="3.0.0.4">
<h5 data-number="3.0.0.4" class="anchored" data-anchor-id="측정-의-함정"><span class="header-section-number">3.0.0.4</span> 측정 의 함정</h5>
<ul>
<li>short-term (Week 1-2): conversion 개선 효과 가 <em>과장</em> (inventory contention)</li>
<li>mid-term (Month 1-2): 효과 <em>감소</em> (host 의 가격 반응)</li>
<li>long-term (Month 3+): 새 equilibrium (실제 효과 보다 작거나 다름)</li>
</ul>
<p>short-term 만 보면 +5% — 하지만 long-term 은 +1% 또는 0%.</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관
</div>
</div>
<div class="callout-body-container callout-body">
<p>network effect 가 있는 영역 은 <em>equilibrium 도달</em> 시점 까지 측정 의무. equilibrium 미도달 의 short-term 결과 는 <em>과도기</em> — 영구 적 효과 와 다르다.</p>
<p>검증: ramp 의 1% → 50% → 100% 비교. effect size 가 <em>비율 따라 증가</em> 시 supply 측 catch up 미발생, <em>감소</em> 시 supply 가 catch up 시작.</p>
</div>
</div>
</section>
<section id="delayed-experience-and-measurement" class="level2" data-number="4">
<h2 data-number="4" class="anchored" data-anchor-id="delayed-experience-and-measurement"><span class="header-section-number">4</span> 3. Delayed Experience and Measurement</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<p>사용자 의 <em>online</em> 경험 과 <em>offline</em> 결과 사이 시간 gap. 측정 metric 이 누적 cumulative.</p>
<section id="사례" class="level5" data-number="4.0.0.1">
<h5 data-number="4.0.0.1" class="anchored" data-anchor-id="사례"><span class="header-section-number">4.0.0.1</span> 사례</h5>
<ul>
<li><strong>Airbnb·Booking.com</strong>: 예약 후 몇 달 뒤 도착 → user retention 의 변화 가 늦게 반영</li>
<li><strong>연간 계약</strong>: 1 년 후 갱신 의사결정 시점 까지 effect 누적</li>
<li><strong>학습 platform</strong>: feature 가 학기말 시험에 effect 반영</li>
<li><strong>금융 product</strong>: 큰 거래 의 결과 가 분기 마감 시 의 보고</li>
</ul>
</section>
<section id="시간-척도" class="level5" data-number="4.0.0.2">
<h5 data-number="4.0.0.2" class="anchored" data-anchor-id="시간-척도"><span class="header-section-number">4.0.0.2</span> 시간 척도</h5>
<ul>
<li>즉시 metric (page view, click): 분~시간</li>
<li>단기 metric (purchase, sign-up): 일~주</li>
<li>중기 metric (retention 30day): 월</li>
<li>장기 metric (renewal, lifetime value): 분기~년</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: metric 의 시간 척도
</div>
</div>
<div class="callout-body-container callout-body">
<p>각 metric 의 <em>natural lag</em> 가 다름:</p>
<pre><code>click → CTR 측정: 즉시
sign-up → activation: 1 일
trial → purchase: 14 일
purchase → retention 30day: 30 일
purchase → renewal: 365 일</code></pre>
<p>Treatment effect 의 <em>진짜 측정</em> 은 metric 의 lag 만큼 의 시간 필요. shorter measurement window 의 metric 은 <em>intermediate proxy</em> — 진짜 outcome 의 일부.</p>
<p>규칙: long-term metric 측정 위해 <em>충분한 follow-up</em> 필수. 부족 시 cohort method 결합.</p>
</div>
</div>
</section>
<section id="ecosystem-change" class="level2" data-number="5">
<h2 data-number="5" class="anchored" data-anchor-id="ecosystem-change"><span class="header-section-number">5</span> 4. Ecosystem Change</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
6 sub-mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<section id="other-features-launching" class="level5" data-number="5.0.0.1">
<h5 data-number="5.0.0.1" class="anchored" data-anchor-id="other-features-launching"><span class="header-section-number">5.0.0.1</span> Other features launching</h5>
<p>다른 팀 의 새 feature 가 launch — 본 feature 와 <em>interaction</em>:</p>
<ul>
<li>새 push notification feature 가 launch → 기존 push feature 의 marginal effect 감소</li>
<li>새 onboarding flow 가 launch → 기존 onboarding 의 effect 다른 방향 으로 변화</li>
</ul>
</section>
<section id="seasonality" class="level5" data-number="5.0.0.2">
<h5 data-number="5.0.0.2" class="anchored" data-anchor-id="seasonality"><span class="header-section-number">5.0.0.2</span> Seasonality</h5>
<ul>
<li>gift card 가 Christmas 시즌 에만 잘 작동</li>
<li>back-to-school, holiday season 등 의 강한 시간성</li>
<li>short-term 측정 시점 의 계절 → 다른 계절 에 generalize 어려움</li>
</ul>
</section>
<section id="competitive-landscape" class="level5" data-number="5.0.0.3">
<h5 data-number="5.0.0.3" class="anchored" data-anchor-id="competitive-landscape"><span class="header-section-number">5.0.0.3</span> Competitive landscape</h5>
<ul>
<li>경쟁사 의 같은 feature launch → 본 feature 의 차별성 감소</li>
<li>launch 시점 따라 effect 매우 다름</li>
</ul>
</section>
<section id="government-policies" class="level5" data-number="5.0.0.4">
<h5 data-number="5.0.0.4" class="anchored" data-anchor-id="government-policies"><span class="header-section-number">5.0.0.4</span> Government policies</h5>
<ul>
<li>GDPR 의 ad targeting 영향 — 데이터 사용 가능 범위 변화</li>
<li>새 정책 의 effect 가 ramp 형태 로 누적</li>
<li>인용: European Commission 2016, Basin et al.&nbsp;2018, Google 2019</li>
</ul>
</section>
<section id="concept-drift" class="level5" data-number="5.0.0.5">
<h5 data-number="5.0.0.5" class="anchored" data-anchor-id="concept-drift"><span class="header-section-number">5.0.0.5</span> Concept drift</h5>
<ul>
<li>ML model 의 학습 데이터 분포 가 변화</li>
<li>model 의 성능 점차 degrade</li>
<li>예: search query 분포, ad keyword 분포 의 변화</li>
</ul>
</section>
<section id="software-rot" class="level5" data-number="5.0.0.6">
<h5 data-number="5.0.0.6" class="anchored" data-anchor-id="software-rot"><span class="header-section-number">5.0.0.6</span> Software rot</h5>
<ul>
<li>maintain 안 되는 feature 가 환경 변화 따라 degrade</li>
<li>시스템 가정 의 invalidation</li>
<li>예: API version 변경, browser engine 업데이트</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: ecosystem change 의 <em>exogenous</em> 성
</div>
</div>
<div class="callout-body-container callout-body">
<p>이 6 sub-mechanism 의 공통점: <em>Treatment 와 무관</em> — exogenous factor.</p>
<p>규칙: long-term 측정 시 <em>Treatment effect</em> 와 <em>ecosystem change</em> 의 분리 필요. post-period analysis 가 가장 효과 적 (Treatment 종료 후 두 group 의 같은 environment).</p>
</div>
</div>
</section>
<section id="측정-목적-3-가지" class="level2" data-number="6">
<h2 data-number="6" class="anchored" data-anchor-id="측정-목적-3-가지"><span class="header-section-number">6</span> 측정 목적 — 3 가지</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
1. Attribution
</div>
</div>
<div class="callout-body-container callout-body">
<section id="정의-1" class="level5" data-number="6.0.0.1">
<h5 data-number="6.0.0.1" class="anchored" data-anchor-id="정의-1"><span class="header-section-number">6.0.0.1</span> 정의</h5>
<p>새 feature 가 <em>얼마 만큼</em> 의 long-term value 를 만들었는가?</p>
</section>
<section id="사용-사례" class="level5" data-number="6.0.0.2">
<h5 data-number="6.0.0.2" class="anchored" data-anchor-id="사용-사례"><span class="header-section-number">6.0.0.2</span> 사용 사례</h5>
<ul>
<li>OKR / KPI tracking — 팀 의 기능 별 long-term 기여도</li>
<li>재무 forecast — feature 의 future revenue 추정</li>
<li>인센티브 — 팀 별 launch effect</li>
</ul>
</section>
<section id="도전" class="level5" data-number="6.0.0.3">
<h5 data-number="6.0.0.3" class="anchored" data-anchor-id="도전"><span class="header-section-number">6.0.0.3</span> 도전</h5>
<ul>
<li><em>endogenous</em> (user-learned) 와 <em>exogenous</em> (경쟁 변화) 의 분리</li>
<li><em>compounding</em> — 새 feature 가 이전 feature 위 에 build → 누적 attribution 어려움</li>
</ul>
</section>
<section id="적합-method" class="level5" data-number="6.0.0.4">
<h5 data-number="6.0.0.4" class="anchored" data-anchor-id="적합-method"><span class="header-section-number">6.0.0.4</span> 적합 method</h5>
<ul>
<li>Cohort + Post-Period 결합</li>
<li>Holdback experiment (launch 후 monitoring)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
2. Institutional Learning
</div>
</div>
<div class="callout-body-container callout-body">
<section id="정의-2" class="level5" data-number="6.0.0.5">
<h5 data-number="6.0.0.5" class="anchored" data-anchor-id="정의-2"><span class="header-section-number">6.0.0.5</span> 정의</h5>
<p>short-term 과 long-term 의 <em>차이</em> 자체 를 학습 — 왜 다른가?</p>
</section>
<section id="통찰-의-가치" class="level5" data-number="6.0.0.6">
<h5 data-number="6.0.0.6" class="anchored" data-anchor-id="통찰-의-가치"><span class="header-section-number">6.0.0.6</span> 통찰 의 가치</h5>
<ul>
<li>큰 novelty effect → user discovery 가 너무 느림 → in-product education 으로 교정 가능</li>
<li>큰 abandon rate → low quality 또는 click-bait — 다음 iteration 의 설계 정보</li>
<li>큰 학습 효과 → onboarding 의 critical importance</li>
</ul>
</section>
<section id="적합-method-1" class="level5" data-number="6.0.0.7">
<h5 data-number="6.0.0.7" class="anchored" data-anchor-id="적합-method-1"><span class="header-section-number">6.0.0.7</span> 적합 method</h5>
<ul>
<li>Post-Period analysis (학습 효과 의 분리 측정)</li>
<li>Time-Staggered (수렴 시점 의 명시적 판단)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
3. Generalization
</div>
</div>
<div class="callout-body-container callout-body">
<section id="정의-3" class="level5" data-number="6.0.0.8">
<h5 data-number="6.0.0.8" class="anchored" data-anchor-id="정의-3"><span class="header-section-number">6.0.0.8</span> 정의</h5>
<p>특정 실험 의 long-term 측정을 <em>다른 비슷한 실험</em> 의 short-term 으로 부터 외삽 (extrapolate).</p>
</section>
<section id="사용-사례-hohnhold-et-al.-2015" class="level5" data-number="6.0.0.9">
<h5 data-number="6.0.0.9" class="anchored" data-anchor-id="사용-사례-hohnhold-et-al.-2015"><span class="header-section-number">6.0.0.9</span> 사용 사례 (Hohnhold et al.&nbsp;2015)</h5>
<ul>
<li>광고 ad-load 실험 의 historical long-term 데이터 누적</li>
<li>새 ad-load 변화 의 short-term effect 만 으로 long-term 예측</li>
</ul>
</section>
<section id="도전-1" class="level5" data-number="6.0.0.10">
<h5 data-number="6.0.0.10" class="anchored" data-anchor-id="도전-1"><span class="header-section-number">6.0.0.10</span> 도전</h5>
<ul>
<li>exogenous factor 와 의 분리 (기간 별 다른 economic 환경)</li>
<li>generalize 가능 한 <em>general principle</em> 인지 검증</li>
<li>big shock 제외 (만약 exogenous shock 이 있으면 generalize 부정확)</li>
</ul>
</section>
<section id="가치" class="level5" data-number="6.0.0.11">
<h5 data-number="6.0.0.11" class="anchored" data-anchor-id="가치"><span class="header-section-number">6.0.0.11</span> 가치</h5>
<p>generalize 가능 시 <em>모든 새 실험</em> 에 short-term → long-term mapping 즉시 적용. 이건 <em>복제 가능 한 platform-level 자산</em>.</p>
</section>
<section id="적합-method-2" class="level5" data-number="6.0.0.12">
<h5 data-number="6.0.0.12" class="anchored" data-anchor-id="적합-method-2"><span class="header-section-number">6.0.0.12</span> 적합 method</h5>
<ul>
<li>누적 long-running experiment 데이터 의 회귀</li>
<li>short-term metric 의 <em>predictive</em> 한 design (Goal·Driver metric, Ch.6)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 목적 → method 의 의사결정
</div>
</div>
<div class="callout-body-container callout-body">
<p>3 가지 목적 은 <em>서로 다른 method</em> 를 요구:</p>
<table class="table">
<thead>
<tr class="header">
<th>목적</th>
<th>1차 method</th>
<th>2차 method</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Attribution</td>
<td>Cohort</td>
<td>Post-Period, Holdback</td>
</tr>
<tr class="even">
<td>Institutional Learning</td>
<td>Post-Period</td>
<td>Time-Staggered</td>
</tr>
<tr class="odd">
<td>Generalization</td>
<td>누적 데이터 회귀</td>
<td>Time-Staggered</td>
</tr>
</tbody>
</table>
<p>규칙: 어떤 long-term 측정 인가 결정 전 — <em>목적</em> 명확화. “그냥 long-term 측정” 은 자원 낭비. 목적 별 적합 method 선택 → 효율 적 측정.</p>
</div>
</div>
</section>
<section id="oec-와-long-term-의-연결" class="level2" data-number="7">
<h2 data-number="7" class="anchored" data-anchor-id="oec-와-long-term-의-연결"><span class="header-section-number">7</span> OEC 와 long-term 의 연결</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
OEC 의 정의 (Ch.7) 의 부담
</div>
</div>
<div class="callout-body-container callout-body">
<p>OEC 는 <em>short-term measurable</em> + <em>long-term causally impactful</em> — 두 조건 만족.</p>
<p>short-term measurable: 1~2 주 안 측정 가능 long-term causally impactful: long-term 목표 (revenue, retention) 에 <em>진짜로</em> 영향</p>
<section id="long-term-측정-의-의무" class="level5" data-number="7.0.0.1">
<h5 data-number="7.0.0.1" class="anchored" data-anchor-id="long-term-측정-의-의무"><span class="header-section-number">7.0.0.1</span> Long-term 측정 의 의무</h5>
<p>OEC 의 <em>causally impactful</em> 부분 검증 위해 <em>주기적 long-term 측정</em> 필요. 이게 빠지면 OEC 가 <em>짐작</em> — Goodhart 의 함정.</p>
</section>
<section id="인용-2" class="level5" data-number="7.0.0.2">
<h5 data-number="7.0.0.2" class="anchored" data-anchor-id="인용-2"><span class="header-section-number">7.0.0.2</span> 인용</h5>
<p>Hauser and Katz (1998) — “Metrics: You Are What You Measure!”</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관
</div>
</div>
<div class="callout-body-container callout-body">
<p>OEC 는 <em>short-term proxy</em> — long-term 의 진짜 outcome 을 <em>예측</em> 하기 위함. proxy 의 <em>예측 력</em> 검증 의무 가 long-term 측정 의 정당성.</p>
<p>규칙: OEC 의 generalization 측정 (1) 분기 마다 자동 update, (2) 변화 시 OEC 의 weight 재조정.</p>
</div>
</div>
</section>
<section id="비교-short-term-vs-long-term" class="level2" data-number="8">
<h2 data-number="8" class="anchored" data-anchor-id="비교-short-term-vs-long-term"><span class="header-section-number">8</span> 비교 — short-term vs long-term</h2>
<table class="table">
<thead>
<tr class="header">
<th>차원</th>
<th>Short-term (1~2 weeks)</th>
<th>Long-term (3+ months)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>측정 비용</td>
<td>낮음</td>
<td>높음</td>
</tr>
<tr class="even">
<td>Sample size</td>
<td>큼</td>
<td>작음 (cohort) 또는 동일</td>
</tr>
<tr class="odd">
<td>Treatment 가정</td>
<td>static</td>
<td>dynamic</td>
</tr>
<tr class="even">
<td>학습 효과</td>
<td>부분</td>
<td>완료</td>
</tr>
<tr class="odd">
<td>Network 효과</td>
<td>partial</td>
<td>equilibrium</td>
</tr>
<tr class="even">
<td>Exogenous factor</td>
<td>적음</td>
<td>많음</td>
</tr>
<tr class="odd">
<td>Decision 적합성</td>
<td>빠른 iteration</td>
<td>큰 launch decision</td>
</tr>
<tr class="even">
<td>적합 metric</td>
<td>OEC, click, conversion</td>
<td>retention, lifetime value</td>
</tr>
</tbody>
</table>
</section>
<section id="응용" class="level2" data-number="9">
<h2 data-number="9" class="anchored" data-anchor-id="응용"><span class="header-section-number">9</span> 응용</h2>
<ul>
<li><strong>검색 엔진</strong>: long-running + post-period (학습 효과 측정)</li>
<li><strong>Ad platform</strong>: time-staggered + generalization (새 ad type 의 long-term 외삽)</li>
<li><strong>Subscription</strong>: cohort (sign-up 시점) + holdback (renewal 측정)</li>
<li><strong>Marketplace</strong>: post-period (equilibrium 도달) + ramp 단계 분석</li>
<li><strong>Social network</strong>: cohort + edge-level analysis (Ch.22) 결합</li>
</ul>
</section>
<section id="실무-체크리스트" class="level2" data-number="10">
<h2 data-number="10" class="anchored" data-anchor-id="실무-체크리스트"><span class="header-section-number">10</span> 실무 체크리스트</h2>
<ol type="1">
<li>실험 의 <em>short-term ≠ long-term</em> 의심 영역 식별 (5+ checklist)</li>
<li>목적 명확화 (attribution / learning / generalization)</li>
<li>적합 method 선택 (cohort / post-period / time-staggered / holdback)</li>
<li>measurement window 충분 한지 (metric 의 natural lag)</li>
<li>exogenous factor 통제 가능 여부 (post-period 권장)</li>
<li>cohort 의 representativeness 검증</li>
<li>SRM (Ch.21) 점검 — long-running 시 cookie churn 의 SRM</li>
<li>결과 보고 시 <em>uncertainty</em> 명시 — long-term 은 본질 적 noise 큼</li>
</ol>
</section>
<section id="관련-주제" class="level2" data-number="11">
<h2 data-number="11" class="anchored" data-anchor-id="관련-주제"><span class="header-section-number">11</span> 관련 주제</h2>
<ul>
<li>F23-0 overview — Ch.23 전체 지도</li>
<li>F23-2 — Long-Running Experiments 의 4 가지 한계</li>
<li>F23-3 — 4 method 의 디테일</li>
<li>Ch.7 (F-KOH7) — OEC 의 short-term + long-term proxy 의무</li>
<li>Ch.6 (F-KOH6) — Goal/Driver/Guardrail metric 의 long-term 측정 설계</li>
<li>Ch.22 (F-KOH22) — Network leakage 와 long-term 의 결합</li>
<li>Ch.21 (F-KOH21) — long-running 의 SRM 점검</li>
</ul>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
출처
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li>Kohavi, Tang, Xu (2020). <em>Trustworthy Online Controlled Experiments.</em> Ch.23.1~23.3.</li>
<li>Hohnhold, O’Brien, Tang (2015). “Focus on the Long-Term.” KDD 2015.</li>
<li>Huang, Reiley, Raibov (2018). Pandora ad sensitivity.</li>
<li>Chen, Liu, Xu (2019). “How A/B Tests Could Go Wrong.” WSDM 2019.</li>
<li>Kohavi et al.&nbsp;(2009, 2012). Seven Pitfalls + search query share.</li>
<li>European Commission (2016, 2018). GDPR.</li>
<li>Basin, Debois, Hildebrandt (2018). GDPR compliance.</li>
<li>Hauser and Katz (1998). “Metrics: You Are What You Measure!”</li>
<li>Goodhart (1975), Goodhart’s law (2018).</li>
</ul>
</div>
</div>


</section>

 ]]></description>
  <category>Experimentation</category>
  <category>A/B Test</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F23-1-what-are-why-differ-why-measure.html</guid>
  <pubDate>Fri, 08 May 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Kohavi Ch.23.4 — Long-Running Experiments 의 4 가지 한계</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F23-2-long-running-experiments.html</link>
  <description><![CDATA[ 





<section id="정의" class="level2" data-number="1">
<h2 data-number="1" class="anchored" data-anchor-id="정의"><span class="header-section-number">1</span> 정의</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
정의: Long-Running Experiment (단순)
</div>
</div>
<div class="callout-body-container callout-body">
<p>가장 단순 한 long-term 측정 접근. 실험 을 평소 보다 <em>오래</em> (수 개월) 실행 하고, 첫 주 (short-term) 와 마지막 주 (long-term) 의 effect 를 따로 분석 (Kohavi, Tang, Xu, 2020, Ch.23.4).</p>
<section id="형식" class="level5" data-number="1.0.0.1">
<h5 data-number="1.0.0.1" class="anchored" data-anchor-id="형식"><span class="header-section-number">1.0.0.1</span> 형식</h5>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?p%5CDelta_1">: 첫 주 (week 1) 의 percent delta — <em>short-term</em> effect</li>
<li><img src="https://latex.codecogs.com/png.latex?p%5CDelta_T">: 마지막 주 (week T) 의 percent delta — <em>long-term</em> effect (의 추정)</li>
</ul>
</section>
<section id="가정" class="level5" data-number="1.0.0.2">
<h5 data-number="1.0.0.2" class="anchored" data-anchor-id="가정"><span class="header-section-number">1.0.0.2</span> 가정</h5>
<ul>
<li>시간 따라 effect 가 <em>수렴</em> 한다</li>
<li>마지막 주 가 long-term equilibrium 에 도달 한다</li>
<li>두 시점 의 metric 차이 가 학습 효과 의 <em>순수</em> 측정 이다</li>
</ul>
</section>
<section id="단순함-의-매력" class="level5" data-number="1.0.0.3">
<h5 data-number="1.0.0.3" class="anchored" data-anchor-id="단순함-의-매력"><span class="header-section-number">1.0.0.3</span> 단순함 의 매력</h5>
<ul>
<li>구현: 일반 실험 의 자연 연장</li>
<li>분석: 일반 실험 의 metric 분리 (week 별 delta)</li>
<li>비용: 추가 infrastructure 필요 없음</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관
</div>
</div>
<div class="callout-body-container callout-body">
<p>long-running 의 사고: <em>“실험 오래 하면 자연 적 으로 long-term 측정 된다”</em>. 단순 명료 하지만 4 가지 근본 함정 이 있다. 이 글 은 그 함정 을 풀어 본다.</p>
<p>레슨: 단순 long-running 은 <em>명시적 method</em> (Cohort, Post-Period, …) 의 보강 없이 는 <em>biased</em> — 첫 주 (short-term) 측정 도, 마지막 주 (long-term) 측정 도 둘 다.</p>
</div>
</div>
</section>
<section id="함정-1-treatment-effect-dilution" class="level2" data-number="2">
<h2 data-number="2" class="anchored" data-anchor-id="함정-1-treatment-effect-dilution"><span class="header-section-number">2</span> 함정 1 — Treatment Effect Dilution</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<section id="정의-1" class="level5" data-number="2.0.0.1">
<h5 data-number="2.0.0.1" class="anchored" data-anchor-id="정의-1"><span class="header-section-number">2.0.0.1</span> 정의</h5>
<p>마지막 주 의 사용자 의 <em>일부 만</em> 이 전체 실험 기간 Treatment 받음. 나머지 는 partial exposure → effect 가 <em>희석</em> (diluted).</p>
</section>
<section id="가지-sub-mechanism" class="level5" data-number="2.0.0.2">
<h5 data-number="2.0.0.2" class="anchored" data-anchor-id="가지-sub-mechanism"><span class="header-section-number">2.0.0.2</span> 3 가지 sub-mechanism</h5>
</section>
<section id="sub-1-multi-device" class="level5" data-number="2.0.0.3">
<h5 data-number="2.0.0.3" class="anchored" data-anchor-id="sub-1-multi-device"><span class="header-section-number">2.0.0.3</span> Sub 1: Multi-device</h5>
<ul>
<li>사용자 가 web + mobile + tablet 사용</li>
<li>실험 cookie 는 device 별 — Treatment cookie 가 한 device 에만</li>
<li>다른 device 에서는 <em>Control</em> 경험</li>
<li>실험 기간 길수록 multi-device 사용 확률 증가 → 사용자 의 Treatment 비율 ↓</li>
</ul>
</section>
<section id="sub-2-cookie-churn" class="level5" data-number="2.0.0.4">
<h5 data-number="2.0.0.4" class="anchored" data-anchor-id="sub-2-cookie-churn"><span class="header-section-number">2.0.0.4</span> Sub 2: Cookie churn</h5>
<ul>
<li>cookie 가 <em>churn</em> — browser cache clear, 다른 browser 사용, private mode</li>
<li>Treatment 사용자 의 cookie 가 churn → 새 cookie 는 random 재배정</li>
<li>실험 길수록 churn 누적 → 사용자 Treatment 비율 변동 ↑</li>
</ul>
</section>
<section id="sub-3-network-leakage-ch.22" class="level5" data-number="2.0.0.5">
<h5 data-number="2.0.0.5" class="anchored" data-anchor-id="sub-3-network-leakage-ch.22"><span class="header-section-number">2.0.0.5</span> Sub 3: Network leakage (Ch.22)</h5>
<ul>
<li>Treatment 의 effect 가 Control 친구 로 누수</li>
<li>실험 길수록 누수 누적 → Control 도 부분 적 Treatment effect</li>
</ul>
</section>
<section id="인용" class="level5" data-number="2.0.0.6">
<h5 data-number="2.0.0.6" class="anchored" data-anchor-id="인용"><span class="header-section-number">2.0.0.6</span> 인용</h5>
<ul>
<li>Dmitriev et al.&nbsp;(2016) — long-term experiment pitfalls</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 사용자 의 <em>purity</em> 손실
</div>
</div>
<div class="callout-body-container callout-body">
<p>비유 — 약효 측정:</p>
<ul>
<li>1 주: 환자 의 100% 가 약 복용</li>
<li>4 주: 환자 의 70% 만 복용 (의약 prescription drift)</li>
<li>12 주: 환자 의 30% 만 복용 (drug holiday, off-label use)</li>
</ul>
<p>마지막 시점 의 effect 측정 시 <em>순수 약효</em> 가 아닌 <em>희석 효과</em> 측정.</p>
<p>레슨: dilution 은 long-running 의 <em>불가피</em> 함정. <em>cohort method</em> (stable user ID) 로 부분 적 보정 가능 — F23-3 에서 다룸.</p>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Dilution 의 정량화
</div>
</div>
<div class="callout-body-container callout-body">
<section id="형식-1" class="level5" data-number="2.0.0.7">
<h5 data-number="2.0.0.7" class="anchored" data-anchor-id="형식-1"><span class="header-section-number">2.0.0.7</span> 형식</h5>
<ul>
<li>사용자 <img src="https://latex.codecogs.com/png.latex?i"> 의 <em>true exposure</em>: 시간 <img src="https://latex.codecogs.com/png.latex?T"> 동안 Treatment 받은 비율 <img src="https://latex.codecogs.com/png.latex?%5Ctheta_i"></li>
<li>사용자 <img src="https://latex.codecogs.com/png.latex?i"> 의 <em>observed effect</em>: <img src="https://latex.codecogs.com/png.latex?%5Ctheta_i%20%5Ccdot%20%5Ctau_i"> (where <img src="https://latex.codecogs.com/png.latex?%5Ctau_i"> = 사용자 <img src="https://latex.codecogs.com/png.latex?i"> 의 진짜 effect)</li>
<li>평균 measured effect: <img src="https://latex.codecogs.com/png.latex?%5Cbar%7B%5Ctheta%7D%20%5Ccdot%20%5Cbar%7B%5Ctau%7D"></li>
</ul>
</section>
<section id="bias" class="level5" data-number="2.0.0.8">
<h5 data-number="2.0.0.8" class="anchored" data-anchor-id="bias"><span class="header-section-number">2.0.0.8</span> Bias</h5>
<pre><code>bias = (1 - bar{theta}) · bar{tau}
     ≈ (multi-device 비율 + churn rate) · 진짜 effect</code></pre>
<p>multi-device 30% + churn 10% → <img src="https://latex.codecogs.com/png.latex?%5Cbar%7B%5Ctheta%7D%20%5Capprox%200.6"> → measured effect 가 진짜 의 60% (40% under).</p>
</section>
<section id="시간-의존" class="level5" data-number="2.0.0.9">
<h5 data-number="2.0.0.9" class="anchored" data-anchor-id="시간-의존"><span class="header-section-number">2.0.0.9</span> 시간 의존</h5>
<pre><code>T = 1 week: bar{theta} ≈ 0.95
T = 4 weeks: bar{theta} ≈ 0.85
T = 12 weeks: bar{theta} ≈ 0.65
T = 26 weeks: bar{theta} ≈ 0.50</code></pre>
<p>dilution 은 <em>시간 따라 누적</em> — long-running 일수록 큰 bias.</p>
</section>
</div>
</div>
</section>
<section id="함정-2-survivorship-bias" class="level2" data-number="3">
<h2 data-number="3" class="anchored" data-anchor-id="함정-2-survivorship-bias"><span class="header-section-number">3</span> 함정 2 — Survivorship Bias</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<p>실험 시작 사용자 의 <em>일부 만</em> 이 마지막 까지 survive. survival rate 가 Treatment·Control 사이 다르면 마지막 주 의 사용자 <em>구성</em> 이 different.</p>
<section id="사례" class="level5" data-number="3.0.0.1">
<h5 data-number="3.0.0.1" class="anchored" data-anchor-id="사례"><span class="header-section-number">3.0.0.1</span> 사례</h5>
<ul>
<li>Treatment 사용자 의 <em>불만</em> 이 abandon 으로 → Treatment survivor 가 <em>덜 까다로운</em> 사용자</li>
<li>Treatment 의 <em>bug</em> 가 cookie churn 가속 → Treatment 의 representative 부족</li>
</ul>
</section>
<section id="진짜-effect-와-측정-effect-의-괴리" class="level5" data-number="3.0.0.2">
<h5 data-number="3.0.0.2" class="anchored" data-anchor-id="진짜-effect-와-측정-effect-의-괴리"><span class="header-section-number">3.0.0.2</span> 진짜 effect 와 측정 effect 의 괴리</h5>
<ul>
<li>진짜 effect: 실험 시작 사용자 전체 의 metric 변화</li>
<li>측정 effect: 마지막 주 까지 survive 한 사용자 의 metric 변화</li>
</ul>
<p>한쪽 group 의 survivor 만 <em>biased subset</em> 이면 비교 결과 부정확.</p>
</section>
<section id="srm-alert" class="level5" data-number="3.0.0.3">
<h5 data-number="3.0.0.3" class="anchored" data-anchor-id="srm-alert"><span class="header-section-number">3.0.0.3</span> SRM alert</h5>
<p>survivorship bias 는 <em>SRM</em> (Ch.21) 의 trigger — Treatment·Control 의 sample ratio 의 시간 따른 drift 점검.</p>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 누가 survive 하는가
</div>
</div>
<div class="callout-body-container callout-body">
<p>비유 — 약물 임상시험:</p>
<ul>
<li>진짜 효과 측정 위해: 모든 환자 (시작 시 등록 한) 의 outcome 측정 필요</li>
<li>측정 측정: 시험 끝까지 <em>participation</em> 한 환자 만 측정 → biased</li>
</ul>
<p>drop-out 한 환자 의 outcome 이 다른 경우: 측정 결과 misleading.</p>
<p>레슨: long-running 의 효과 측정 시 <em>cohort</em> (시작 시 정의) 단위 의 metric 의무. 정의: 모든 cohort 사용자 의 metric (중도 drop 한 사용자 도 마지막 활동 시점 의 metric).</p>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
SRM 의 시간 의존 패턴
</div>
</div>
<div class="callout-body-container callout-body">
<section id="week-1" class="level5" data-number="3.0.0.4">
<h5 data-number="3.0.0.4" class="anchored" data-anchor-id="week-1"><span class="header-section-number">3.0.0.4</span> Week 1</h5>
<ul>
<li>design ratio: 50/50</li>
<li>observed: 50.0/50.0 (no SRM)</li>
</ul>
</section>
<section id="week-26" class="level5" data-number="3.0.0.5">
<h5 data-number="3.0.0.5" class="anchored" data-anchor-id="week-26"><span class="header-section-number">3.0.0.5</span> Week 26</h5>
<ul>
<li>design ratio: 50/50</li>
<li>observed: 47.5/52.5 (SRM detected)</li>
<li>원인: Treatment 의 1% bug 가 cookie churn 가속, Control 보다 5% 빠른 abandon</li>
</ul>
</section>
<section id="결과" class="level5" data-number="3.0.0.6">
<h5 data-number="3.0.0.6" class="anchored" data-anchor-id="결과"><span class="header-section-number">3.0.0.6</span> 결과</h5>
<ul>
<li>실험 의 <em>모든</em> metric 신뢰성 의문</li>
<li>마지막 주 의 effect 측정 <em>invalid</em> (Treatment subset 가 biased)</li>
</ul>
</section>
</div>
</div>
</section>
<section id="함정-3-새-feature-interaction" class="level2" data-number="4">
<h2 data-number="4" class="anchored" data-anchor-id="함정-3-새-feature-interaction"><span class="header-section-number">4</span> 함정 3 — 새 Feature Interaction</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<p>long-running 동안 다른 팀 의 <em>새 feature</em> 도 launch — 본 실험 과 <em>interaction</em>.</p>
<section id="사례-1" class="level5" data-number="4.0.0.1">
<h5 data-number="4.0.0.1" class="anchored" data-anchor-id="사례-1"><span class="header-section-number">4.0.0.1</span> 사례</h5>
<ul>
<li>본 실험: push notification A/B</li>
<li>Week 1: Treatment 의 push 가 effective → +10% session</li>
<li>Month 2: 다른 팀 이 <em>email notification</em> launch → 사용자 의 notification 피로 증가</li>
<li>Month 3: Treatment push 의 effect 감소 (saturation)</li>
</ul>
</section>
<section id="분리-어려움" class="level5" data-number="4.0.0.2">
<h5 data-number="4.0.0.2" class="anchored" data-anchor-id="분리-어려움"><span class="header-section-number">4.0.0.2</span> 분리 어려움</h5>
<ul>
<li>본 실험 의 <em>진짜</em> long-term decay 인지</li>
<li>다른 feature 와 의 interaction 인지</li>
</ul>
</section>
<section id="인용-1" class="level4" data-number="4.0.1">
<h4 data-number="4.0.1" class="anchored" data-anchor-id="인용-1"><span class="header-section-number">4.0.1</span> 인용</h4>
<ul>
<li>Hohnhold et al.&nbsp;(2015), Dmitriev et al.&nbsp;(2016)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: ecosystem dynamics
</div>
</div>
<div class="callout-body-container callout-body">
<p>long-running 동안 <em>ecosystem</em> 이 변함:</p>
<ul>
<li>다른 팀 의 launch (위 example)</li>
<li>seasonal change (holiday, summer break)</li>
<li>competitive landscape (경쟁사 의 새 feature)</li>
<li>regulation (GDPR, CCPA)</li>
</ul>
<p>이 변화는 본 실험 의 effect 와 <em>interaction</em> — 분리 어려움.</p>
<p>레슨: post-period analysis 만이 이 한계 를 부분 적 해결 (post-period 는 모두 같은 ecosystem 에 있음).</p>
</div>
</div>
</section>
<section id="함정-4-time-extrapolated-effect-해석-의-함정" class="level2" data-number="5">
<h2 data-number="5" class="anchored" data-anchor-id="함정-4-time-extrapolated-effect-해석-의-함정"><span class="header-section-number">5</span> 함정 4 — Time-Extrapolated Effect 해석 의 함정</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Mechanism
</div>
</div>
<div class="callout-body-container callout-body">
<p>마지막 주 의 effect <img src="https://latex.codecogs.com/png.latex?p%5CDelta_T"> 와 첫 주 의 effect <img src="https://latex.codecogs.com/png.latex?p%5CDelta_1"> 의 차이 를 <em>시간 효과</em> 로 해석 하면 위험.</p>
<section id="차이-가-시간-효과-가-아닌-경우" class="level5" data-number="5.0.0.1">
<h5 data-number="5.0.0.1" class="anchored" data-anchor-id="차이-가-시간-효과-가-아닌-경우"><span class="header-section-number">5.0.0.1</span> 차이 가 시간 효과 가 아닌 경우</h5>
<ul>
<li><em>Exogenous</em> (계절·경쟁·정책 변화)</li>
<li><em>Underlying population</em> 변화 (사용자 inflow·outflow 의 패턴 변화)</li>
<li><em>Concept drift</em> (학습 모델 의 데이터 분포 변화)</li>
<li><em>Software rot</em> (시스템 의 환경 변화)</li>
</ul>
</section>
<section id="위험-한-결론" class="level5" data-number="5.0.0.2">
<h5 data-number="5.0.0.2" class="anchored" data-anchor-id="위험-한-결론"><span class="header-section-number">5.0.0.2</span> 위험 한 결론</h5>
<ul>
<li>“Treatment 가 시간 따라 학습 효과 로 -5% effect 누적” → 실제 는 계절 차이</li>
<li>“Treatment 의 effect 가 -10% 로 감소” → 실제 는 경쟁사 launch 의 영향</li>
</ul>
</section>
<section id="일반화-의-어려움" class="level4" data-number="5.0.1">
<h4 data-number="5.0.1" class="anchored" data-anchor-id="일반화-의-어려움"><span class="header-section-number">5.0.1</span> 일반화 의 어려움</h4>
<p>이 함정 의 누적 → long-running 의 결과 가 <em>다른 실험·기간</em> 에 generalize 어려움.</p>
</section>
<section id="인용-2" class="level4" data-number="5.0.2">
<h4 data-number="5.0.2" class="anchored" data-anchor-id="인용-2"><span class="header-section-number">5.0.2</span> 인용</h4>
<ul>
<li>Dmitriev et al.&nbsp;(2016) — 8 가지 long-term pitfall</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 시간 비교 의 통제 변수
</div>
</div>
<div class="callout-body-container callout-body">
<p>비유 — 두 시점 의 GDP 비교:</p>
<ul>
<li>2020 GDP vs 2026 GDP — <em>그냥 비교</em> 하면 inflation 무시</li>
<li>진짜 비교: real GDP (inflation-adjusted)</li>
</ul>
<p>long-running 의 first/last week 도 동일:</p>
<ul>
<li>두 시점 의 ecosystem 다름 → <em>그냥 비교</em> 시 ecosystem 차이 가 effect 처럼 보임</li>
<li>진짜 비교: post-period analysis (두 group 이 동시 같은 ecosystem)</li>
</ul>
<p>레슨: long-running 의 <em>시간 비교</em> 는 본질 적 confounded. post-period 의 <em>동시 비교</em> 가 더 robust.</p>
</div>
</div>
</section>
<section id="결론-long-running-의-한계-와-보완-method" class="level2" data-number="6">
<h2 data-number="6" class="anchored" data-anchor-id="결론-long-running-의-한계-와-보완-method"><span class="header-section-number">6</span> 결론 — long-running 의 한계 와 보완 method</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
4 가지 한계 의 종합
</div>
</div>
<div class="callout-body-container callout-body">
<table class="table">
<colgroup>
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
<col style="width: 25%">
</colgroup>
<thead>
<tr class="header">
<th>한계</th>
<th>시간 따라</th>
<th>영향 받는 metric</th>
<th>보완 method</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Dilution</td>
<td>누적</td>
<td><em>모든</em> effect</td>
<td>Cohort</td>
</tr>
<tr class="even">
<td>Survivorship</td>
<td>누적</td>
<td>composition-sensitive</td>
<td>Cohort + SRM</td>
</tr>
<tr class="odd">
<td>새 feature interaction</td>
<td>exogenous</td>
<td><em>모든</em> effect</td>
<td>Post-Period</td>
</tr>
<tr class="even">
<td>Time-extrapolation</td>
<td>양 시점 차이</td>
<td>comparison-sensitive</td>
<td>Post-Period + Time-Staggered</td>
</tr>
</tbody>
</table>
<section id="결합-의-의무" class="level5" data-number="6.0.0.1">
<h5 data-number="6.0.0.1" class="anchored" data-anchor-id="결합-의-의무"><span class="header-section-number">6.0.0.1</span> 결합 의 의무</h5>
<ul>
<li>Cohort + Post-Period: 일반 적 long-term 측정 의 권장 조합</li>
<li>Cohort + Holdback: launch 후 monitoring</li>
<li>Time-Staggered + Post-Period: 학습 효과 의 명시적 측정 (수렴 판단 + post-A/A)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 단순 long-running 의 위치
</div>
</div>
<div class="callout-body-container callout-body">
<p>단순 long-running 은 <em>진단 도구</em> — 제대로 측정 하지 않지만 <em>문제 발견</em> 신호 가능:</p>
<ul>
<li>first/last week effect 가 크게 다름 → “long-term 측정 method 적용 필요” 의 alert</li>
<li>SRM 이 시간 따라 drift → survivorship bias 의 alert</li>
<li>ramp 단계 별 effect 차이 → leakage 의 alert</li>
</ul>
<p>레슨: long-running 단독 으로 <em>결정</em> 하지 말 것. 진단 후 <em>명시적 method</em> 로 정확 측정.</p>
</div>
</div>
</section>
<section id="python-시뮬레이션-dilution-의-시간-의존" class="level2" data-number="7">
<h2 data-number="7" class="anchored" data-anchor-id="python-시뮬레이션-dilution-의-시간-의존"><span class="header-section-number">7</span> Python 시뮬레이션 — Dilution 의 시간 의존</h2>
<div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb3-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb3-2"></span>
<span id="cb3-3">np.random.seed(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2026</span>)</span>
<span id="cb3-4"></span>
<span id="cb3-5"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> simulate_long_running_with_dilution(</span>
<span id="cb3-6">    n_users<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10000</span>, true_lift<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.10</span>, weeks<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>,</span>
<span id="cb3-7">    multi_device_drift<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.02</span>, cookie_churn<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.02</span></span>
<span id="cb3-8">):</span>
<span id="cb3-9">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">"""</span></span>
<span id="cb3-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    long-running experiment 의 dilution 시뮬레이션.</span></span>
<span id="cb3-11"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    각 주 마다 일부 사용자 의 cookie 가 churn 또는 multi-device 사용으로 partial exposure.</span></span>
<span id="cb3-12"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    """</span></span>
<span id="cb3-13">    base_p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.20</span></span>
<span id="cb3-14">    assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.randint(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>n_users)</span>
<span id="cb3-15">    purity <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.ones(n_users)  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># initial: 100% pure exposure</span></span>
<span id="cb3-16"></span>
<span id="cb3-17">    delta_per_week <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> []</span>
<span id="cb3-18">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">for</span> week <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">range</span>(weeks):</span>
<span id="cb3-19">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># purity drift: 매주 일부 사용자 의 purity 감소</span></span>
<span id="cb3-20">        churn_mask <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.binomial(</span>
<span id="cb3-21">            <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, multi_device_drift <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> cookie_churn, size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>n_users</span>
<span id="cb3-22">        )</span>
<span id="cb3-23">        purity <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.maximum(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.0</span>, purity <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> churn_mask <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.10</span>)</span>
<span id="cb3-24"></span>
<span id="cb3-25">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 각 사용자 의 effect = true_lift * purity (Treatment 인 경우)</span></span>
<span id="cb3-26">        effective_lift <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.where(assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, true_lift <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> purity, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>)</span>
<span id="cb3-27">        p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> base_p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> effective_lift)</span>
<span id="cb3-28"></span>
<span id="cb3-29">        y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.binomial(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, p, size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>n_users)</span>
<span id="cb3-30">        rate_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> y[assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>].mean()</span>
<span id="cb3-31">        rate_c <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> y[assignment <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>].mean()</span>
<span id="cb3-32">        delta_per_week.append((rate_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> rate_c) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> rate_c)</span>
<span id="cb3-33"></span>
<span id="cb3-34">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> delta_per_week</span>
<span id="cb3-35"></span>
<span id="cb3-36">deltas <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> simulate_long_running_with_dilution()</span>
<span id="cb3-37"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Week | Measured delta | Bias direction"</span>)</span>
<span id="cb3-38"><span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">for</span> i, d <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">enumerate</span>(deltas):</span>
<span id="cb3-39">    <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"  </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>i<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:2d}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;"> | </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>d<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">        | </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'under'</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> d <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.10</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">else</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'over'</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb3-40"></span>
<span id="cb3-41"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"</span><span class="ch" style="color: #20794D;
background-color: null;
font-style: inherit;">\n</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">True lift: 10.00%"</span>)</span>
<span id="cb3-42"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Week 1 measured: </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>deltas[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.2%}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb3-43"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Week 12 measured: </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>deltas[<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.2%}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb3-44"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Apparent 'long-term decay': </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>deltas[<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> deltas[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>]<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.2%}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb3-45"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"이 'decay' 는 진짜 학습 효과 가 아니라 dilution!"</span>)</span></code></pre></div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
시뮬레이션 해석
</div>
</div>
<div class="callout-body-container callout-body">
<p>12 주 동안 사용자 의 purity 가 점점 ↓ (multi-device, cookie churn 누적). 첫 주 의 measured lift 는 진짜 10% 에 가까움. 마지막 주 의 lift 는 ~6-7% (dilution 의 결과).</p>
<p>순진 한 long-running 분석: “10% → 6% 의 <em>진짜 decay</em>” — 잘못. <em>dilution</em> 이 원인.</p>
<p>레슨: cohort method (stable user ID) + 사용자 별 weighted analysis 가 dilution 보정 가능. 다음 글 (F23-3) 에서 디테일.</p>
</div>
</div>
</section>
<section id="비교-long-running-단순-vs-보강된-method" class="level2" data-number="8">
<h2 data-number="8" class="anchored" data-anchor-id="비교-long-running-단순-vs-보강된-method"><span class="header-section-number">8</span> 비교 — long-running 단순 vs 보강된 method</h2>
<table class="table">
<colgroup>
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
<col style="width: 16%">
</colgroup>
<thead>
<tr class="header">
<th>차원</th>
<th>Long-Running 단순</th>
<th>+ Cohort</th>
<th>+ Post-Period</th>
<th>+ Time-Staggered</th>
<th>+ Holdback</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Dilution 보정</td>
<td>약</td>
<td>강</td>
<td>부분</td>
<td>부분</td>
<td>부분</td>
</tr>
<tr class="even">
<td>Survivorship 보정</td>
<td>없음</td>
<td>강</td>
<td>부분</td>
<td>부분</td>
<td>부분</td>
</tr>
<tr class="odd">
<td>새 feature interaction</td>
<td>약</td>
<td>동일</td>
<td>강</td>
<td>부분</td>
<td>동일</td>
</tr>
<tr class="even">
<td>Time-extrapolation</td>
<td>부정확</td>
<td>부분</td>
<td>강</td>
<td>강</td>
<td>부분</td>
</tr>
<tr class="odd">
<td>구현 비용</td>
<td>낮음</td>
<td>중간</td>
<td>중간</td>
<td>높음</td>
<td>중간</td>
</tr>
<tr class="even">
<td>Power</td>
<td>medium</td>
<td>medium</td>
<td>medium</td>
<td>medium</td>
<td>low</td>
</tr>
</tbody>
</table>
</section>
<section id="응용" class="level2" data-number="9">
<h2 data-number="9" class="anchored" data-anchor-id="응용"><span class="header-section-number">9</span> 응용</h2>
<ul>
<li><strong>Search ranking</strong>: long-running + Cohort + Post-Period (학습 효과 분리)</li>
<li><strong>Ad platform</strong>: long-running + Holdback (launch 후 monitoring)</li>
<li><strong>Marketplace</strong>: long-running + Cohort + DiD (geo-based 결합)</li>
<li><strong>Subscription</strong>: long-running + Cohort (cohort = sign-up 시점)</li>
<li><strong>ML model</strong>: long-running + concept drift monitoring + post-period</li>
</ul>
</section>
<section id="실무-체크리스트" class="level2" data-number="10">
<h2 data-number="10" class="anchored" data-anchor-id="실무-체크리스트"><span class="header-section-number">10</span> 실무 체크리스트</h2>
<ol type="1">
<li><em>왜</em> long-running 인지 명확화 (목적 별 적합 method 선택)</li>
<li>dilution 의 잠재 크기 추정 (multi-device·cookie churn rate)</li>
<li>SRM 의 시간 따른 drift 자동 monitoring</li>
<li>cohort 정의 (stable identifier 가능 한지)</li>
<li>ecosystem change log (다른 팀 launch, 정책 변화 등) 유지</li>
<li>first / last week 의 ecosystem 차이 평가</li>
<li>보완 method (Cohort, Post-Period 등) 결합 — 단순 long-running 단독 결정 금지</li>
</ol>
</section>
<section id="관련-주제" class="level2" data-number="11">
<h2 data-number="11" class="anchored" data-anchor-id="관련-주제"><span class="header-section-number">11</span> 관련 주제</h2>
<ul>
<li>F23-0 overview — Ch.23 전체 지도</li>
<li>F23-1 — short/long-term 차이의 6 갈래 + 측정 목적 3 가지</li>
<li>F23-3 — 4 method (Cohort, Post-Period, Time-Staggered, Holdback) 의 디테일</li>
<li>Ch.21 (F-KOH21) — SRM 의 시간 따른 drift 점검</li>
<li>Ch.22 (F-KOH22) — Network leakage 와 dilution</li>
<li>Ch.18 (F-KOH18) — variance 보강 방법</li>
</ul>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
출처
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li>Kohavi, Tang, Xu (2020). <em>Trustworthy Online Controlled Experiments.</em> Ch.23.4.</li>
<li>Dmitriev, Frasca, Gupta, Kohavi, Vaz (2016). “Pitfalls of Long-Term Online Controlled Experiments.” IEEE Big Data 2016.</li>
<li>Hohnhold, O’Brien, Tang (2015). “Focus on the Long-Term.” KDD 2015.</li>
<li>Gupta et al.&nbsp;(2019). “Top Challenges from the OCE Summit.” SIGKDD Explorations.</li>
</ul>
</div>
</div>


</section>

 ]]></description>
  <category>Experimentation</category>
  <category>A/B Test</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F23-2-long-running-experiments.html</guid>
  <pubDate>Fri, 08 May 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Kohavi Ch.23.5 — Long-Term Effect 측정 4 method (Cohort · Post-Period · Time-Staggered · Holdback)</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F23-3-methods-cohort-postperiod-staggered-holdback.html</link>
  <description><![CDATA[ 





<section id="정의" class="level2" data-number="1">
<h2 data-number="1" class="anchored" data-anchor-id="정의"><span class="header-section-number">1</span> 정의</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
정의: Long-Term Measurement Methods
</div>
</div>
<div class="callout-body-container callout-body">
<p>단순 long-running 의 4 가지 한계 (dilution, survivorship, 새 feature interaction, time-extrapolation) 를 <em>부분 적</em> 으로 해결 하는 4 가지 method (Kohavi, Tang, Xu, 2020, Ch.23.5).</p>
<section id="가지-정의" class="level5" data-number="1.0.0.1">
<h5 data-number="1.0.0.1" class="anchored" data-anchor-id="가지-정의"><span class="header-section-number">1.0.0.1</span> 4 가지 정의</h5>
<ol type="1">
<li><strong>Cohort Analysis</strong>: stable cohort 정의 + cohort 의 effect 만 분석</li>
<li><strong>Post-Period Analysis</strong>: 실험 종료 후 모두 같은 environment 에서 <em>과거 group</em> 의 metric 차이 측정</li>
<li><strong>Time-Staggered Treatments</strong>: 같은 Treatment 의 두 staggered 버전 의 <em>수렴</em> 측정</li>
<li><strong>Holdback / Reverse</strong>: launch 후 일부 group 을 (Holdback) 또는 (Reverse) 시켜 monitoring</li>
</ol>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 4 method 의 동기
</div>
</div>
<div class="callout-body-container callout-body">
<table class="table">
<thead>
<tr class="header">
<th>Method</th>
<th>해결 하는 한계</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Cohort</td>
<td>dilution + survivorship</td>
</tr>
<tr class="even">
<td>Post-Period</td>
<td>새 feature interaction + ecosystem change</td>
</tr>
<tr class="odd">
<td>Time-Staggered</td>
<td>수렴 판단 + time-extrapolation</td>
</tr>
<tr class="even">
<td>Holdback</td>
<td>launch 후 monitoring + reverse 의 equilibrium</td>
</tr>
</tbody>
</table>
<p>규칙: 각 method 가 <em>한 가지</em> 한계 에 강함. 일반 적 조합 — Cohort + Post-Period.</p>
</div>
</div>
</section>
<section id="method-1-cohort-analysis" class="level2" data-number="2">
<h2 data-number="2" class="anchored" data-anchor-id="method-1-cohort-analysis"><span class="header-section-number">2</span> Method #1 — Cohort Analysis</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
정의
</div>
</div>
<div class="callout-body-container callout-body">
<p>실험 시작 <em>전</em> stable cohort 를 정의 하고, 이 cohort 의 short-term·long-term effect 만 분석.</p>
<section id="절차" class="level5" data-number="2.0.0.1">
<h5 data-number="2.0.0.1" class="anchored" data-anchor-id="절차"><span class="header-section-number">2.0.0.1</span> 절차</h5>
<ol type="1">
<li><em>stable identifier</em> 선택 (logged-in user ID, paid account ID 등)</li>
<li>실험 시작 시점 의 cohort: 이 ID 들 만 등록</li>
<li>cohort 사용자 의 randomization (T·C 배정) 실행</li>
<li>실험 기간 내 cohort 의 metric 수집 (cohort 외 사용자 metric 은 분석 제외)</li>
<li>cohort 의 short-term·long-term delta 측정</li>
</ol>
</section>
<section id="강점" class="level5" data-number="2.0.0.2">
<h5 data-number="2.0.0.2" class="anchored" data-anchor-id="강점"><span class="header-section-number">2.0.0.2</span> 강점</h5>
<ul>
<li><em>Dilution 보정</em>: cohort 가 stable identifier 면 multi-device·cookie churn 영향 적음</li>
<li><em>Survivorship bias 보정</em>: cohort 시작 시점 정의 → drop-out 후도 cohort 일원 (data 있으면)</li>
</ul>
</section>
<section id="한계" class="level5" data-number="2.0.0.3">
<h5 data-number="2.0.0.3" class="anchored" data-anchor-id="한계"><span class="header-section-number">2.0.0.3</span> 한계</h5>
<ul>
<li><em>Cohort 의 representativeness</em>: logged-in user 가 anon user 와 다른 행동 패턴 → external validity 위협</li>
<li><em>Cohort 너무 작은 경우</em>: power 부족</li>
<li><em>Stable identifier 의 stability</em>: cookie-based 는 churn 강함, account-based 는 churn 적음</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Stable identifier 의 평가
</div>
</div>
<div class="callout-body-container callout-body">
<section id="cookie-based-id" class="level5" data-number="2.0.0.4">
<h5 data-number="2.0.0.4" class="anchored" data-anchor-id="cookie-based-id"><span class="header-section-number">2.0.0.4</span> Cookie-based ID</h5>
<ul>
<li>web browsing 의 standard</li>
<li><em>churn rate</em> 가 핵심: month 당 5-15% (browser, device, private mode)</li>
<li><em>long-running</em> (3+ months) 시 churn 누적 → stable 아님</li>
</ul>
</section>
<section id="account-based-id-logged-in" class="level5" data-number="2.0.0.5">
<h5 data-number="2.0.0.5" class="anchored" data-anchor-id="account-based-id-logged-in"><span class="header-section-number">2.0.0.5</span> Account-based ID (logged-in)</h5>
<ul>
<li>사용자 가 sign-in 한 경우 만 추적</li>
<li>churn 거의 없음 (account 삭제 까지)</li>
<li><em>cohort 작아 짐</em> (anonymous user 제외)</li>
</ul>
</section>
<section id="device-based-id" class="level5" data-number="2.0.0.6">
<h5 data-number="2.0.0.6" class="anchored" data-anchor-id="device-based-id"><span class="header-section-number">2.0.0.6</span> Device-based ID</h5>
<ul>
<li>mobile 의 IDFA·Android Advertising ID</li>
<li>privacy 정책 변화 (iOS 14.5+, GDPR) 로 사용 제한</li>
<li><em>cohort 의 selection</em> — opt-in 한 user 만</li>
</ul>
</section>
<section id="의사결정" class="level5" data-number="2.0.0.7">
<h5 data-number="2.0.0.7" class="anchored" data-anchor-id="의사결정"><span class="header-section-number">2.0.0.7</span> 의사결정</h5>
<ul>
<li>6+ months 의 long-term 측정: <em>account-based</em> 우선</li>
<li>1-3 months 의 mid-term: cookie-based 가능 (churn 누적 작음)</li>
<li>mobile-only platform: device-based + privacy 정책 점검</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: cohort 의 편향 의 trade-off
</div>
</div>
<div class="callout-body-container callout-body">
<p>cohort 의 <em>bias</em> trade-off:</p>
<pre><code>Anonymous + cookies:
  + sample 큼 (모든 user)
  - dilution 강 (cookie churn)

Logged-in + account ID:
  + dilution 약 (account stable)
  - selection bias (logged-in user 가 다른 행동)</code></pre>
<p>해결: <em>post-stratification</em> 으로 logged-in cohort 의 결과 를 모집단 분포 로 weighting. 가정: logged-in user 의 effect 가 전체 user 의 effect 와 <em>비슷</em> 함 (subgroup analysis 검증).</p>
<section id="인용" class="level5" data-number="2.0.0.8">
<h5 data-number="2.0.0.8" class="anchored" data-anchor-id="인용"><span class="header-section-number">2.0.0.8</span> 인용</h5>
<ul>
<li>Park, Gelman, Bafumi (2004): Multilevel regression and post-stratification</li>
<li>Gelman (1997): Hierarchical logistic regression</li>
<li>Lax, Phillips (2009): Post-stratification 응용</li>
<li>Dmitriev et al.&nbsp;(2016): cohort method 의 cookie churn 한계</li>
</ul>
</section>
</div>
</div>
</section>
<section id="method-2-post-period-analysis" class="level2" data-number="3">
<h2 data-number="3" class="anchored" data-anchor-id="method-2-post-period-analysis"><span class="header-section-number">3</span> Method #2 — Post-Period Analysis</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
정의
</div>
</div>
<div class="callout-body-container callout-body">
<p>실험 종료 후 <em>모두 Treatment 또는 모두 Control</em> 로 통일 (= A/A 상태). 기존 Treatment group 과 기존 Control group 의 <em>metric 차이</em> 를 post-period 에 측정.</p>
<section id="절차-1" class="level5" data-number="3.0.0.1">
<h5 data-number="3.0.0.1" class="anchored" data-anchor-id="절차-1"><span class="header-section-number">3.0.0.1</span> 절차</h5>
<ol type="1">
<li>실험 기간 <img src="https://latex.codecogs.com/png.latex?T"> 동안 Treatment·Control 의 metric 수집</li>
<li>시점 <img src="https://latex.codecogs.com/png.latex?T"> 에 모두 Control 또는 Treatment 로 통일 (ramp down 또는 ramp up)</li>
<li>post-period <img src="https://latex.codecogs.com/png.latex?T+1"> 에 <em>기존 Treatment group</em> 의 metric vs <em>기존 Control group</em> 의 metric 차이 측정</li>
<li>이 차이 가 <em>learning effect</em></li>
</ol>
</section>
<section id="hohnhold-et-al.-2015-의-정의" class="level5" data-number="3.0.0.2">
<h5 data-number="3.0.0.2" class="anchored" data-anchor-id="hohnhold-et-al.-2015-의-정의"><span class="header-section-number">3.0.0.2</span> Hohnhold et al.&nbsp;(2015) 의 정의</h5>
<ul>
<li>Hohnhold 의 ad-load study 는 post-period 의 effect 를 <em>learning effect</em> 로 정의</li>
<li>short-term 의 immediate effect 와 분리 가능 한 <em>학습 누적</em></li>
<li>핵심: post-period 에서 두 group 이 <em>exact 한 same feature</em> 경험</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
User-Learned vs System-Learned 의 분리
</div>
</div>
<div class="callout-body-container callout-body">
<section id="user-learned-effect" class="level5" data-number="3.0.0.3">
<h5 data-number="3.0.0.3" class="anchored" data-anchor-id="user-learned-effect"><span class="header-section-number">3.0.0.3</span> User-Learned Effect</h5>
<ul>
<li>사용자 가 학습 — 새 feature 의 사용 패턴 적응</li>
<li>예: ad-load 증가 → 사용자 가 ad 회피 학습 → click-rate ↓ 영구</li>
<li>post-period 에 measurable (사용자 의 영구 변화)</li>
</ul>
</section>
<section id="system-learned-effect" class="level5" data-number="3.0.0.4">
<h5 data-number="3.0.0.4" class="anchored" data-anchor-id="system-learned-effect"><span class="header-section-number">3.0.0.4</span> System-Learned Effect</h5>
<ul>
<li>시스템 (model, profile, opt-in 등) 이 <em>Treatment 기간 의 데이터</em> 로 학습</li>
<li>예: Treatment 의 click 데이터 가 ranking model 에 누적 → post-period 에 도 유효</li>
<li>예: Treatment 의 사용자 가 unsubscribe → post-period 에도 그 list 유지</li>
<li>post-period 의 measured effect 가 <em>user-learned 만</em> 이 아님 — system-learned 도 포함</li>
</ul>
</section>
<section id="분리-의-어려움" class="level5" data-number="3.0.0.5">
<h5 data-number="3.0.0.5" class="anchored" data-anchor-id="분리-의-어려움"><span class="header-section-number">3.0.0.5</span> 분리 의 어려움</h5>
<p>post-period 측정 만으로 user vs system 분리 불가. 추가 점검:</p>
<ul>
<li>system 의 reset (model 재학습, profile 초기화) → reset 후 measure → user-only</li>
<li>두 group 의 <em>differential learning</em> 을 measure (예: Treatment 의 model 변화 추적)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 두 학습 의 비유
</div>
</div>
<div class="callout-body-container callout-body">
<p>비유 — 외국어 학습:</p>
<ul>
<li><strong>User-learned</strong>: 학생 의 머리 속 의 어휘·문법</li>
<li><strong>System-learned</strong>: 교과서·notebook·class 의 진도</li>
</ul>
<p>학생 만 따로 <em>새 학교</em> 로 옮긴다 (post-period of user-only):</p>
<ul>
<li>학생 의 어휘 (user-learned) 는 그대로 — 영구 적</li>
<li>교과서 (system-learned) 는 새 학교 의 것 — 학생 의 user-learned 만 측정 가능</li>
</ul>
<p>post-period 의 측정 은 “교과서 가 둘 다 같은” 환경 — system-learned 영향 <em>분리</em>. 단, 시스템 의 <em>내부 state</em> 가 Treatment 기간 의 영향 을 받았다면 (예: ranking model) post-period 에 도 system-learned 유출 가능.</p>
<p>레슨: post-period 측정 의 정확성 = system 의 <em>cleanliness</em>. 명시적 system reset 또는 system 의 Treatment-independent 가 보장 시 가장 정확.</p>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Post-Period 의 한계
</div>
</div>
<div class="callout-body-container callout-body">
<section id="dilutionsurvivorship-잔존" class="level5" data-number="3.0.0.6">
<h5 data-number="3.0.0.6" class="anchored" data-anchor-id="dilutionsurvivorship-잔존"><span class="header-section-number">3.0.0.6</span> 1. Dilution·Survivorship 잔존</h5>
<ul>
<li>post-period 에 도 cohort 의 stability 부족 시 dilution</li>
<li>Treatment·Control 의 differential survival 시 survivorship bias</li>
<li>해결: cohort method 결합 (Method #1 + #2)</li>
</ul>
</section>
<section id="system-learned-effect-비분리" class="level5" data-number="3.0.0.7">
<h5 data-number="3.0.0.7" class="anchored" data-anchor-id="system-learned-effect-비분리"><span class="header-section-number">3.0.0.7</span> 2. System-Learned Effect 비분리</h5>
<ul>
<li>system 이 Treatment 데이터 로 학습 시 post-period 에 도 잔존</li>
<li>예: ad personalization model — Treatment 데이터 로 prefer ad type 학습 → 영구</li>
</ul>
</section>
<section id="adjustment-for-dilution" class="level5" data-number="3.0.0.8">
<h5 data-number="3.0.0.8" class="anchored" data-anchor-id="adjustment-for-dilution"><span class="header-section-number">3.0.0.8</span> 3. Adjustment for Dilution</h5>
<ul>
<li>learned effect 측정 후 dilution adjustment factor 적용 가능</li>
<li>factor = (실제 Treatment exposure 비율) / (full Treatment exposure)</li>
<li>또는 cohort method 결합</li>
</ul>
</section>
<section id="실험-ramp-down-의-사용자-confusion" class="level5" data-number="3.0.0.9">
<h5 data-number="3.0.0.9" class="anchored" data-anchor-id="실험-ramp-down-의-사용자-confusion"><span class="header-section-number">3.0.0.9</span> 4. 실험 ramp down 의 사용자 confusion</h5>
<ul>
<li>Treatment 가 visible UI 변화 인 경우 ramp down 시 사용자 가 <em>변화 인지</em></li>
<li>사용자 의 reaction 이 post-period metric 에 noise 추가</li>
<li>해결: gradual ramp down (Treatment 비율 점차 감소)</li>
</ul>
</section>
</div>
</div>
</section>
<section id="method-3-time-staggered-treatments" class="level2" data-number="4">
<h2 data-number="4" class="anchored" data-anchor-id="method-3-time-staggered-treatments"><span class="header-section-number">4</span> Method #3 — Time-Staggered Treatments</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
정의
</div>
</div>
<div class="callout-body-container callout-body">
<p>같은 Treatment 의 두 <em>시간 staggered</em> 버전 — 수렴 시점 의 <em>명시적</em> 측정 (Gupta, Kohavi et al.&nbsp;2019).</p>
<section id="절차-2" class="level5" data-number="4.0.0.1">
<h5 data-number="4.0.0.1" class="anchored" data-anchor-id="절차-2"><span class="header-section-number">4.0.0.1</span> 절차</h5>
<ol type="1">
<li>시점 <img src="https://latex.codecogs.com/png.latex?t%20=%200"> 에 Treatment <img src="https://latex.codecogs.com/png.latex?T_0"> 시작</li>
<li>시점 <img src="https://latex.codecogs.com/png.latex?t%20=%201"> (예: 4 주 후) 에 Treatment <img src="https://latex.codecogs.com/png.latex?T_1"> 시작 (다른 user cohort)</li>
<li>시점 <img src="https://latex.codecogs.com/png.latex?t%20%3E%201"> 에서 두 cohort 의 metric 비교 — <em>A/A</em> 의 셈</li>
<li><img src="https://latex.codecogs.com/png.latex?%7CT_1(t)%20-%20T_0(t)%7C%20%3C%20%5Cepsilon"> (수렴) 시 long-term 측정 가능 시점</li>
</ol>
</section>
<section id="수렴-판단" class="level5" data-number="4.0.0.2">
<h5 data-number="4.0.0.2" class="anchored" data-anchor-id="수렴-판단"><span class="header-section-number">4.0.0.2</span> 수렴 판단</h5>
</section>
<section id="형식" class="level5" data-number="4.0.0.3">
<h5 data-number="4.0.0.3" class="anchored" data-anchor-id="형식"><span class="header-section-number">4.0.0.3</span> 형식</h5>
<p><img src="https://latex.codecogs.com/png.latex?%5Cdelta(t)%20=%20%5Cmathbb%7BE%7D%5BY%20%5Cmid%20T_0,%20t%5D%20-%20%5Cmathbb%7BE%7D%5BY%20%5Cmid%20T_1,%20t%5D"></p>
<p>가정: <img src="https://latex.codecogs.com/png.latex?%5Cdelta(t)"> 가 <img src="https://latex.codecogs.com/png.latex?t"> 에 대해 <em>감소 함수</em> (학습 진행 으로 두 group 이 비슷 해 짐).</p>
<p>수렴: <img src="https://latex.codecogs.com/png.latex?%5Cdelta(t)%20%5Cto%200"> 시 두 cohort 의 <em>시간 적 위치</em> 가 동일 — A/A.</p>
</section>
<section id="검정" class="level5" data-number="4.0.0.4">
<h5 data-number="4.0.0.4" class="anchored" data-anchor-id="검정"><span class="header-section-number">4.0.0.4</span> 검정</h5>
<ul>
<li>two-sample t-test: <img src="https://latex.codecogs.com/png.latex?T_0(t)"> 와 <img src="https://latex.codecogs.com/png.latex?T_1(t)"> 의 metric 비교</li>
<li><img src="https://latex.codecogs.com/png.latex?H_0">: <img src="https://latex.codecogs.com/png.latex?%5Cdelta(t)%20=%200"></li>
<li>큰 sample 또는 작은 minimum detectable effect 시 <em>Type II error</em> 의 통제 (보통 보다 낮은 β) 권장</li>
<li>Gupta, Kohavi et al.&nbsp;(2019): Type I error 5% 의 일반 보다 <em>높은</em> 5-10%, Type II error <em>낮은</em> 5-10% 권장 (수렴 의 false alarm 보다 false negative 가 위험)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Time-Staggered 의 가정
</div>
</div>
<div class="callout-body-container callout-body">
<section id="deltat-의-단조-감소" class="level5" data-number="4.0.0.5">
<h5 data-number="4.0.0.5" class="anchored" data-anchor-id="deltat-의-단조-감소"><span class="header-section-number">4.0.0.5</span> 1. <img src="https://latex.codecogs.com/png.latex?%5Cdelta(t)"> 의 단조 감소</h5>
<ul>
<li>학습 효과 만 있고 다른 변동 없으면 단조 감소</li>
<li>깨지는 경우: ecosystem change (계절·경쟁) 가 두 cohort 에 다른 영향</li>
</ul>
</section>
<section id="stagger-의-충분-한-시간-gap" class="level5" data-number="4.0.0.6">
<h5 data-number="4.0.0.6" class="anchored" data-anchor-id="stagger-의-충분-한-시간-gap"><span class="header-section-number">4.0.0.6</span> 2. Stagger 의 충분 한 시간 gap</h5>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?T_1"> 시작 시점 까지 <img src="https://latex.codecogs.com/png.latex?T_0"> 가 <em>학습 진행 중</em> 이어야 비교 가능</li>
<li>학습 시간 보다 짧은 stagger gap 시 → <img src="https://latex.codecogs.com/png.latex?T_0"> 도 <img src="https://latex.codecogs.com/png.latex?T_1"> 도 학습 미완료 → <img src="https://latex.codecogs.com/png.latex?%5Cdelta"> 작음</li>
<li>학습 시간 보다 <em>훨씬 긴</em> stagger gap 권장 (예: 학습 4 주 → stagger 8 주)</li>
</ul>
</section>
<section id="두-cohort-의-비교-가능성" class="level5" data-number="4.0.0.7">
<h5 data-number="4.0.0.7" class="anchored" data-anchor-id="두-cohort-의-비교-가능성"><span class="header-section-number">4.0.0.7</span> 3. 두 cohort 의 <em>비교 가능성</em></h5>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?T_0">·<img src="https://latex.codecogs.com/png.latex?T_1"> 의 user 가 같은 분포 의 cohort</li>
<li>다른 시점 의 sign-up user 가 다른 행동 패턴 시 → 비교 어려움</li>
<li>해결: 같은 cohort 정의 후 randomly subset 으로 <img src="https://latex.codecogs.com/png.latex?T_0">·<img src="https://latex.codecogs.com/png.latex?T_1"> 분리</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 두 staggered 가 수렴 하면
</div>
</div>
<div class="callout-body-container callout-body">
<p>비유 — 두 마라톤 선수:</p>
<ul>
<li>선수 A: 시점 <img src="https://latex.codecogs.com/png.latex?t=0"> 출발, 12 km 후 페이스 정착</li>
<li>선수 B: 시점 <img src="https://latex.codecogs.com/png.latex?t=1"> 출발 (예: 4 km 뒤), 12 km 후 페이스 정착</li>
</ul>
<p>시점 <img src="https://latex.codecogs.com/png.latex?t=2"> (B 의 12 km, A 의 16 km): 둘 다 정착 페이스 → 두 선수 의 <em>순간 속도</em> 비슷 - 차이 small ⇒ 학습 완료 의 신호</p>
<p>레슨: time-staggered 는 <em>수렴</em> 의 객관적 판단 도구. <em>trend line 관찰</em> 의 주관적 판단 보다 정확.</p>
<p>이 후 post-period method 적용 가능 — 학습 완료 후 의 measurement.</p>
</div>
</div>
</section>
<section id="method-4-holdback-reverse-experiment" class="level2" data-number="5">
<h2 data-number="5" class="anchored" data-anchor-id="method-4-holdback-reverse-experiment"><span class="header-section-number">5</span> Method #4 — Holdback &amp; Reverse Experiment</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Holdback Experiment
</div>
</div>
<div class="callout-body-container callout-body">
<section id="정의-4" class="level5" data-number="5.0.0.1">
<h5 data-number="5.0.0.1" class="anchored" data-anchor-id="정의-4"><span class="header-section-number">5.0.0.1</span> 정의</h5>
<p>Treatment 의 90% (또는 100%) launch 후 <em>10% 의 Control</em> 을 유지 (Xu, Duan, Huang 2018).</p>
</section>
<section id="절차-3" class="level5" data-number="5.0.0.2">
<h5 data-number="5.0.0.2" class="anchored" data-anchor-id="절차-3"><span class="header-section-number">5.0.0.2</span> 절차</h5>
<ol type="1">
<li>실험 종료 시 90% Treatment 로 launch</li>
<li>10% 는 <em>기존 Control</em> 으로 유지 (holdback)</li>
<li>holdback 기간 (예: 4-12 주) 의 metric 비교</li>
</ol>
</section>
<section id="강점-1" class="level5" data-number="5.0.0.3">
<h5 data-number="5.0.0.3" class="anchored" data-anchor-id="강점-1"><span class="header-section-number">5.0.0.3</span> 강점</h5>
<ul>
<li><em>Real launch state</em> 의 monitoring (Treatment 가 dominant)</li>
<li>network·equilibrium effect 도달 후 측정</li>
<li>의사결정 의 <em>재검증</em> — 큰 launch 후 의 long-term effect 확인</li>
</ul>
</section>
<section id="한계-1" class="level5" data-number="5.0.0.4">
<h5 data-number="5.0.0.4" class="anchored" data-anchor-id="한계-1"><span class="header-section-number">5.0.0.4</span> 한계</h5>
<ul>
<li><em>작은 sample</em> — 10% Control 의 power 부족</li>
<li><em>Opportunity cost</em> — Control 이 launch benefit 받지 못함</li>
<li><em>Maintenance cost</em> — 10% 의 별도 system path 유지</li>
</ul>
</section>
<section id="인용-1" class="level5" data-number="5.0.0.5">
<h5 data-number="5.0.0.5" class="anchored" data-anchor-id="인용-1"><span class="header-section-number">5.0.0.5</span> 인용</h5>
<ul>
<li>Xu, Duan, Huang (2018): Holdback 의 design 과 적용</li>
<li>Varian (2007): Control group opportunity cost</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
Reverse Experiment
</div>
</div>
<div class="callout-body-container callout-body">
<section id="정의-5" class="level5" data-number="5.0.0.6">
<h5 data-number="5.0.0.6" class="anchored" data-anchor-id="정의-5"><span class="header-section-number">5.0.0.6</span> 정의</h5>
<p>100% Treatment launch <em>후</em> 10% 를 <em>Control 로 되돌림</em>.</p>
</section>
<section id="절차-4" class="level5" data-number="5.0.0.7">
<h5 data-number="5.0.0.7" class="anchored" data-anchor-id="절차-4"><span class="header-section-number">5.0.0.7</span> 절차</h5>
<ol type="1">
<li>실험 종료 시 100% Treatment 로 launch (전사 적용)</li>
<li>일정 기간 후 (예: 4 주) 10% 를 <em>Control 로 되돌림</em></li>
<li>10% 의 reverse group 의 metric vs 90% 의 Treatment group 의 metric 비교</li>
</ol>
</section>
<section id="강점-2" class="level5" data-number="5.0.0.8">
<h5 data-number="5.0.0.8" class="anchored" data-anchor-id="강점-2"><span class="header-section-number">5.0.0.8</span> 강점</h5>
<ul>
<li><em>모든 user 가 Treatment 받음</em> (적어도 일정 기간)</li>
<li>network effect 의 <em>equilibrium</em> 도달 후 측정 가능</li>
<li>two-sided marketplace 에서 supply 측 catch up 후 측정</li>
</ul>
</section>
<section id="한계-2" class="level5" data-number="5.0.0.9">
<h5 data-number="5.0.0.9" class="anchored" data-anchor-id="한계-2"><span class="header-section-number">5.0.0.9</span> 한계</h5>
<ul>
<li><em>사용자 confusion</em> — 시각 적 UI 변화 의 reversal 시 사용자 가 <em>변화 인지</em></li>
<li>이 confusion 자체 가 metric 에 noise 추가</li>
<li>적합 한 영역: 사용자 직접 인지 못하는 backend 변화 (ranking, model)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: Holdback vs Reverse
</div>
</div>
<div class="callout-body-container callout-body">
<table class="table">
<thead>
<tr class="header">
<th>차원</th>
<th>Holdback</th>
<th>Reverse</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Control 의 timing</td>
<td>처음 부터</td>
<td>launch 후</td>
</tr>
<tr class="even">
<td>사용자 confusion</td>
<td>적음</td>
<td>큼 (UI 시각 변화 시)</td>
</tr>
<tr class="odd">
<td>Network 도달</td>
<td>부분</td>
<td>full</td>
</tr>
<tr class="even">
<td>적합 영역</td>
<td>일반 launch</td>
<td>network·equilibrium 의존</td>
</tr>
</tbody>
</table>
<p>규칙:</p>
<ul>
<li>단순 launch 의 long-term monitoring → Holdback</li>
<li>network effect 가 강한 launch (사회·marketplace) → Reverse</li>
<li>사용자 인지 가능 한 UI 변화 → Holdback (Reverse 는 confusion 큼)</li>
</ul>
</div>
</div>
</section>
<section id="결합-패턴" class="level2" data-number="6">
<h2 data-number="6" class="anchored" data-anchor-id="결합-패턴"><span class="header-section-number">6</span> 결합 패턴</h2>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
일반 적 조합
</div>
</div>
<div class="callout-body-container callout-body">
<section id="cohort-post-period-가장-일반" class="level5" data-number="6.0.0.1">
<h5 data-number="6.0.0.1" class="anchored" data-anchor-id="cohort-post-period-가장-일반"><span class="header-section-number">6.0.0.1</span> Cohort + Post-Period (가장 일반)</h5>
<ul>
<li>cohort method 로 dilution·survivorship 보정</li>
<li>post-period 로 새 feature interaction + ecosystem change 분리</li>
<li>적용: 6+ months 의 long-term 측정</li>
</ul>
</section>
<section id="time-staggered-post-period" class="level5" data-number="6.0.0.2">
<h5 data-number="6.0.0.2" class="anchored" data-anchor-id="time-staggered-post-period"><span class="header-section-number">6.0.0.2</span> Time-Staggered + Post-Period</h5>
<ul>
<li>time-staggered 로 수렴 시점 명시 판단</li>
<li>수렴 후 post-period 로 learning effect 측정</li>
<li>적용: 학습 효과 의 정밀 한 측정 (인용 Hohnhold et al.&nbsp;2015)</li>
</ul>
</section>
<section id="cohort-holdback" class="level5" data-number="6.0.0.3">
<h5 data-number="6.0.0.3" class="anchored" data-anchor-id="cohort-holdback"><span class="header-section-number">6.0.0.3</span> Cohort + Holdback</h5>
<ul>
<li>launch 후 monitoring + cohort 의 stable 관찰</li>
<li>적용: 큰 launch 의 후 검증 (예: search ranking 큰 변경)</li>
</ul>
</section>
<section id="모두-결합" class="level5" data-number="6.0.0.4">
<h5 data-number="6.0.0.4" class="anchored" data-anchor-id="모두-결합"><span class="header-section-number">6.0.0.4</span> 모두 결합</h5>
<ul>
<li>Cohort + Time-Staggered + Post-Period + Holdback</li>
<li>가장 정밀, 가장 비용 큼</li>
<li>적용: 매우 큰 launch 의 generalizable 학습 (예: ad platform 의 ad-load 변경)</li>
</ul>
</section>
</div>
</div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
직관: 비용·정밀 의 trade-off
</div>
</div>
<div class="callout-body-container callout-body">
<table class="table">
<thead>
<tr class="header">
<th>조합</th>
<th>비용</th>
<th>정밀</th>
<th>적용</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>단순 long-running</td>
<td>낮음</td>
<td>낮음</td>
<td>진단</td>
</tr>
<tr class="even">
<td>+ Cohort</td>
<td>낮음</td>
<td>중간</td>
<td>일반</td>
</tr>
<tr class="odd">
<td>+ Cohort + Post-Period</td>
<td>중간</td>
<td>높음</td>
<td>권장</td>
</tr>
<tr class="even">
<td>+ Time-Staggered</td>
<td>높음</td>
<td>매우 높음</td>
<td>generalization</td>
</tr>
<tr class="odd">
<td>+ Holdback</td>
<td>중간</td>
<td>높음</td>
<td>launch 후</td>
</tr>
<tr class="even">
<td>모두</td>
<td>매우 높음</td>
<td>최고</td>
<td>전사 critical launch</td>
</tr>
</tbody>
</table>
<p>규칙: <em>목적</em> 에 맞는 조합 선택 — 모든 실험 에 모두 적용 X. 큰 launch (re-strategy 의 근거) 시 모두, 일반 launch 시 cohort + post-period.</p>
</div>
</div>
</section>
<section id="python-시뮬레이션-time-staggered-의-수렴-판단" class="level2" data-number="7">
<h2 data-number="7" class="anchored" data-anchor-id="python-시뮬레이션-time-staggered-의-수렴-판단"><span class="header-section-number">7</span> Python 시뮬레이션 — Time-Staggered 의 수렴 판단</h2>
<div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb2-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb2-2"></span>
<span id="cb2-3">np.random.seed(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2026</span>)</span>
<span id="cb2-4"></span>
<span id="cb2-5"><span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">def</span> simulate_time_staggered(</span>
<span id="cb2-6">    n_users_per_cohort<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5000</span>, true_lift<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.10</span>, weeks<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, learning_decay<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.20</span></span>
<span id="cb2-7">):</span>
<span id="cb2-8">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">"""</span></span>
<span id="cb2-9"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    두 staggered Treatment cohort 의 metric 추적.</span></span>
<span id="cb2-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    학습 효과 가 시간 따라 진행 — 시점에 따라 effect 가 변화.</span></span>
<span id="cb2-11"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">    """</span></span>
<span id="cb2-12">    base_p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.20</span></span>
<span id="cb2-13"></span>
<span id="cb2-14">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># T0: t=0 시작</span></span>
<span id="cb2-15">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># T1: t=4 시작 (4 주 stagger)</span></span>
<span id="cb2-16">    stagger <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span></span>
<span id="cb2-17"></span>
<span id="cb2-18">    deltas_t0_t1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> []</span>
<span id="cb2-19">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">for</span> t <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">range</span>(stagger, weeks):</span>
<span id="cb2-20">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># T0 의 시점: t (실험 후 t 주차)</span></span>
<span id="cb2-21">        t0_age <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> t</span>
<span id="cb2-22">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># T1 의 시점: t - stagger</span></span>
<span id="cb2-23">        t1_age <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> stagger</span>
<span id="cb2-24"></span>
<span id="cb2-25">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 학습 효과 — 시간이 지날수록 effect 가 base 로 수렴 (rebound 모델)</span></span>
<span id="cb2-26">        t0_lift <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> true_lift <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> learning_decay) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> true_lift <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> learning_decay <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.exp(<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>t0_age <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>)</span>
<span id="cb2-27">        t1_lift <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> true_lift <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> learning_decay) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> true_lift <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> learning_decay <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.exp(<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>t1_age <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>)</span>
<span id="cb2-28"></span>
<span id="cb2-29">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 두 cohort 의 metric (T1 cohort 비교)</span></span>
<span id="cb2-30">        p_t0 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> base_p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> t0_lift)</span>
<span id="cb2-31">        p_t1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> base_p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> t1_lift)</span>
<span id="cb2-32">        rate_t0 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.binomial(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, p_t0, size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>n_users_per_cohort).mean()</span>
<span id="cb2-33">        rate_t1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.binomial(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, p_t1, size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>n_users_per_cohort).mean()</span>
<span id="cb2-34">        deltas_t0_t1.append(rate_t0 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> rate_t1)</span>
<span id="cb2-35"></span>
<span id="cb2-36">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">return</span> deltas_t0_t1</span>
<span id="cb2-37"></span>
<span id="cb2-38">deltas <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> simulate_time_staggered()</span>
<span id="cb2-39"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Week | T0(t) - T1(t) | 수렴 판단"</span>)</span>
<span id="cb2-40">threshold <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.001</span></span>
<span id="cb2-41"><span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">for</span> i, d <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">enumerate</span>(deltas):</span>
<span id="cb2-42">    week <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> i <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># stagger 4 후 시작</span></span>
<span id="cb2-43">    converged <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">abs</span>(d) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> threshold</span>
<span id="cb2-44">    <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"  </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>week<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:2d}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;"> | </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>d<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:+.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">      | </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'YES'</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> converged <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">else</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'no'</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb2-45"></span>
<span id="cb2-46"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"</span><span class="ch" style="color: #20794D;
background-color: null;
font-style: inherit;">\n</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">수렴 후 (예: week 16+) 에 post-period method 적용 가능"</span>)</span></code></pre></div>
<div class="callout callout-style-default callout-tip callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
시뮬레이션 해석
</div>
</div>
<div class="callout-body-container callout-body">
<p>초기 (week 4-8): T0 가 T1 보다 <em>4 주 더 학습</em> → effect 더 작음 (학습 효과 의 progression). 시간 지나 (week 16+): 두 cohort 모두 학습 완료 → effect 차이 작아 짐 → 수렴.</p>
<p>수렴 판단 후 post-period 적용 가능. 그 전 의 measurement 는 <em>학습 진행 중</em> 이라 부정확.</p>
<p>레슨: time-staggered 는 <em>학습 진행</em> 측정 의 강력 한 도구. 다른 method 결합 시 정밀도 큰 향상.</p>
</div>
</div>
</section>
<section id="비교-4-method-의-종합" class="level2" data-number="8">
<h2 data-number="8" class="anchored" data-anchor-id="비교-4-method-의-종합"><span class="header-section-number">8</span> 비교 — 4 method 의 종합</h2>
<table class="table">
<colgroup>
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
</colgroup>
<thead>
<tr class="header">
<th>차원</th>
<th>Cohort</th>
<th>Post-Period</th>
<th>Time-Staggered</th>
<th>Holdback</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>1차 해결</td>
<td>dilution</td>
<td>feature interaction</td>
<td>수렴 판단</td>
<td>launch 후 monitoring</td>
</tr>
<tr class="even">
<td>sample 비용</td>
<td>작음</td>
<td>동일</td>
<td>큼 (2 cohort)</td>
<td>작음 (10% Control)</td>
</tr>
<tr class="odd">
<td>구현 비용</td>
<td>낮음</td>
<td>중간</td>
<td>높음</td>
<td>중간</td>
</tr>
<tr class="even">
<td>1 차 method 만</td>
<td>부분 적</td>
<td>부분 적</td>
<td>부분 적</td>
<td>부분 적</td>
</tr>
<tr class="odd">
<td>권장 결합</td>
<td>+ Post-Period</td>
<td>+ Cohort</td>
<td>+ Post-Period</td>
<td>+ Cohort</td>
</tr>
<tr class="even">
<td>적용 시기</td>
<td>일반 적 long-term</td>
<td>학습 효과 측정</td>
<td>generalization</td>
<td>launch 후</td>
</tr>
</tbody>
</table>
</section>
<section id="응용-domain-별-추천" class="level2" data-number="9">
<h2 data-number="9" class="anchored" data-anchor-id="응용-domain-별-추천"><span class="header-section-number">9</span> 응용 — domain 별 추천</h2>
<table class="table">
<thead>
<tr class="header">
<th>Domain</th>
<th>1차 권장</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Search ranking</td>
<td>Cohort + Post-Period</td>
</tr>
<tr class="even">
<td>Ad platform</td>
<td>Cohort + Time-Staggered (generalization)</td>
</tr>
<tr class="odd">
<td>Marketplace</td>
<td>Cohort + Reverse experiment (equilibrium)</td>
</tr>
<tr class="even">
<td>Subscription</td>
<td>Cohort + Holdback (renewal monitoring)</td>
</tr>
<tr class="odd">
<td>Personalization</td>
<td>Post-Period (system reset) + Cohort</td>
</tr>
<tr class="even">
<td>ML model</td>
<td>Time-Staggered + concept drift monitoring</td>
</tr>
<tr class="odd">
<td>Onboarding</td>
<td>Cohort (sign-up time) + Post-Period</td>
</tr>
</tbody>
</table>
</section>
<section id="실무-체크리스트" class="level2" data-number="10">
<h2 data-number="10" class="anchored" data-anchor-id="실무-체크리스트"><span class="header-section-number">10</span> 실무 체크리스트</h2>
<ol type="1">
<li><em>목적</em> 명확화 (attribution, learning, generalization)</li>
<li><em>적합 method</em> 선택 (목적 → method matrix)</li>
<li><em>조합</em> 결정 (단독 method 부족 — Cohort + Post-Period 가 일반)</li>
<li><em>Cohort</em> 정의 (stable identifier)</li>
<li><em>Sample size</em> 계산 (각 method 의 power 요구)</li>
<li><em>Stagger gap</em> 결정 (학습 시간 보다 길게)</li>
<li><em>Holdback ratio</em> 결정 (10% 일반)</li>
<li><em>Monitoring</em> 자동화 (SRM, dilution, ecosystem change)</li>
<li><em>Reporting</em> 구조화 (short-term + long-term + uncertainty)</li>
</ol>
</section>
<section id="관련-주제" class="level2" data-number="11">
<h2 data-number="11" class="anchored" data-anchor-id="관련-주제"><span class="header-section-number">11</span> 관련 주제</h2>
<ul>
<li>F23-0 overview — Ch.23 전체 지도</li>
<li>F23-1 — short/long 차이 의 6 갈래 + 측정 목적 3 가지</li>
<li>F23-2 — long-running 의 4 가지 한계</li>
<li>Ch.7 (F-KOH7) — OEC 의 short-term + long-term proxy 의무</li>
<li>Ch.6 (F-KOH6) — Goal/Driver/Guardrail metric 설계</li>
<li>Ch.18 (F-KOH18) — CUPED 의 long-running 적용</li>
<li>Ch.21 (F-KOH21) — long-running 의 SRM 점검</li>
<li>Ch.22 (F-KOH22) — Network leakage 와 의 결합</li>
<li>D-21 (Hernan 22) — Target Trial Emulation 의 follow-up</li>
</ul>
<div class="callout callout-style-default callout-note callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
출처
</div>
</div>
<div class="callout-body-container callout-body">
<ul>
<li>Kohavi, Tang, Xu (2020). <em>Trustworthy Online Controlled Experiments.</em> Ch.23.5.</li>
<li>Hohnhold, O’Brien, Tang (2015). “Focus on the Long-Term.” KDD 2015.</li>
<li>Dmitriev, Frasca, Gupta, Kohavi, Vaz (2016). “Pitfalls of Long-Term Online Controlled Experiments.” IEEE Big Data 2016.</li>
<li>Gupta, Kohavi, Tang, Xu et al.&nbsp;(2019). “Top Challenges from the OCE Summit.”</li>
<li>Xu, Duan, Huang (2018). Holdback experiment design.</li>
<li>Park, Gelman, Bafumi (2004). Multilevel regression and post-stratification.</li>
<li>Gelman, Carlin (2014). “Beyond Power Calculations: Type S, Type M Errors.”</li>
<li>Lax, Phillips (2009). Post-stratification 응용.</li>
<li>Varian (2007). Control group opportunity cost.</li>
</ul>
</div>
</div>


</section>

 ]]></description>
  <category>Experimentation</category>
  <category>A/B Test</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/F23-3-methods-cohort-postperiod-staggered-holdback.html</guid>
  <pubDate>Fri, 08 May 2026 15:00:00 GMT</pubDate>
</item>
<item>
  <title>Adaptive Trial — 개관</title>
  <dc:creator>Kwangmin Kim</dc:creator>
  <link>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/J-ADAPT-0-overview.html</link>
  <description><![CDATA[ 





<div class="callout callout-style-default callout-warning callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
출처
</div>
</div>
<div class="callout-body-container callout-body">
<p>이 글은 사전지식 기반 (교재 미확인 — agent 사전학습 기반). 핵심 인용 — FDA (2019) Adaptive Designs Guidance, Bauer &amp; Köhne (1994), Berry et al.&nbsp;(2010), Berry (2015).</p>
</div>
</div>
<blockquote class="blockquote">
<p>이 글은 Phase J 시리즈의 25 번째 글이자 <em>J-ADAPT 시리즈 (4 편)</em> 의 첫 글. <em>Adaptive trial</em> — pre-specified rule 에 따라 <em>trial 진행 중</em> protocol 변경 — 의 개관을 다룬다.</p>
</blockquote>
<section id="진입-직관-진행하면서-배우고-조정" class="level2" data-number="1">
<h2 data-number="1" class="anchored" data-anchor-id="진입-직관-진행하면서-배우고-조정"><span class="header-section-number">1</span> 진입 직관 — “진행하면서 배우고 조정”</h2>
<p>기존 RCT: <em>모든 protocol</em> 을 <em>시작 전</em> 결정. 변경 불가.</p>
<blockquote class="blockquote">
<p><strong>Adaptive trial 의 한 줄 원리</strong>: <em>pre-specified rule</em> 에 따라 <em>interim analysis 의 결과</em> 로 <em>protocol 일부</em> 변경. <em>유연성 증가, 효율성 ↑</em>.</p>
</blockquote>
<section id="변경-가능-항목" class="level3" data-number="1.1">
<h3 data-number="1.1" class="anchored" data-anchor-id="변경-가능-항목"><span class="header-section-number">1.1</span> 변경 가능 항목</h3>
<ul>
<li><strong>Sample size</strong>: interim 결과로 <em>증가/감소</em></li>
<li><strong>Randomization ratio</strong>: 효과 좋은 arm 에 더 많은 환자 (RAR)</li>
<li><strong>Arms</strong>: 효과 없는 arm <em>조기 중단</em> (futility)</li>
<li><strong>Eligibility</strong>: 효과 있는 <em>subgroup 만 enrollment 계속</em> (enrichment)</li>
</ul>
</section>
<section id="비유" class="level3" data-number="1.2">
<h3 data-number="1.2" class="anchored" data-anchor-id="비유"><span class="header-section-number">1.2</span> 비유</h3>
<blockquote class="blockquote">
<p><em>학습률 스케줄링</em>: ML 모델 학습 시 <em>loss 추세</em> 를 보고 <em>learning rate 조정</em>. <em>Pre-specified schedule</em> (cosine, step decay) — <em>진행하면서</em> 조정.</p>
</blockquote>
<blockquote class="blockquote">
<p>표준 RCT: <em>fixed learning rate</em>. Adaptive: <em>진행 결과에 따른 자동 조정</em>.</p>
</blockquote>
</section>
</section>
<section id="대-카테고리" class="level2" data-number="2">
<h2 data-number="2" class="anchored" data-anchor-id="대-카테고리"><span class="header-section-number">2</span> 4 대 카테고리</h2>
<section id="group-sequential-design" class="level3" data-number="2.1">
<h3 data-number="2.1" class="anchored" data-anchor-id="group-sequential-design"><span class="header-section-number">2.1</span> 1: Group Sequential Design</h3>
<blockquote class="blockquote">
<p><em>Pre-specified interim analysis</em> 시점 에서 <em>조기 중단</em> (efficacy or futility).</p>
</blockquote>
<blockquote class="blockquote">
<p>Pocock (1977), O’Brien-Fleming (1979) 의 <em>boundary</em>. 다중 비교 보정 (alpha spending).</p>
</blockquote>
</section>
<section id="sample-size-re-estimation" class="level3" data-number="2.2">
<h3 data-number="2.2" class="anchored" data-anchor-id="sample-size-re-estimation"><span class="header-section-number">2.2</span> 2: Sample Size Re-estimation</h3>
<blockquote class="blockquote">
<p>Interim 의 <em>variance estimate</em> 또는 <em>effect size estimate</em> 으로 <em>추가 sample size</em> 결정.</p>
</blockquote>
<blockquote class="blockquote">
<p>Bauer &amp; Köhne (1994) 의 <em>combination test</em>.</p>
</blockquote>
</section>
<section id="response-adaptive-randomization-rar" class="level3" data-number="2.3">
<h3 data-number="2.3" class="anchored" data-anchor-id="response-adaptive-randomization-rar"><span class="header-section-number">2.3</span> 3: Response-Adaptive Randomization (RAR)</h3>
<blockquote class="blockquote">
<p>Interim 의 <em>각 arm 효과</em> 를 보고 <em>randomization probability 조정</em>. 효과 좋은 arm 에 더 많은 환자.</p>
</blockquote>
<blockquote class="blockquote">
<p>Wei (1979) 의 <em>Play-the-Winner</em>. Bayesian RAR (Berry 2015).</p>
</blockquote>
</section>
<section id="adaptive-enrichment" class="level3" data-number="2.4">
<h3 data-number="2.4" class="anchored" data-anchor-id="adaptive-enrichment"><span class="header-section-number">2.4</span> 4: Adaptive Enrichment</h3>
<blockquote class="blockquote">
<p>Interim 에서 <em>효과 있는 subgroup 식별</em>. <em>해당 subgroup 만 enrollment 계속</em>.</p>
</blockquote>
<blockquote class="blockquote">
<p>Wang et al.&nbsp;(2007), Mehta et al.&nbsp;(2009).</p>
</blockquote>
</section>
</section>
<section id="fda-adaptive-designs-guidance-2019" class="level2" data-number="3">
<h2 data-number="3" class="anchored" data-anchor-id="fda-adaptive-designs-guidance-2019"><span class="header-section-number">3</span> FDA Adaptive Designs Guidance (2019)</h2>
<section id="의의" class="level3" data-number="3.1">
<h3 data-number="3.1" class="anchored" data-anchor-id="의의"><span class="header-section-number">3.1</span> 의의</h3>
<blockquote class="blockquote">
<p>FDA 가 adaptive design 을 <em>공식 인정</em> + <em>guideline 제공</em>.</p>
</blockquote>
</section>
<section id="핵심-원칙" class="level3" data-number="3.2">
<h3 data-number="3.2" class="anchored" data-anchor-id="핵심-원칙"><span class="header-section-number">3.2</span> 핵심 원칙</h3>
<ol type="1">
<li><strong>Pre-specification</strong>: 모든 adaptation rule 을 <em>protocol 에 명시</em> — <em>post-hoc 변경 금지</em></li>
<li><strong>Type I error control</strong>: 다중 비교 보정 (alpha spending)</li>
<li><strong>Validity</strong>: estimator 의 <em>bias 통제</em></li>
<li><strong>Trial integrity</strong>: <em>blinding 유지</em>, <em>interim 결과 leak 방지</em></li>
</ol>
</section>
<section id="pre-approval-의-중요성" class="level3" data-number="3.3">
<h3 data-number="3.3" class="anchored" data-anchor-id="pre-approval-의-중요성"><span class="header-section-number">3.3</span> Pre-Approval 의 중요성</h3>
<blockquote class="blockquote">
<p>Adaptive 는 <em>post-hoc data dredging</em> 위험. <em>Pre-specified protocol</em> 이 핵심 — FDA 가 <em>strict 요구</em>.</p>
</blockquote>
</section>
<section id="영향" class="level3" data-number="3.4">
<h3 data-number="3.4" class="anchored" data-anchor-id="영향"><span class="header-section-number">3.4</span> 영향</h3>
<blockquote class="blockquote">
<p>이전: adaptive trial 은 <em>비표준</em>, <em>논쟁</em> 적. 이후: <em>FDA 공식 path</em>, <em>항암제 개발</em> 에서 표준화.</p>
</blockquote>
</section>
</section>
<section id="bayesian-adaptive-trial-berry-2015" class="level2" data-number="4">
<h2 data-number="4" class="anchored" data-anchor-id="bayesian-adaptive-trial-berry-2015"><span class="header-section-number">4</span> Bayesian Adaptive Trial (Berry 2015)</h2>
<section id="의의-1" class="level3" data-number="4.1">
<h3 data-number="4.1" class="anchored" data-anchor-id="의의-1"><span class="header-section-number">4.1</span> 의의</h3>
<blockquote class="blockquote">
<p><em>Frequentist alpha control</em> 대신 <em>Bayesian posterior</em> 기반 결정.</p>
</blockquote>
</section>
<section id="메커니즘" class="level3" data-number="4.2">
<h3 data-number="4.2" class="anchored" data-anchor-id="메커니즘"><span class="header-section-number">4.2</span> 메커니즘</h3>
<blockquote class="blockquote">
<p>매 interim 에서 <em>posterior probability of efficacy</em> 계산. 일정 threshold 초과 시 효과 인정 또는 조기 중단.</p>
</blockquote>
</section>
<section id="장점" class="level3" data-number="4.3">
<h3 data-number="4.3" class="anchored" data-anchor-id="장점"><span class="header-section-number">4.3</span> 장점</h3>
<ul>
<li><em>Continuous learning</em> — 매 환자마다 update</li>
<li><em>모든 정보 활용</em> (likelihood)</li>
<li><em>RAR 자연스럽게 결합</em></li>
</ul>
</section>
<section id="사례" class="level3" data-number="4.4">
<h3 data-number="4.4" class="anchored" data-anchor-id="사례"><span class="header-section-number">4.4</span> 사례</h3>
<ul>
<li><strong>I-SPY 2</strong> (유방암): 유방암 후보 약 다수의 <em>동시 평가</em>. 효과 있는 약 식별.</li>
<li><strong>REMAP-CAP</strong> (COVID-19): 다양한 질환 의약품의 <em>플랫폼 trial</em>.</li>
</ul>
</section>
</section>
<section id="platform-trial-다중-arm-다중-질문" class="level2" data-number="5">
<h2 data-number="5" class="anchored" data-anchor-id="platform-trial-다중-arm-다중-질문"><span class="header-section-number">5</span> Platform Trial — 다중 arm, 다중 질문</h2>
<section id="정의" class="level3" data-number="5.1">
<h3 data-number="5.1" class="anchored" data-anchor-id="정의"><span class="header-section-number">5.1</span> 정의</h3>
<blockquote class="blockquote">
<p><em>하나의 master protocol</em> 로 <em>여러 처치 arm</em> 동시 평가. <em>새 arm 추가/제외</em> 유연.</p>
</blockquote>
</section>
<section id="사례-recovery-covid-19" class="level3" data-number="5.2">
<h3 data-number="5.2" class="anchored" data-anchor-id="사례-recovery-covid-19"><span class="header-section-number">5.2</span> 사례 — RECOVERY (COVID-19)</h3>
<blockquote class="blockquote">
<p>영국의 RECOVERY trial — <em>dexamethasone, hydroxychloroquine, lopinavir, tocilizumab, baricitinib, casirivimab/imdevimab</em> 등 <em>동시 평가</em>.</p>
</blockquote>
<blockquote class="blockquote">
<p>효과 있는 약 <em>조기 발견</em>: <em>dexamethasone</em> — 사망률 17% ↓ (NEJM 2020).</p>
</blockquote>
</section>
<section id="사례-actt-1-covid-19-nih" class="level3" data-number="5.3">
<h3 data-number="5.3" class="anchored" data-anchor-id="사례-actt-1-covid-19-nih"><span class="header-section-number">5.3</span> 사례 — ACTT-1 (COVID-19, NIH)</h3>
<blockquote class="blockquote">
<p>Remdesivir 의 <em>효과</em> 입증. Group sequential design.</p>
</blockquote>
</section>
<section id="의의-2" class="level3" data-number="5.4">
<h3 data-number="5.4" class="anchored" data-anchor-id="의의-2"><span class="header-section-number">5.4</span> 의의</h3>
<blockquote class="blockquote">
<p><em>효율</em> — common control + 동시 평가. <em>다중 질문 동시 답변</em>. <em>시간 절약</em>.</p>
</blockquote>
</section>
</section>
<section id="adaptive-의-trade-off" class="level2" data-number="6">
<h2 data-number="6" class="anchored" data-anchor-id="adaptive-의-trade-off"><span class="header-section-number">6</span> Adaptive 의 Trade-off</h2>
<table class="table">
<thead>
<tr class="header">
<th>측면</th>
<th>표준 RCT</th>
<th>Adaptive</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>효율</td>
<td>낮음</td>
<td>높음</td>
</tr>
<tr class="even">
<td>윤리</td>
<td>모든 환자 동등 randomize</td>
<td>효과 좋은 arm 에 더 많이</td>
</tr>
<tr class="odd">
<td>통계 검정력</td>
<td>표준</td>
<td>보정 필요</td>
</tr>
<tr class="even">
<td>Operational complexity</td>
<td>단순</td>
<td>복잡 (real-time 분석)</td>
</tr>
<tr class="odd">
<td>FDA approval</td>
<td>표준 path</td>
<td>명확한 pre-spec 필요</td>
</tr>
<tr class="even">
<td>Bias 위험</td>
<td>낮음</td>
<td>중간 (잘 통제 시 OK)</td>
</tr>
</tbody>
</table>
</section>
<section id="covid-19-의-adaptive-trial" class="level2" data-number="7">
<h2 data-number="7" class="anchored" data-anchor-id="covid-19-의-adaptive-trial"><span class="header-section-number">7</span> COVID-19 의 Adaptive Trial</h2>
<section id="pandemic-의-도전" class="level3" data-number="7.1">
<h3 data-number="7.1" class="anchored" data-anchor-id="pandemic-의-도전"><span class="header-section-number">7.1</span> Pandemic 의 도전</h3>
<blockquote class="blockquote">
<p><em>효과 있는 약 빠른 발견</em> — 시간 critical. <em>다양한 약 동시 평가</em>.</p>
</blockquote>
</section>
<section id="adaptive-의-가치" class="level3" data-number="7.2">
<h3 data-number="7.2" class="anchored" data-anchor-id="adaptive-의-가치"><span class="header-section-number">7.2</span> Adaptive 의 가치</h3>
<blockquote class="blockquote">
<p>RECOVERY: dexamethasone <em>수개월 만에</em> 효과 확인 — 표준 RCT 라면 <em>수년</em>.</p>
</blockquote>
<blockquote class="blockquote">
<p>ACTT-1: remdesivir 의 <em>조건부 승인</em> — 군 + interim 분석.</p>
</blockquote>
</section>
<section id="사회-영향" class="level3" data-number="7.3">
<h3 data-number="7.3" class="anchored" data-anchor-id="사회-영향"><span class="header-section-number">7.3</span> 사회 영향</h3>
<blockquote class="blockquote">
<p>Pandemic 이 <em>adaptive trial 의 mainstream 진입</em> 가속.</p>
</blockquote>
</section>
</section>
<section id="후속-3-글-안내" class="level2" data-number="8">
<h2 data-number="8" class="anchored" data-anchor-id="후속-3-글-안내"><span class="header-section-number">8</span> 후속 3 글 안내</h2>
<section id="j-adapt-1-rar-play-the-winner" class="level3" data-number="8.1">
<h3 data-number="8.1" class="anchored" data-anchor-id="j-adapt-1-rar-play-the-winner"><span class="header-section-number">8.1</span> J-ADAPT-1: RAR + Play-the-Winner</h3>
<blockquote class="blockquote">
<p>Wei (1979), Berry 의 RAR. Bayesian + frequentist. 윤리적·통계적 고려.</p>
</blockquote>
</section>
<section id="j-adapt-2-bayesian-adaptive-platform-trials" class="level3" data-number="8.2">
<h3 data-number="8.2" class="anchored" data-anchor-id="j-adapt-2-bayesian-adaptive-platform-trials"><span class="header-section-number">8.2</span> J-ADAPT-2: Bayesian Adaptive + Platform Trials</h3>
<blockquote class="blockquote">
<p>Berry 등의 정통. I-SPY 2, REMAP-CAP 사례.</p>
</blockquote>
</section>
<section id="j-adapt-3-fda-adaptive-designs" class="level3" data-number="8.3">
<h3 data-number="8.3" class="anchored" data-anchor-id="j-adapt-3-fda-adaptive-designs"><span class="header-section-number">8.3</span> J-ADAPT-3: FDA Adaptive Designs</h3>
<blockquote class="blockquote">
<p>FDA 2019 guidance 의 정통. Pre-spec, type I control, integrity.</p>
</blockquote>
</section>
</section>
<section id="시뮬레이션-group-sequential" class="level2" data-number="9">
<h2 data-number="9" class="anchored" data-anchor-id="시뮬레이션-group-sequential"><span class="header-section-number">9</span> 시뮬레이션 — Group Sequential</h2>
<div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb1-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb1-2"></span>
<span id="cb1-3">np.random.seed(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">42</span>)</span>
<span id="cb1-4"></span>
<span id="cb1-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 시나리오: 새 약 vs 표준약, 사망률</span></span>
<span id="cb1-6"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 표준약 사망률 30%, 새 약 사망률 20% (효과 -10%)</span></span>
<span id="cb1-7">n_per_arm <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">500</span></span>
<span id="cb1-8">true_p_control <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.30</span></span>
<span id="cb1-9">true_p_treat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.20</span></span>
<span id="cb1-10"></span>
<span id="cb1-11"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 4 차례 interim (n = 100, 200, 300, 400)</span></span>
<span id="cb1-12">interim_points <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">300</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">400</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">500</span>]</span>
<span id="cb1-13">alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.05</span></span>
<span id="cb1-14"></span>
<span id="cb1-15"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># O'Brien-Fleming boundary (간략)</span></span>
<span id="cb1-16"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># k 번째 interim 의 critical Z-score</span></span>
<span id="cb1-17">n_interim <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">len</span>(interim_points)</span>
<span id="cb1-18">ob_boundary <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> []</span>
<span id="cb1-19"><span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">for</span> k <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">range</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, n_interim <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>):</span>
<span id="cb1-20">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># OBF: Z_k* = c / sqrt(k/K)</span></span>
<span id="cb1-21">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># c 는 type I 보정. 단순화: 2.5 / sqrt(k/K)</span></span>
<span id="cb1-22">    z_k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> np.sqrt(k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> n_interim)</span>
<span id="cb1-23">    ob_boundary.append(z_k)</span>
<span id="cb1-24"></span>
<span id="cb1-25"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># 환자 결과 시뮬레이션</span></span>
<span id="cb1-26">control_outcomes <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.binomial(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, true_p_control, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">500</span>)</span>
<span id="cb1-27">treat_outcomes <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.binomial(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, true_p_treat, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">500</span>)</span>
<span id="cb1-28"></span>
<span id="cb1-29"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Interim analyses</span></span>
<span id="cb1-30"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"[Group Sequential Design 시뮬레이션]</span><span class="ch" style="color: #20794D;
background-color: null;
font-style: inherit;">\n</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb1-31"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"진짜 control mortality: </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>true_p_control<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb1-32"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"진짜 treatment mortality: </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>true_p_treat<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb1-33"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"진짜 효과: </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>true_p_treat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> true_p_control<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ch" style="color: #20794D;
background-color: null;
font-style: inherit;">\n</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb1-34"></span>
<span id="cb1-35"><span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">for</span> k, n_k <span class="kw" style="color: #003B4F;
background-color: null;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">enumerate</span>(interim_points):</span>
<span id="cb1-36">    p_c <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> control_outcomes[:n_k].mean()</span>
<span id="cb1-37">    p_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> treat_outcomes[:n_k].mean()</span>
<span id="cb1-38">    diff <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> p_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> p_c</span>
<span id="cb1-39">    se <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.sqrt(p_c <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> p_c) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> n_k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> p_t <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> p_t) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> n_k)</span>
<span id="cb1-40">    z <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> diff <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> se <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> se <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">else</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span></span>
<span id="cb1-41"></span>
<span id="cb1-42">    z_boundary <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> ob_boundary[k]</span>
<span id="cb1-43"></span>
<span id="cb1-44">    <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Interim </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>k<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;"> (n = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>n_k<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">): p_c = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>p_c<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.3f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, p_t = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>p_t<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.3f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, Z = </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>z<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.2f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">, boundary = ±</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>z_boundary<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.2f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb1-45"></span>
<span id="cb1-46">    <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">if</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">abs</span>(z) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> z_boundary:</span>
<span id="cb1-47">        <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"  → STOP — 효과 발견 (또는 reject H0)"</span>)</span>
<span id="cb1-48">        <span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">break</span></span>
<span id="cb1-49"><span class="cf" style="color: #003B4F;
background-color: null;
font-style: inherit;">else</span>:</span>
<span id="cb1-50">    <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"</span><span class="ch" style="color: #20794D;
background-color: null;
font-style: inherit;">\n</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">최종 분석: 효과 통계적 유의 못함 또는 약함"</span>)</span></code></pre></div>
</section>
<section id="결론" class="level2" data-number="10">
<h2 data-number="10" class="anchored" data-anchor-id="결론"><span class="header-section-number">10</span> 결론</h2>
<blockquote class="blockquote">
<p><strong>Adaptive trial 은 <em>pre-specified rule</em> 에 따라 <em>진행 중 protocol 변경</em>. <em>Group sequential, Sample size re-estimation, RAR, Enrichment</em> 의 4 카테고리. <em>FDA 2019 guidance</em> 의 정통, <em>Bayesian adaptive</em> 의 발전, <em>Platform trial</em> 의 효율. COVID-19 에서 <em>mainstream 진입</em>.</strong></p>
</blockquote>
<p>핵심 메시지:</p>
<ol type="1">
<li><strong>Adaptive trial 정의</strong>: pre-spec rule + interim adaptation</li>
<li><strong>4 카테고리</strong>: GSD, SSR, RAR, Enrichment</li>
<li><strong>FDA 2019 guidance</strong>: pre-spec, type I, integrity</li>
<li><strong>Bayesian adaptive</strong> (Berry): posterior 기반</li>
<li><strong>Platform trial</strong> (RECOVERY, REMAP-CAP): 다중 arm</li>
<li><strong>COVID-19</strong>: mainstream 진입 가속</li>
<li><strong>Trade-off</strong>: 효율 vs complexity, type I 보정</li>
</ol>
<p>후속 3 글에서 깊이.</p>
</section>
<section id="관련-주제" class="level2" data-number="11">
<h2 data-number="11" class="anchored" data-anchor-id="관련-주제"><span class="header-section-number">11</span> 관련 주제</h2>
<p><strong>선행 지식</strong></p>
<ul>
<li>(Phase C) RCT 의 무작위 배정·protocol 작성</li>
<li><a href="../../../../../../docs/blog/posts/Experimentation/AB_test/advanced/J-SWITCH-0-overview.html">J-SWITCH 시리즈</a></li>
<li>(Phase F) Sequential testing in A/B</li>
</ul>
<p><strong>Phase J 후속 글</strong></p>
<ul>
<li><a href="../../../../../../docs/blog/posts/Experimentation/AB_test/advanced/J-ADAPT-1-rar-play-the-winner.html">RAR + Play-the-Winner</a> (placeholder)</li>
<li><a href="../../../../../../docs/blog/posts/Experimentation/AB_test/advanced/J-ADAPT-2-bayesian-platform.html">Bayesian + Platform Trials</a> (placeholder)</li>
<li><a href="../../../../../../docs/blog/posts/Experimentation/AB_test/advanced/J-ADAPT-3-fda-adaptive.html">FDA Adaptive Designs</a> (placeholder)</li>
</ul>
</section>
<section id="참고문헌" class="level2" data-number="12">
<h2 data-number="12" class="anchored" data-anchor-id="참고문헌"><span class="header-section-number">12</span> 참고문헌</h2>
<ul>
<li>FDA (2019). <em>Adaptive Designs for Clinical Trials of Drugs and Biologics: Guidance for Industry</em>. Center for Drug Evaluation and Research.</li>
<li>Bauer, P. &amp; Köhne, K. (1994). Evaluation of experiments with adaptive interim analyses. <em>Biometrics</em> 50, 1029-1041.</li>
<li>Berry, S. M., Carlin, B. P., Lee, J. J., Müller, P. (2010). <em>Bayesian Adaptive Methods for Clinical Trials</em>. CRC Press.</li>
<li>Berry, D. A. (2015). The Brave New World of clinical cancer research: Adaptive biomarker-driven trials. <em>Mol. Oncology</em> 9, 951-959.</li>
<li>O’Brien, P. C. &amp; Fleming, T. R. (1979). A multiple testing procedure for clinical trials. <em>Biometrics</em> 35, 549-556.</li>
<li>Pocock, S. J. (1977). Group sequential methods in the design and analysis of clinical trials. <em>Biometrika</em> 64, 191-199.</li>
<li>RECOVERY Collaborative Group (2021). Dexamethasone in hospitalized patients with COVID-19. <em>NEJM</em> 384, 693-704.</li>
<li>Beigel, J. H. et al.&nbsp;(2020). Remdesivir for the treatment of COVID-19 — Final report (ACTT-1). <em>NEJM</em> 383, 1813-1826.</li>
</ul>


</section>

 ]]></description>
  <category>Experimentation</category>
  <category>Clinical Trial</category>
  <guid>kk3225.netlify.app/docs/blog/posts/Experimentation/AB_test/advanced/J-ADAPT-0-overview.html</guid>
  <pubDate>Fri, 08 May 2026 15:00:00 GMT</pubDate>
</item>
</channel>
</rss>
