Skip to content
Submodule
causalis.scenarios.did.refutation.post_inference

post_inference

Submodule causalis.scenarios.did.refutation.post_inference with no child pages and 6 documented members.

Functions

Jump directly into the documented functions for this page.

5 items

Data

Jump directly into the documented data for this page.

1 items
function
causalis.scenarios.did.refutation.post_inference.did_post_inference_cell_table

did_post_inference_cell_table

Return fitted cell-level inference diagnostics for a Callaway & Sant’Anna estimate.

This function merges the point estimates and standard errors with auxiliary cell-level diagnostics produced during the estimation process (e.g., propensity clipping, covariate balance, and effective sample sizes).

Parameters

estimateCallawaySantAnnaDIDEstimate

The fitted estimate object from a CallawaySantAnnaDID model.

Returns

pd.DataFrame

A table where each row corresponds to an ATT(g,t) cell, containing: - group: The treatment group (first treated period). - time: The calendar time period. - att: The point estimate for this cell. - se: The standard error. - t_stat: The t-statistic (att / se). - is_post_treatment: Whether the cell is in the post-treatment period. - Additional columns from the model’s cell diagnostics (e.g., control_ess, max_propensity_clip).

Examples

Canonical target

causalis.scenarios.did.refutation.post_inference.did_post_inference_cell_table

Sections

ParametersReturnsExamples
Link to this symbol
function
causalis.scenarios.did.refutation.post_inference.did_influence_table

did_influence_table

Return unit-level influence shares for the simple overall ATT.

Influence scores represent the first-order contribution of each unit to the final estimate. This function aggregates influence scores across all ATT(g,t) cells used in the simple average ATT and calculates their relative shares.

Parameters

data_or_estimatePanelDataDID or CallawaySantAnnaDIDEstimate

If a PanelDataDID object is provided, the second argument estimate must be supplied. If a CallawaySantAnnaDIDEstimate is provided, the data will be resolved from the estimate if possible.

estimateCallawaySantAnnaDIDEstimate, optional

The fitted estimate object. Required if the first argument is data.

top_nint, optional

If provided, only return the top N units by absolute influence share.

Returns

pd.DataFrame

A table of unit-level influence metrics: - unit_id: The unit identifier. - rank: Ranking by absolute influence. - influence_score: The raw aggregated influence score. - abs_influence_score: The absolute value of the score. - abs_influence_share: The share of total absolute influence.

Notes

The influence share for unit ii is defined as:

.. math:: S_i = \frac{|\psi_i|}{\sum_{j=1}^n |\psi_j|}

where ψi\psi_i is the influence score of unit ii on the target parameter (e.g., the simple aggregate ATT). High influence shares indicate units that have a disproportionate impact on the final result.

Examples

Canonical target

causalis.scenarios.did.refutation.post_inference.did_influence_table

Sections

ParametersReturnsNotesExamples
Link to this symbol
function
causalis.scenarios.did.refutation.post_inference.did_cluster_influence_table

did_cluster_influence_table

Return cluster-level influence shares for clustered Callaway & Sant’Anna estimates.

Aggregates unit-level influence scores up to the cluster level. This is essential for diagnostics when the model was fitted using clustered standard errors, as the independence assumption holds at the cluster level.

Parameters

dataPanelDataDID

The original panel data used for estimation.

estimateCallawaySantAnnaDIDEstimate

The fitted estimate object, which must have cluster_col defined.

Returns

pd.DataFrame

A table of cluster-level influence metrics: - cluster_id: The cluster identifier. - rank: Ranking by absolute influence. - influence_score: Sum of unit influence scores within the cluster. - abs_influence_share: Share of total absolute influence.

Examples

Assuming data has a ‘cluster’ column

Canonical target

causalis.scenarios.did.refutation.post_inference.did_cluster_influence_table

Sections

ParametersReturnsExamples
Link to this symbol
function
causalis.scenarios.did.refutation.post_inference.run_did_post_inference_diagnostics

run_did_post_inference_diagnostics

Run post-fit Callaway & Sant’Anna inference diagnostics and return a reliability report.

This function performs a comprehensive suite of checks on the fitted model to detect potential issues with identification, estimation stability, and excessive influence of individual observations.

Parameters

data_or_estimatePanelDataDID or CallawaySantAnnaDIDEstimate

The first argument can be either the data or the estimate. If data is passed, the estimate argument must also be provided.

estimateCallawaySantAnnaDIDEstimate, optional

The fitted estimate object. Required if the first argument is data.

max_skipped_post_cell_sharefloat, default 0.20

Maximum allowable share of requested post-treatment cells that were skipped (e.g., due to lack of treated/control units).

min_control_essfloat, default 20.0

Minimum effective sample size for the control group in each ATT(g,t) cell.

max_propensity_clip_sharefloat, default 0.05

Maximum share of units in a cell that can have their propensity scores clipped to the boundaries.

max_abs_weighted_smdfloat, default 0.25

Maximum allowable absolute weighted Standardized Mean Difference (SMD) for covariates after IPW reweighting.

max_top_unit_influence_sharefloat, default 0.20

Maximum absolute influence share of the single most influential unit.

max_top_cluster_influence_sharefloat, default 0.50

Maximum absolute influence share of the single most influential cluster.

min_influence_essfloat, default 10.0

Minimum Effective Sample Size (ESS) based on influence scores, calculated as 1/wi21 / \sum w_i^2.

max_abs_pretrend_t_statfloat, default 2.0

Maximum absolute t-statistic allowed for pre-treatment testing cells.

max_simple_cell_weight_sharefloat, default 0.50

Maximum weight share of any single ATT(g,t) cell in the simple aggregate ATT.

min_clustersint, default 2

Minimum number of clusters required for valid clustered inference.

require_multiplier_bootstrapbool, default False

If True, flags a warning if the multiplier bootstrap was not used for simultaneous inference.

Returns

pd.DataFrame

A diagnostic report with columns: - test: Name of the diagnostic check. - flag: Status (GREEN, YELLOW, RED). - value: Observed value of the metric. - threshold: The threshold used for the check. - message: Descriptive result message.

Notes

The influence-based ESS is a measure of how concentrated the estimate’s dependence is on a small subset of units. It is defined as:

.. math:: ESS_{\psi} = \frac{(\sum |\psi_i|)^2}{\sum \psi_i^2}

Low values suggest the result may be driven by outliers.

Examples

Canonical target

causalis.scenarios.did.refutation.post_inference.run_did_post_inference_diagnostics

Sections

ParametersReturnsNotesExamples
Link to this symbol
function
causalis.scenarios.did.refutation.post_inference.run_did_inference_diagnostics

run_did_inference_diagnostics

Alias for :func:run_did_post_inference_diagnostics.

Canonical target

causalis.scenarios.did.refutation.post_inference.run_did_inference_diagnostics

Link to this symbol
data
causalis.scenarios.did.refutation.post_inference.__all__

__all__

Value: ['did_post_inference_cell_table', 'did_influence_table', 'did_cluster_influence_table', 'run_did_pos...

[‘did_post_inference_cell_table’, ‘did_influence_table’, ‘did_cluster_influence_table’, ‘run_did_pos…

Canonical target

causalis.scenarios.did.refutation.post_inference.__all__

Link to this symbol