{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Chapter 26: Censoring, Selection, Quantiles, and Robust Methods\n",
        "**Economic question:** What if the mean is not the whole story, or part of the outcome is unobserved?\n",
        "\nQuantile regression asks how covariates relate to different points of the conditional outcome distribution, not just its mean.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "import numpy as np, statsmodels.api as sm\n",
        "rng=np.random.default_rng(26); x=rng.uniform(0,10,500); y=2+.7*x+rng.standard_t(3,500)*(1+.2*x)\n",
        "X=sm.add_constant(x)\n",
        "for q in [.25,.5,.75]:\n",
        "    fit=sm.QuantReg(y,X).fit(q=q)\n",
        "    print(q, fit.params)\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": 26,
      "source_origin": "supplied"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}
