Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Book

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

permissions:
contents: write

concurrency:
group: book-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

# 노트북은 실행하지 않고 저장된 출력을 그대로 렌더링하므로 jupyter만 있으면 됩니다.
- name: Install Jupyter
run: pip install jupyter

- uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.8.25

- name: Prepare book sources
run: python book/prepare.py

- name: Render book
working-directory: book
run: quarto render --to html

- name: Upload preview
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: book-preview
path: book/_book
retention-days: 7

- name: Deploy to GitHub Pages
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: book/_book
publish_branch: gh-pages
force_orphan: true
commit_message: "Deploy book"
163 changes: 105 additions & 58 deletions README.md

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion TRANSLATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
- 핵심 용어는 장마다 처음 나올 때 `한국어(English)`로 한 번 병기하고, 그 뒤로는 한국어만 씁니다.
- ATE, CATE, DID, OLS 같은 약어는 처음에 `평균 처치효과(ATE)`처럼 풀어 쓰고 이후에는 약어를 써도 됩니다.
- 장 제목(H1)은 원문 영어 제목을 유지하고, 그 아래 절 제목은 한국어로 옮깁니다. `Key Ideas`는 `핵심 요약`, `References`는 `참고 자료`, `Contribute`는 `기여하기`로 통일합니다.
- 문장은 `-습니다`로 맺습니다. 평서문을 `-죠.`, `-네요.`로 끝내지 않습니다. 독자에게 되묻는 `~죠?`는 써도 됩니다.
- white collar / blue collar는 `사무직` / `생산직`으로 옮깁니다.
- 브라질 화폐는 `5헤알`처럼 쓰고, 장마다 처음 나올 때만 `5헤알(BRL)`로 병기합니다.
- 인명은 원어 표기를 기본으로 합니다(예: Joshua Angrist). 본문 흐름상 한글 표기가 자연스러우면 『실무로 통하는 인과추론』의 표기(조슈아 앵그리스트, 알베르토 아바디, 주데아 펄)를 따릅니다.

Expand All @@ -47,6 +49,7 @@
| counterfactual | 반사실 / 반사실적 결과 | |
| factual outcome | 사실적 결과 | |
| treatment effect | 처치효과 | 붙여 씀 |
| be treated | 처치받다 | 붙여 씀(`처치받은`, `처치받지`). 목적격을 쓰면 `처치를 받다` |
| individual treatment effect (ITE) | 개별 처치효과(ITE) | |
| average treatment effect (ATE) | 평균 처치효과(ATE) | |
| average treatment effect on the treated (ATT) | 실험군에 대한 평균 처치효과(ATT) | |
Expand All @@ -63,6 +66,7 @@
| estimand / causal quantity | 인과 추정량 | |
| estimator | 추정량 | |
| parameter | 매개변수 | `모수`, `파라미터` 쓰지 않음. nuisance parameter는 장애모수, parametric은 모수적 |
| hyperparameter | 하이퍼파라미터 | 머신러닝 관례를 따름. parameter 항목의 예외 |
| estimate (명사) | 추정값 | `추정치` 쓰지 않음 |
| SUTVA | SUTVA | |
| spillover | 파급 효과 | |
Expand Down Expand Up @@ -220,5 +224,5 @@
1. 원문 저장소의 해당 노트북을 내려받아 코드 셀과 출력은 그대로 둡니다.
2. 마크다운 셀을 위 원칙대로 옮깁니다.
3. 수식, 이미지, 링크 개수가 원문과 같은지 확인합니다.
4. Jupyter Book으로 빌드해 렌더링을 확인합니다.
4. `python book/prepare.py && cd book && quarto preview`로 웹북 렌더링을 확인합니다. 새 노트북을 추가했다면 `book/prepare.py`의 장 제목 목록과 `book/_quarto.yml` 목차에도 넣어 주세요.
5. PR에는 원문 커밋과 바뀐 셀을 적어 주세요.
11 changes: 11 additions & 0 deletions book/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# prepare.py가 만드는 빌드용 사본
*.ipynb
*.py
!prepare.py
data/
_book/
.quarto/
*_files/

