Skip to content

Commit ff61e55

Browse files
committed
Clarify EventStudy formula and event-time dummies
Expanded documentation to explain the patsy formula syntax, the role of unit and time fixed effects, and how event-time dummies ($\beta_k$) are automatically constructed by the EventStudy class. Added details on the event window and reference event time parameters for clearer guidance.
1 parent e7e0562 commit ff61e55

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

docs/source/notebooks/event_study_pymc.ipynb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,15 @@
334334
"\n",
335335
"Now we use CausalPy's `EventStudy` class to estimate the dynamic treatment effects.\n",
336336
"\n",
337-
"The `formula` parameter uses patsy syntax to specify the model:\n",
338-
"- `y ~ C(unit) + C(time)` specifies the outcome variable `y` with unit and time fixed effects\n",
337+
"The `formula` parameter uses patsy syntax to specify the model structure:\n",
338+
"- `y ~ C(unit) + C(time)` specifies the outcome variable `y` with unit fixed effects ($\\alpha_i$) and time fixed effects ($\\lambda_t$)\n",
339339
"- `C(column)` indicates a categorical variable that should be converted to dummy variables\n",
340-
"- Event-time dummies are added automatically by the class\n",
340+
"\n",
341+
"**What about the $\\beta_k$ coefficients?** These are the event-time dummies - the key parameters we want to estimate. They capture the treatment effect at each period *relative to treatment* (i.e., at each event time $k$). The class automatically constructs these based on:\n",
342+
"- The `event_window` parameter (e.g., `(-5, 5)` means $k \\in \\{-5, -4, ..., 0, ..., 5\\}$)\n",
343+
"- The `reference_event_time` parameter (e.g., `-1` is omitted as the baseline)\n",
344+
"\n",
345+
"So the formula specifies the \"structural\" part of the model ($\\alpha_i + \\lambda_t$), while the event-time dummies ($\\sum_{k \\neq k_0} \\beta_k \\cdot \\mathbf{1}\\{E_{it} = k\\}$) are added automatically.\n",
341346
"\n",
342347
":::{note}\n",
343348
"The `random_seed` keyword argument for the PyMC sampler is not necessary. We use it here so that the results are reproducible.\n",

0 commit comments

Comments
 (0)