Skip to content

Commit ec1de01

Browse files
authored
Merge pull request #405 from igerber/docs/sphinx-error-cleanup
docs: fix 86 Sphinx ERRORs (PR 1 of 2-PR cleanup)
2 parents 4469f54 + 2ed01b0 commit ec1de01

25 files changed

Lines changed: 63 additions & 39 deletions

diff_diff/bacon.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,7 @@ def bacon_decompose(
10851085
Use 0 (or np.inf) for never-treated units.
10861086
weights : str, default="approximate"
10871087
Weight calculation method:
1088+
10881089
- "approximate": Fast simplified formula (default). Good for
10891090
diagnostic purposes where relative weights are sufficient.
10901091
- "exact": Variance-based weights from Goodman-Bacon (2021)
@@ -1094,6 +1095,7 @@ def bacon_decompose(
10941095
-------
10951096
BaconDecompositionResults
10961097
Object containing decomposition results with:
1098+
10971099
- twfe_estimate: The overall TWFE coefficient
10981100
- comparisons: List of all 2x2 comparisons with estimates and weights
10991101
- Weight totals by comparison type

diff_diff/chaisemartin_dhaultfoeuille_results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ def __repr__(self) -> str:
709709

710710
@property
711711
def coef_var(self) -> float:
712-
"""SE / |DID_M|; NaN when DID_M is 0 or SE non-finite."""
712+
"""SE / abs(DID_M); NaN when DID_M is 0 or SE non-finite."""
713713
if not (np.isfinite(self.overall_se) and self.overall_se >= 0):
714714
return np.nan
715715
if not np.isfinite(self.overall_att) or self.overall_att == 0:

diff_diff/continuous_did_results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def __repr__(self) -> str:
156156

157157
@property
158158
def coef_var(self) -> float:
159-
"""Coefficient of variation: SE / |overall ATT|. NaN when ATT is 0 or SE non-finite."""
159+
"""Coefficient of variation: SE / abs(overall ATT). NaN when ATT is 0 or SE non-finite."""
160160
if not (np.isfinite(self.overall_att_se) and self.overall_att_se >= 0):
161161
return np.nan
162162
if not np.isfinite(self.overall_att) or self.overall_att == 0:

diff_diff/diagnostic_report.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,9 @@ class DiagnosticReport:
256256
Column names identifying the panel structure.
257257
pre_periods, post_periods : list, optional
258258
Explicit pre- and post-treatment period labels.
259-
run_parallel_trends, run_sensitivity, run_placebo, run_bacon,
260-
run_design_effect, run_heterogeneity, run_epv, run_pretrends_power : bool
259+
run_parallel_trends, run_sensitivity, run_placebo, run_bacon, run_design_effect, run_heterogeneity, run_epv, run_pretrends_power : bool
261260
Per-check opt-in flags. ``run_placebo`` defaults to ``False`` (opt-in,
262-
expensive, currently not implemented placebo key remains reserved
261+
expensive, currently not implemented - placebo key remains reserved
263262
as ``skipped`` in the schema). All other checks default to ``True``
264263
and are further gated by estimator-type and instance-level
265264
applicability (see ``docs/methodology/REPORTING.md``).

diff_diff/efficient_did_results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def __repr__(self) -> str:
180180

181181
@property
182182
def coef_var(self) -> float:
183-
"""Coefficient of variation: SE / |overall ATT|. NaN when ATT is 0 or SE non-finite."""
183+
"""Coefficient of variation: SE / abs(overall ATT). NaN when ATT is 0 or SE non-finite."""
184184
if not (np.isfinite(self.overall_se) and self.overall_se >= 0):
185185
return np.nan
186186
if not np.isfinite(self.overall_att) or self.overall_att == 0:

diff_diff/had.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ class HeterogeneousAdoptionDiDResults:
233233
``(Ybar_{Z=1} - Ybar_{Z=0}) / (Dbar_{Z=1} - Dbar_{Z=0})``.
234234
se : float
235235
Standard error on the beta-scale. For continuous designs:
236+
236237
- Unweighted or ``weights=<array>``: CCT-2014 weighted-robust SE
237238
from Phase 1c divided by ``|den|`` (``den`` = raw or weighted
238239
denominator depending on fit path).
@@ -241,6 +242,7 @@ class HeterogeneousAdoptionDiDResults:
241242
aligned with ``tau_bc``) routed through
242243
:func:`compute_survey_if_variance` for PSU-aggregated,
243244
FPC/strata-adjusted variance, divided by ``|den|``.
245+
244246
In both cases the higher-order variance from ``mean(ΔY)`` is
245247
dominated by the nonparametric boundary estimate in large
246248
samples and is not included in the leading-order formula. For

diff_diff/honest_did.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ class DeltaSD:
4040
Smoothness restriction on trend violations (Delta^{SD}).
4141
4242
Restricts the second differences of the trend violations:
43-
|delta_{t+1} - 2*delta_t + delta_{t-1}| <= M
43+
44+
.. math::
45+
46+
|\\delta_{t+1} - 2\\delta_t + \\delta_{t-1}| \\le M
4447
4548
When M=0, this enforces that violations follow a linear trend
4649
(linear extrapolation of pre-trends). Larger M allows more
@@ -75,7 +78,10 @@ class DeltaRM:
7578
7679
Post-treatment consecutive first differences are bounded by Mbar
7780
times the maximum pre-treatment first difference:
78-
|delta_{t+1} - delta_t| <= Mbar * max_{s<0} |delta_{s+1} - delta_s|
81+
82+
.. math::
83+
84+
|\\delta_{t+1} - \\delta_t| \\le \\overline{M} \\cdot \\max_{s<0} |\\delta_{s+1} - \\delta_s|
7985
8086
When Mbar=0, this enforces zero post-treatment first differences.
8187
Mbar=1 means post-period first differences can be as large as the
@@ -109,8 +115,9 @@ class DeltaSDRM:
109115
Combined smoothness and relative magnitudes restriction.
110116
111117
Imposes both:
112-
1. Smoothness: |delta_{t+1} - 2*delta_t + delta_{t-1}| <= M
113-
2. Relative magnitudes: |delta_{t+1} - delta_t| <= Mbar * max_{s<0} |delta_{s+1} - delta_s|
118+
119+
1. Smoothness: :math:`|\\delta_{t+1} - 2\\delta_t + \\delta_{t-1}| \\le M`
120+
2. Relative magnitudes: :math:`|\\delta_{t+1} - \\delta_t| \\le \\overline{M} \\cdot \\max_{s<0} |\\delta_{s+1} - \\delta_s|`
114121
115122
This is more restrictive than either constraint alone.
116123

diff_diff/imputation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class ImputationDiD(ImputationDiDBootstrapMixin):
7575
- "silent": Drop columns silently
7676
horizon_max : int, optional
7777
Maximum event-study horizon. If set, event study effects are only
78-
computed for |h| <= horizon_max.
78+
computed for abs(h) <= horizon_max.
7979
aux_partition : str, default="cohort_horizon"
8080
Controls the auxiliary model partition for Theorem 3 variance:
8181
- "cohort_horizon": Groups by cohort x relative time (tightest SEs)

diff_diff/imputation_results.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ class ImputationDiDResults:
104104
n_obs : int
105105
Total number of observations.
106106
n_treated_obs : int
107-
Number of treated observations (|Omega_1|).
107+
Number of treated observations (:math:`|\\Omega_1|`).
108108
n_untreated_obs : int
109-
Number of untreated observations (|Omega_0|).
109+
Number of untreated observations (:math:`|\\Omega_0|`).
110110
n_treated_units : int
111111
Number of ever-treated units.
112112
n_control_units : int
@@ -155,7 +155,7 @@ def __repr__(self) -> str:
155155

156156
@property
157157
def coef_var(self) -> float:
158-
"""Coefficient of variation: SE / |overall ATT|. NaN when ATT is 0 or SE non-finite."""
158+
"""Coefficient of variation: SE / abs(overall ATT). NaN when ATT is 0 or SE non-finite."""
159159
if not (np.isfinite(self.overall_se) and self.overall_se >= 0):
160160
return np.nan
161161
if not np.isfinite(self.overall_att) or self.overall_att == 0:

diff_diff/prep.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,7 @@ def rank_control_units(
834834
-------
835835
pd.DataFrame
836836
Ranked control units with columns:
837+
837838
- unit: Unit identifier
838839
- quality_score: Combined quality score (0-1, higher is better)
839840
- outcome_trend_score: Pre-treatment outcome trend similarity
@@ -846,6 +847,7 @@ def rank_control_units(
846847
- is_required: Whether unit was in require_units
847848
848849
If suggest_treatment_candidates=True (and no treated units):
850+
849851
- unit: Unit identifier
850852
- treatment_candidate_score: Suitability as treatment unit
851853
- avg_outcome_level: Pre-treatment outcome mean

0 commit comments

Comments
 (0)