/.quarto/
**/*.quarto_ipynb
7 changes: 7 additions & 0 deletions book/404.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: "페이지를 찾을 수 없습니다"
---

주소가 바뀌었거나 없는 페이지입니다. [첫 페이지](index.html)에서 다시 찾아보거나, 왼쪽 목차와 검색을 이용해 주세요.

기존 Jupyter Book 주소(`…/13-Difference-in-Differences.html` 등)는 그대로 쓸 수 있습니다. 문제가 계속되면 [이슈](https://github.com/CausalInferenceLab/Causal-Inference-with-Python/issues)로 알려 주세요.
118 changes: 118 additions & 0 deletions book/_quarto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
project:
type: book
output-dir: _book
resources:
- data/img/**
- assets/**

lang: ko

execute:
enabled: false

book:
title: "Python으로 하는 인과추론"
subtitle: "Causal Inference for The Brave and True 한국어판"
author:
- name: Matheus Facure
role: 지은이
- name: 가짜연구소 인과추론팀
role: 옮긴이
site-url: https://causalinferencelab.github.io/Causal-Inference-with-Python/
repo-url: https://github.com/CausalInferenceLab/Causal-Inference-with-Python
repo-subdir: causal-inference-for-the-brave-and-true
repo-actions: [issue]
favicon: assets/causal-lab-mark.png
search: true
reader-mode: true
open-graph:
image: assets/og-image.png
locale: ko_KR
twitter-card:
image: assets/og-image.png
page-navigation: true
sidebar:
style: docked
collapse-level: 2
header: |
<a class="brand-lockup" href="https://pseudo-lab.com/" target="_blank" rel="noopener" aria-label="가짜연구소">
<img class="brand-pseudolab only-light" src="assets/pseudolab-dark.png" alt="가짜연구소 Pseudo Lab">
<img class="brand-pseudolab only-dark" src="assets/pseudolab-light.png" alt="가짜연구소 Pseudo Lab">
<span class="brand-divider"></span>
<img class="brand-causal" src="assets/causal-lab-mark.png" alt="인과추론팀 Causal-Lab">
</a>
page-footer:
left: "[가짜연구소](https://pseudo-lab.com/) 인과추론팀 옮김 · 원서 © [Matheus Facure](https://matheusfacure.github.io/python-causality-handbook/landing-page.html)"
center:
- text: 번역 가이드
href: https://github.com/CausalInferenceLab/Causal-Inference-with-Python/blob/main/TRANSLATION_GUIDE.md
- text: 오류 제보
href: https://github.com/CausalInferenceLab/Causal-Inference-with-Python/issues
right:
- icon: github
href: https://github.com/CausalInferenceLab/Causal-Inference-with-Python
aria-label: GitHub 저장소
chapters:
- index.qmd
- part: "1부 인과추론의 기초"
chapters:
- 01-Introduction-To-Causality.ipynb
- 02-Randomised-Experiments.ipynb
- 03-Stats-Review-The-Most-Dangerous-Equation.ipynb
- 04-Graphical-Causal-Models.ipynb
- 05-The-Unreasonable-Effectiveness-of-Linear-Regression.ipynb
- 06-Grouped-and-Dummy-Regression.ipynb
- 07-Beyond-Confounders.ipynb
- 08-Instrumental-Variables.ipynb
- 09-Non-Compliance-and-LATE.ipynb
- 10-Matching.ipynb
- 11-Propensity-Score.ipynb
- 12-Doubly-Robust-Estimation.ipynb
- 13-Difference-in-Differences.ipynb
- 14-Panel-Data-and-Fixed-Effects.ipynb
- 15-Synthetic-Control.ipynb
- 16-Regression-Discontinuity-Design.ipynb
- part: "2부 인과추론의 실무 응용"
chapters:
- 17-Predictive-Models-101.ipynb
- 18-Heterogeneous-Treatment-Effects-and-Personalization.ipynb
- 19-Evaluating-Causal-Models.ipynb
- 20-Plug-and-Play-Estimators.ipynb
- 21-Meta-Learners.ipynb
- 22-Debiased-Orthogonal-Machine-Learning.ipynb
- 23-Challenges-with-Effect-Heterogeneity-and-Nonlinearity.ipynb
- 24-The-Diff-in-Diff-Saga.ipynb
- 25-Synthetic-Diff-in-Diff.ipynb
appendices:
- Debiasing-with-Orthogonalization.ipynb
- Debiasing-with-Propensity-Score.ipynb
- When-Prediction-Fails.ipynb
- Prediction-Metrics-For-Causal-Models.ipynb
- Conformal-Inference-for-Synthetic-Control.ipynb

crossref:
chapters: true
appendix-delim: ":"

format:
html:
theme:
light: [cosmo, styles.scss]
dark: [cosmo, styles.scss, styles-dark.scss]
toc: true
toc-depth: 2
toc-title: 이 장의 내용
number-sections: true
number-depth: 1
code-copy: true
code-overflow: wrap
code-tools: false
html-math-method: mathjax
df-print: default
link-external-newwindow: true
include-in-header:
- text: |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&display=swap" rel="stylesheet">
<script>document.addEventListener("DOMContentLoaded",function(){document.title=document.title.replace(" – "," | ");});</script>
Binary file added book/assets/causal-lab-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/assets/causal-lab-mark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/assets/og-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/assets/pseudolab-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/assets/pseudolab-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions book/index.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
title-block-style: none
aliases:
- landing-page.html
---

```{=html}
<div class="hero">
<img class="hero-mark" src="assets/causal-lab-mark.png" alt="가짜연구소 인과추론팀 로고">
<div class="hero-brand">
<img class="hero-pseudolab" src="assets/pseudolab-light.png" alt="가짜연구소 Pseudo Lab">
<span class="hero-brand-divider"></span>
<span class="hero-brand-team">인과추론팀 <b>Causal-Lab</b></span>
</div>
<p class="hero-title">Python으로 하는<br>인과추론</p>
<p class="hero-sub">Causal Inference for The Brave and True 한국어판. 인과추론의 기초부터 실무 응용까지, 모든 실습을 파이썬으로.</p>
<div class="hero-actions">
<a class="primary" href="01-Introduction-To-Causality.html">1장부터 읽기</a>
<a class="ghost" href="https://github.com/CausalInferenceLab/Causal-Inference-with-Python">GitHub</a>
<a class="ghost" href="https://matheusfacure.github.io/python-causality-handbook/landing-page.html">원서 보기</a>
</div>
</div>
```

# 들어가며 {.unnumbered}

안녕하세요, [가짜연구소](https://pseudo-lab.com/) [신진수](https://www.linkedin.com/in/jinsoo-shin-436060162/)입니다.

이 책은 Matheus Facure의 『Causal Inference for The Brave and True』를 가짜연구소 인과추론팀이 원저자의 동의를 받아 우리말로 옮긴 것입니다. 인과추론은 "이 정책이, 이 할인이, 이 기능이 정말 효과가 있었을까?"라는 질문에 데이터로 답하는 방법입니다. 그런데 막상 공부하려고 하면 한국어로 된 자료, 특히 코드와 함께 손으로 따라 해 볼 수 있는 자료가 많지 않습니다. 이 책이 그 빈자리를 채우는 길잡이가 되면 좋겠습니다.

원서는 가볍지만 엄밀하게 효과 추정을 배우는 책입니다. 모든 실습을 파이썬으로 하고, 저자가 찾을 수 있는 밈은 최대한 넣었습니다. 딱딱한 교과서보다는 옆자리 동료가 설명해 주는 느낌으로 읽어 주세요.

## 이 책의 구성

원서의 25개 장과 부록 5편을 모두 옮겼습니다.

```{=html}
<div class="toc-cards">
<a class="card-item" href="01-Introduction-To-Causality.html" style="text-decoration:none">
<div class="card-label">1부 · 1~16장</div>
<div class="card-title">인과추론의 기초</div>
<p>잠재적 결과, 인과 그래프, 편향부터 회귀분석, 도구변수, 매칭, 성향점수, 이중차분법, 통제집단합성법, 회귀 불연속 설계까지.</p>
</a>
<a class="card-item" href="17-Predictive-Models-101.html" style="text-decoration:none">
<div class="card-label">2부 · 17~25장</div>
<div class="card-title">인과추론의 실무 응용</div>
<p>이질적 처치효과와 개인화, 인과 모델 평가, 메타러너, 이중 머신러닝, 이중차분법의 최근 논의와 합성 이중차분법.</p>
</a>
<a class="card-item" href="Debiasing-with-Orthogonalization.html" style="text-decoration:none">
<div class="card-label">부록 · 5편</div>
<div class="card-title">더 깊이 보기</div>
<p>직교화와 성향점수로 편향 제거하기, 예측이 실패하는 경우, 예측 지표의 함정, 컨포멀 추론.</p>
</a>
</div>
```

1부는 학계에서 자리 잡은 내용이라 인과적 질문을 다룰 때 기댈 수 있는 튼튼한 토대가 됩니다. 2부는 저자가 핀테크 회사에서 쌓은 실무 경험에서 나온 내용이 많아 더 실험적이고, 그만큼 현업에 바로 가져다 쓸 거리가 많습니다.

## 이렇게 읽어 주세요

각 장은 원서의 주피터 노트북을 그대로 옮긴 것이라 코드와 출력이 원서와 같습니다. 노트북 파일은 [GitHub 저장소](https://github.com/CausalInferenceLab/Causal-Inference-with-Python/tree/main/causal-inference-for-the-brave-and-true)에서 내려받아 직접 실행해 볼 수 있습니다. 그래프를 그리는 코드처럼 길어서 접어 둔 셀은 **코드**를 눌러 펼치면 됩니다.

용어는 같은 저자의 책을 옮긴 『실무로 통하는 인과추론 with 파이썬』(한빛미디어)과 맞췄습니다. 두 책을 함께 보셔도 용어가 헷갈리지 않습니다. 번역 원칙과 용어표는 [번역 가이드](https://github.com/CausalInferenceLab/Causal-Inference-with-Python/blob/main/TRANSLATION_GUIDE.md)에 정리해 두었습니다.

## 함께 만들어 주세요

인과추론팀은 전문 번역가가 아니라 데이터 분석가, 데이터 과학자, 연구자로 이루어져 있습니다. 어색하거나 틀린 부분이 보이면 [이슈](https://github.com/CausalInferenceLab/Causal-Inference-with-Python/issues)로 알려 주시거나 직접 PR을 보내 주세요. 도움이 되었다면 [GitHub 스타](https://github.com/CausalInferenceLab/Causal-Inference-with-Python)로 응원해 주시면 큰 힘이 됩니다.

한국어 번역에 흔쾌히 동의해 준 Matheus Facure와, 번역과 실습 자료를 함께 만든 인과추론팀 멤버들에게 감사드립니다.

## 원저자의 감사의 말

> 이 시리즈 전체를 Joshua Angrist, Alberto Abadie, Christopher Walters의 훌륭한 계량경제학 강의에 바치는 헌사로 생각합니다. 1부의 아이디어는 대부분 이들이 미국경제학회(American Economic Association)에서 한 강의에서 가져왔습니다. Angrist의 책들은 계량경제학이 아주 유용할 뿐 아니라 무척 재미있다는 것을 알려 주었고, Miguel Hernan과 Jamie Robins의 책은 가장 까다로운 인과적 질문 앞에서 늘 믿고 기댄 동반자였습니다.

- [Mastering Mostly Harmless Econometrics](https://www.aeaweb.org/conference/cont-ed/2020-webcasts) · [Cross-Section Econometrics](https://www.aeaweb.org/conference/cont-ed/2017-webcasts)
- [Mostly Harmless Econometrics](https://www.mostlyharmlesseconometrics.com/) · [Mastering 'Metrics](https://www.masteringmetrics.com/)
- [Causal Inference: What If](https://miguelhernan.org/whatifbook)

원서는 누구나 무료로 볼 수 있는 오픈소스 자료입니다. 원서가 도움이 되었다면 저자의 [Patreon](https://www.patreon.com/causal_inference_for_the_brave_and_true)을 후원하거나 [원서 저장소에 스타](https://github.com/matheusfacure/python-causality-handbook/stargazers)를 남겨 주세요.
Loading
Loading