From 4c82a81c8ba8020bba58b7a612cb48d3203b1b80 Mon Sep 17 00:00:00 2001 From: igerber Date: Sun, 22 Feb 2026 15:31:38 -0500 Subject: [PATCH] Fix continuous DiD tutorial formatting: escape dollar signs and split chart cell - Escape $7, $11, $2 as \$7, \$11, \$2 in cell 14 to prevent Jupyter LaTeX rendering of currency amounts - Move explanatory print() text from chart cell 27 into a new markdown cell so prose doesn't mix into plot output Co-Authored-By: Claude Opus 4.6 --- docs/tutorials/14_continuous_did.ipynb | 27 ++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/docs/tutorials/14_continuous_did.ipynb b/docs/tutorials/14_continuous_did.ipynb index 95615bd..303e5c0 100644 --- a/docs/tutorials/14_continuous_did.ipynb +++ b/docs/tutorials/14_continuous_did.ipynb @@ -301,8 +301,8 @@ "source": [ "### Interpreting the dose-response curves\n", "\n", - "- **Left panel (ATT):** The total effect of training rises roughly linearly with dose, closely tracking the true curve (dashed). A worker with 3 hours of training gains about $7 in earnings; a worker with 5 hours gains about $11.\n", - "- **Right panel (ACRT):** The marginal return to one additional hour is approximately constant at $2, matching the true DGP. The confidence band is wider at extreme doses where fewer workers are observed.\n", + "- **Left panel (ATT):** The total effect of training rises roughly linearly with dose, closely tracking the true curve (dashed). A worker with 3 hours of training gains about \\$7 in earnings; a worker with 5 hours gains about \\$11.\n", + "- **Right panel (ACRT):** The marginal return to one additional hour is approximately constant at \\$2, matching the true DGP. The confidence band is wider at extreme doses where fewer workers are observed.\n", "\n", "These curves require the **strong parallel trends** assumption. Under standard PT only, the overall binarized effect is identified — this is ATT_loc (the local average across dose groups). The dose-response curve and ACRT_glob are not identified under standard PT because they involve cross-dose comparisons and counterfactual dose-response derivatives. The ATT_glob reported by the estimator is mechanically the binarized DiD: under standard PT it equals ATT_loc, while under strong PT it additionally equals the global average ATT_glob." ] @@ -563,7 +563,13 @@ "cell_type": "markdown", "id": "a5230e69", "metadata": {}, - "source": "## 7. Comparison to Binary DiD\n\nWhat if we ignore dose entirely and just run a standard binary Callaway-Sant'Anna estimator? Both approaches should give a similar **binarized ATT** (treated vs. untreated), but the binary approach discards all dose information — no dose-response curve, no marginal effects.\n\nNote: both estimators compute the binarized ATT by aggregating group-time effects, so the values should be very close. Under standard PT this identifies ATT_loc (the local average); under strong PT it additionally equals ATT_glob. Any small differences arise from weighting or aggregation choices, control group or base period settings, or finite-sample variation — not from spline smoothing. The continuous approach provides the full dose-response curve on top of the binarized effect." + "source": [ + "## 7. Comparison to Binary DiD\n", + "\n", + "What if we ignore dose entirely and just run a standard binary Callaway-Sant'Anna estimator? Both approaches should give a similar **binarized ATT** (treated vs. untreated), but the binary approach discards all dose information — no dose-response curve, no marginal effects.\n", + "\n", + "Note: both estimators compute the binarized ATT by aggregating group-time effects, so the values should be very close. Under standard PT this identifies ATT_loc (the local average); under strong PT it additionally equals ATT_glob. Any small differences arise from weighting or aggregation choices, control group or base period settings, or finite-sample variation — not from spline smoothing. The continuous approach provides the full dose-response curve on top of the binarized effect." + ] }, { "cell_type": "code", @@ -621,10 +627,15 @@ " ax.legend()\n", "\n", " plt.tight_layout()\n", - " plt.show()\n", - "\n", - " print(\"The red dashed line (binary DiD) collapses the entire dose-response curve\")\n", - " print(\"into a single number, losing the relationship between dose and effect.\")" + " plt.show()" + ] + }, + { + "cell_type": "markdown", + "id": "s8qmrof6v0f", + "metadata": {}, + "source": [ + "The red dashed line (binary DiD) collapses the entire dose-response curve into a single number, losing the relationship between dose and effect." ] }, { @@ -704,4 +715,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +}