# `causalis.scenarios.did.refutation.diagnostic_plots`

## Module Contents

### Functions

`plot_did_support` | Plot Callaway & Sant’Anna support cells, sized by complete comparison-unit count.
`plot_raw_did_event_study` | Plot an unadjusted, pre-fit DID event-study diagnostic.

### Data

`__all__` |

### API

causalis.scenarios.did.refutation.diagnostic_plots.plot_did_support(data: causalis.data_contracts.PanelDataDID, *, control_group: causalis.data_contracts.panel_data_did.ComparisonGroup = 'not_yet_or_never', anticipation: int = 0, base_period: causalis.scenarios.did.refutation.diagnostics.BasePeriod = 'universal', include_pre_periods: bool = False, figsize: Tuple[float, float] = (10.0, 5.5), dpi: int = 220, font_scale: float = 1.05) → matplotlib.pyplot.Figure

  Plot Callaway & Sant’Anna support cells, sized by complete comparison-unit count.

  Visualizes which cohort-time cells are estimable given the selected control group and base period policy. Blue circles indicate supported cells, while red indicates unsupported cells. Circle size corresponds to the number of available control units.

  Parameters

  data : PanelDataDID The validated panel data object. control_group : {“not_yet_or_never”, “never_treated”}, default “not_yet_or_never” The definition of the comparison group. anticipation : int, default 0 Anticipation periods to exclude. base_period : {“universal”, “varying”}, default “universal” Base period policy. include_pre_periods : bool, default False Whether to include pre-treatment cells. figsize : tuple of float, default (10.0, 5.5) The size of the figure. dpi : int, default 220 Resolution of the figure. font_scale : float, default 1.05 Scaling factor for font sizes.

  Returns

  matplotlib.figure.Figure The resulting support plot.

  Examples

  > > > from causalis.scenarios.did import generate_did_gamma_26 from causalis.scenarios.did.refutation import plot_did_support data = generate_did_gamma_26(n_units=200, n_periods=5, seed=42) fig = plot_did_support(data)

  > > > fig.show()

causalis.scenarios.did.refutation.diagnostic_plots.plot_raw_did_event_study(data: causalis.data_contracts.PanelDataDID, *, control_group: causalis.data_contracts.panel_data_did.ComparisonGroup = 'not_yet_or_never', anticipation: int = 0, base_period: causalis.scenarios.did.refutation.diagnostics.BasePeriod = 'varying', include_pre_periods: bool = True, figsize: Tuple[float, float] = (9.0, 5.2), dpi: int = 220, font_scale: float = 1.05) → matplotlib.pyplot.Figure

  Plot an unadjusted, pre-fit DID event-study diagnostic.

  Aggregates raw cohort-time differences into a single event-study plot. This is useful for a quick visual check of parallel trends and the magnitude of the unadjusted treatment effect.

  Parameters

  data : PanelDataDID The validated panel data object. control_group : {“not_yet_or_never”, “never_treated”}, default “not_yet_or_never” The definition of the comparison group. anticipation : int, default 0 Anticipation periods to exclude. base_period : {“varying”, “universal”}, default “varying” Base period policy. include_pre_periods : bool, default True Whether to include pre-treatment periods. figsize : tuple of float, default (9.0, 5.2) The size of the figure. dpi : int, default 220 Resolution of the figure. font_scale : float, default 1.05 Scaling factor for font sizes.

  Returns

  matplotlib.figure.Figure The resulting event-study plot.

  Examples

  > > > from causalis.scenarios.did import generate_did_gamma_26 from causalis.scenarios.did.refutation import plot_raw_did_event_study data = generate_did_gamma_26(n_units=200, n_periods=8, seed=42) fig = plot_raw_did_event_study(data)

  > > > fig.show()

causalis.scenarios.did.refutation.diagnostic_plots.__all__

  [‘plot_did_support’, ‘plot_raw_did_event_study’]