Skip to content

Instantly share code, notes, and snippets.

@MaxGhenis
Last active January 27, 2026 00:12
Show Gist options
  • Select an option

  • Save MaxGhenis/41b47cf60a5d7c038d22f835b053e7ce to your computer and use it in GitHub Desktop.

Select an option

Save MaxGhenis/41b47cf60a5d7c038d22f835b053e7ce to your computer and use it in GitHub Desktop.
Impact of Unemployment Insurance on Child Poverty (2026) - PolicyEngine-US Analysis
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Impact of Unemployment Insurance on Child Poverty\n",
"\n",
"This notebook analyzes how unemployment insurance (UI) benefits affect child poverty in 2026 using PolicyEngine-US microsimulation.\n",
"\n",
"**Methodology:**\n",
"- Compare baseline (with UI) to counterfactual (UI zeroed out)\n",
"- UI removal cascades through tax calculations and other benefits\n",
"- Uses SPM (Supplemental Poverty Measure) for poverty measurement"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-27T00:11:51.566198Z",
"iopub.status.busy": "2026-01-27T00:11:51.566122Z",
"iopub.status.idle": "2026-01-27T00:11:51.568527Z",
"shell.execute_reply": "2026-01-27T00:11:51.568145Z"
}
},
"outputs": [],
"source": [
"# Install dependencies if needed\n",
"# !pip install policyengine-us"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-27T00:11:51.569554Z",
"iopub.status.busy": "2026-01-27T00:11:51.569443Z",
"iopub.status.idle": "2026-01-27T00:11:55.699316Z",
"shell.execute_reply": "2026-01-27T00:11:55.698863Z"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/maxghenis/policyengine-ui-analysis/.venv/lib/python3.14/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
}
],
"source": [
"from policyengine_us import Microsimulation\n",
"import numpy as np\n",
"import pandas as pd\n",
"\n",
"year = 2026"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setup Simulations"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-27T00:11:55.700569Z",
"iopub.status.busy": "2026-01-27T00:11:55.700481Z",
"iopub.status.idle": "2026-01-27T00:11:56.427316Z",
"shell.execute_reply": "2026-01-27T00:11:56.426984Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Simulations initialized for 2026\n"
]
}
],
"source": [
"# Baseline simulation (current law with UI)\n",
"baseline = Microsimulation()\n",
"\n",
"# Counterfactual: zero out unemployment compensation\n",
"# This cascades through tax calculations and SPM benefits\n",
"counterfactual = Microsimulation()\n",
"counterfactual.set_input(\n",
" \"unemployment_compensation\",\n",
" year,\n",
" counterfactual.calc(\"unemployment_compensation\", period=year).values * 0,\n",
")\n",
"\n",
"print(f\"Simulations initialized for {year}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Child Poverty Impact"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-27T00:11:56.428498Z",
"iopub.status.busy": "2026-01-27T00:11:56.428419Z",
"iopub.status.idle": "2026-01-27T00:12:09.032749Z",
"shell.execute_reply": "2026-01-27T00:12:09.032105Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"=== CHILD POVERTY IMPACT ===\n",
"Baseline child poverty rate (with UI): 18.83%\n",
"Counterfactual child poverty rate (without UI): 19.04%\n",
"UI reduces child poverty by: 0.21% (1.1% reduction)\n",
"Children lifted out of poverty by UI: 154,828\n"
]
}
],
"source": [
"# Get child indicator\n",
"is_child = baseline.calc(\"is_child\", period=year)\n",
"\n",
"# Calculate SPM poverty status for each person\n",
"baseline_in_poverty = baseline.calc(\"person_in_poverty\", period=year)\n",
"counterfactual_in_poverty = counterfactual.calc(\"person_in_poverty\", period=year)\n",
"\n",
"# Filter to children only\n",
"baseline_child_poverty = baseline_in_poverty[is_child.values == 1]\n",
"counterfactual_child_poverty = counterfactual_in_poverty[is_child.values == 1]\n",
"\n",
"# Calculate rates (MicroSeries .mean() is weighted automatically)\n",
"baseline_rate = float(baseline_child_poverty.mean())\n",
"counterfactual_rate = float(counterfactual_child_poverty.mean())\n",
"\n",
"# Calculate reduction metrics\n",
"reduction_pp = counterfactual_rate - baseline_rate\n",
"reduction_pct = reduction_pp / counterfactual_rate if counterfactual_rate > 0 else 0\n",
"\n",
"# Count children lifted out of poverty\n",
"total_children = float(is_child.sum())\n",
"children_lifted = total_children * reduction_pp\n",
"\n",
"print(\"=== CHILD POVERTY IMPACT ===\")\n",
"print(f\"Baseline child poverty rate (with UI): {baseline_rate:.2%}\")\n",
"print(f\"Counterfactual child poverty rate (without UI): {counterfactual_rate:.2%}\")\n",
"print(f\"UI reduces child poverty by: {reduction_pp:.2%} ({reduction_pct:.1%} reduction)\")\n",
"print(f\"Children lifted out of poverty by UI: {children_lifted:,.0f}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Fiscal Impacts"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-27T00:12:09.034491Z",
"iopub.status.busy": "2026-01-27T00:12:09.034400Z",
"iopub.status.idle": "2026-01-27T00:12:09.038752Z",
"shell.execute_reply": "2026-01-27T00:12:09.038416Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"=== FISCAL IMPACTS (zeroing UI vs baseline) ===\n",
"UI outlays change: $-42.24B\n",
"Federal tax revenue change: $-5.11B\n",
"State/local tax revenue change: $-0.89B\n",
"Other benefits change (SNAP, etc.): $0.91B\n",
"SPM unit net income change: $-35.33B\n"
]
}
],
"source": [
"# UI outlays (person level)\n",
"ui_baseline = baseline.calc(\"unemployment_compensation\", period=year)\n",
"ui_counterfactual = counterfactual.calc(\"unemployment_compensation\", period=year)\n",
"ui_change = float((ui_counterfactual - ui_baseline).sum())\n",
"\n",
"# SPM unit net income (market income + benefits - taxes)\n",
"spm_net_baseline = baseline.calc(\"spm_unit_net_income\", period=year)\n",
"spm_net_counterfactual = counterfactual.calc(\"spm_unit_net_income\", period=year)\n",
"spm_net_change = float((spm_net_counterfactual - spm_net_baseline).sum())\n",
"\n",
"# Federal tax (at SPM unit level to avoid double-counting)\n",
"fed_tax_baseline = baseline.calc(\"spm_unit_federal_tax\", period=year)\n",
"fed_tax_counterfactual = counterfactual.calc(\"spm_unit_federal_tax\", period=year)\n",
"fed_tax_change = float((fed_tax_counterfactual - fed_tax_baseline).sum())\n",
"\n",
"# State/local tax\n",
"state_tax_baseline = baseline.calc(\"spm_unit_state_tax\", period=year)\n",
"state_tax_counterfactual = counterfactual.calc(\"spm_unit_state_tax\", period=year)\n",
"state_tax_change = float((state_tax_counterfactual - state_tax_baseline).sum())\n",
"\n",
"# Total benefits (includes UI and other programs like SNAP)\n",
"benefits_baseline = baseline.calc(\"spm_unit_benefits\", period=year)\n",
"benefits_counterfactual = counterfactual.calc(\"spm_unit_benefits\", period=year)\n",
"benefits_change = float((benefits_counterfactual - benefits_baseline).sum())\n",
"\n",
"# Other benefits = total benefits change - UC change\n",
"# This shows how much other programs (SNAP, etc.) increase when UI is removed\n",
"other_benefits_change = benefits_change - ui_change\n",
"\n",
"print(\"=== FISCAL IMPACTS (zeroing UI vs baseline) ===\")\n",
"print(f\"UI outlays change: ${ui_change/1e9:.2f}B\")\n",
"print(f\"Federal tax revenue change: ${fed_tax_change/1e9:.2f}B\")\n",
"print(f\"State/local tax revenue change: ${state_tax_change/1e9:.2f}B\")\n",
"print(f\"Other benefits change (SNAP, etc.): ${other_benefits_change/1e9:.2f}B\")\n",
"print(f\"SPM unit net income change: ${spm_net_change/1e9:.2f}B\")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-27T00:12:09.039983Z",
"iopub.status.busy": "2026-01-27T00:12:09.039916Z",
"iopub.status.idle": "2026-01-27T00:12:09.041987Z",
"shell.execute_reply": "2026-01-27T00:12:09.041602Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"=== NET FEDERAL IMPACT ===\n",
"Net federal cost of UI program: $36.22B\n",
" = $42.24B UI outlays\n",
" + $-0.91B other benefits offset (SNAP etc. would increase without UI)\n",
" - $5.11B lost tax revenue\n"
]
}
],
"source": [
"# Net federal cost = UI outlays + other benefits offset - tax revenue change\n",
"net_federal_cost = ui_change + other_benefits_change - fed_tax_change\n",
"\n",
"print(\"=== NET FEDERAL IMPACT ===\")\n",
"print(f\"Net federal cost of UI program: ${-net_federal_cost/1e9:.2f}B\")\n",
"print(f\" = ${-ui_change/1e9:.2f}B UI outlays\")\n",
"print(f\" + ${-other_benefits_change/1e9:.2f}B other benefits offset (SNAP etc. would increase without UI)\")\n",
"print(f\" - ${-fed_tax_change/1e9:.2f}B lost tax revenue\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Summary Table"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-27T00:12:09.042926Z",
"iopub.status.busy": "2026-01-27T00:12:09.042870Z",
"iopub.status.idle": "2026-01-27T00:12:09.048751Z",
"shell.execute_reply": "2026-01-27T00:12:09.048298Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Metric</th>\n",
" <th>Value</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Child poverty rate with UI</td>\n",
" <td>18.83%</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Child poverty rate without UI</td>\n",
" <td>19.04%</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Poverty reduction (pp)</td>\n",
" <td>0.21%</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Poverty reduction (%)</td>\n",
" <td>1.1%</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Children lifted from poverty</td>\n",
" <td>154,828</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>UI outlays ($B)</td>\n",
" <td>$42.2B</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>Federal tax effect ($B)</td>\n",
" <td>$5.1B</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>State/local tax effect ($B)</td>\n",
" <td>$0.9B</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>Other benefits offset ($B)</td>\n",
" <td>$-0.9B</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>Net income effect ($B)</td>\n",
" <td>$35.3B</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>Net federal cost ($B)</td>\n",
" <td>$36.2B</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Metric Value\n",
"0 Child poverty rate with UI 18.83%\n",
"1 Child poverty rate without UI 19.04%\n",
"2 Poverty reduction (pp) 0.21%\n",
"3 Poverty reduction (%) 1.1%\n",
"4 Children lifted from poverty 154,828\n",
"5 UI outlays ($B) $42.2B\n",
"6 Federal tax effect ($B) $5.1B\n",
"7 State/local tax effect ($B) $0.9B\n",
"8 Other benefits offset ($B) $-0.9B\n",
"9 Net income effect ($B) $35.3B\n",
"10 Net federal cost ($B) $36.2B"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"summary = pd.DataFrame({\n",
" \"Metric\": [\n",
" \"Child poverty rate with UI\",\n",
" \"Child poverty rate without UI\",\n",
" \"Poverty reduction (pp)\",\n",
" \"Poverty reduction (%)\",\n",
" \"Children lifted from poverty\",\n",
" \"UI outlays ($B)\",\n",
" \"Federal tax effect ($B)\",\n",
" \"State/local tax effect ($B)\",\n",
" \"Other benefits offset ($B)\",\n",
" \"Net income effect ($B)\",\n",
" \"Net federal cost ($B)\",\n",
" ],\n",
" \"Value\": [\n",
" f\"{baseline_rate:.2%}\",\n",
" f\"{counterfactual_rate:.2%}\",\n",
" f\"{reduction_pp:.2%}\",\n",
" f\"{reduction_pct:.1%}\",\n",
" f\"{children_lifted:,.0f}\",\n",
" f\"${-ui_change/1e9:.1f}B\",\n",
" f\"${-fed_tax_change/1e9:.1f}B\",\n",
" f\"${-state_tax_change/1e9:.1f}B\",\n",
" f\"${-other_benefits_change/1e9:.1f}B\",\n",
" f\"${-spm_net_change/1e9:.1f}B\",\n",
" f\"${-net_federal_cost/1e9:.1f}B\",\n",
" ]\n",
"})\n",
"\n",
"summary"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"execution": {
"iopub.execute_input": "2026-01-27T00:12:09.049816Z",
"iopub.status.busy": "2026-01-27T00:12:09.049736Z",
"iopub.status.idle": "2026-01-27T00:12:09.052207Z",
"shell.execute_reply": "2026-01-27T00:12:09.051765Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"PolicyEngine-US version: 1.525.0\n"
]
}
],
"source": [
"from importlib.metadata import version\n",
"print(f\"PolicyEngine-US version: {version('policyengine-us')}\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.0"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment