{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Chapter 21: Inference, Robust Standard Errors, and Diagnostics\n",
        "**Economic question:** How certain should we be about an estimated coefficient?\n",
        "\nA coefficient estimate without a defensible uncertainty estimate is only half an empirical result.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "import numpy as np, statsmodels.api as sm\n",
        "rng=np.random.default_rng(21)\n",
        "x=np.linspace(0,10,300)\n",
        "y=2+.8*x+rng.normal(0,.3+.35*x,300)\n",
        "ols=sm.OLS(y,sm.add_constant(x)).fit()\n",
        "robust=ols.get_robustcov_results(cov_type='HC3')\n",
        "print('classical SE',ols.bse[1],'HC3 SE',robust.bse[1])\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": 21,
      "source_origin": "supplied"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}
