{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Robust Joint Tests\n",
        "\n",
        "Module 8 notebook lab. This notebook uses original Ceteris Lab teaching data and does not report real empirical findings.\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Learning goal\n",
        "Test multiple restrictions with robust covariance.\n",
        "\n",
        "Dataset: MODULE8_ROBUST_SE_DEMO. Variables: observation_id, outcome, x1, x2, group, error_variance.\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "import pandas as pd\n",
        "import statsmodels.api as sm\n",
        "\n",
        "df = pd.read_csv(\"/data/module-8/module8_robust_se_demo.csv\")\n",
        "X = sm.add_constant(df[[\"x1\", \"x2\"]])\n",
        "model = sm.OLS(df[\"outcome\"], X).fit()\n",
        "robust = model.get_robustcov_results(cov_type=\"HC1\")\n",
        "print(robust.f_test(\"x1 = 0, x2 = 0\"))\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Reflection\n",
        "Write two sentences: one sentence explaining what the diagnostic or robust result says, and one sentence explaining a limitation or next step.\n"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "name": "python",
      "version": "3.11"
    },
    "ceteris_lab": {
      "module": "Module 8",
      "lesson": "Robust Joint Tests",
      "dataset": "MODULE8_ROBUST_SE_DEMO",
      "copyright": "Original Ceteris Lab notebook. No external text, tables, or figures are reproduced."
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}
