{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Chapter 31: Synthetic Control and Comparative Case Studies\n",
        "**Economic question:** How can one treated region be compared with a data-driven combination of untreated regions?\n",
        "\nSynthetic control constructs a transparent counterfactual from weighted comparison units chosen to reproduce the treated unit before intervention.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "import numpy as np\n",
        "rng=np.random.default_rng(31); T=20; donors=np.vstack([10+.2*np.arange(T)+rng.normal(0,.3,T) for _ in range(4)])\n",
        "synth=donors.mean(axis=0); treated=synth+rng.normal(0,.15,T); treated[12:]+=2.5\n",
        "print('average post-treatment gap', (treated[12:]-synth[12:]).mean())\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Interpretation checklist\n",
        "- State the unit of observation and units of every variable.\n",
        "- Separate association, prediction, and causation.\n",
        "- Report magnitude and uncertainty.\n",
        "- Identify the most important threat to validity.\n"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "name": "python",
      "version": "3.13"
    },
    "ceteris_lab": {
      "course_slug": "fundamentals-python-econometrics",
      "course_title": "Fundamentals of Python for Financial Econometrics",
      "chapter": 31,
      "source_origin": "supplied"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}
