# `causalis.dgp.panel_data_did.functional`

## Examples

> > > from causalis.dgp.panel_data_did.functional import generate_did_data panel = generate_did_data( … n_treated_units=4, … n_control_units=8, … n_pre_periods=12, … n_post_periods=4, … return_panel_data=True, … ) panel.design_type ‘simultaneous_adoption’ {“y_cf”, “tau_mean_true”}.issubset(panel.df.columns) True

Panel-data DGP wrappers for canonical/simultaneous-adoption DID benchmarks.

This module exposes high-level helpers that build realistic long-format panel datasets with multiple treated units, never-treated controls, a common adoption date, covariates, cluster labels, and optional oracle counterfactual/effect columns.

## Module Contents

### Functions

`generate_did_data` | Generate a realistic Gaussian DID panel with a common adoption date.
`generate_did_gamma_data` | Generate a realistic Gamma DID panel for positive continuous outcomes.
`generate_did_poisson_data` | Generate a realistic Poisson DID panel for count outcomes.
`generate_did_gamma` | Scenario-style Gamma DID wrapper with Causalis 26 naming.
`generate_did_poisson_26_data` | Scenario-style Poisson DID wrapper with Causalis 26 naming.

### Data

`PanelOutput` |
`generate_did_gamma_26_data` |

### API

causalis.dgp.panel_data_did.functional.PanelOutput

  None

causalis.dgp.panel_data_did.functional.generate_did_data(n_treated_units: int = 20, n_control_units: int = 60, n_pre_periods: int = 24, n_post_periods: int = 12, treatment_effect_rate: float = 0.08, treatment_effect_slope: float = 0.0, time_start: int = 1, calendar_start: str = '2021-01', time_freq: str = 'M', treated_prefix: str = 'treated_market_', control_prefix: str = 'control_market_', random_state: Optional[int] = 42, return_panel_data: bool = True, include_oracle: bool = True, **advanced_params: Any) → causalis.dgp.panel_data_did.functional.PanelOutput

  Generate a realistic Gaussian DID panel with a common adoption date.

  The outcome is a continuous marketplace-style metric generated from unit size, demand seasonality, macro shocks, competition, average order value, serially correlated unit noise, and a post-adoption relative lift for all treated units. Oracle columns expose the untreated counterfactual and true effect on each treated post-treatment row.

causalis.dgp.panel_data_did.functional.generate_did_gamma_data(n: int = 960, seed: int = 42, return_panel_data: bool = True, include_oracle: bool = True, n_treated_units: int = 20, n_control_units: int = 60, treatment_effect_rate: float = 0.08, treatment_effect_slope: float = 0.0, n_pre_periods: Optional[int] = None, n_post_periods: Optional[int] = None, **advanced_params: Any) → causalis.dgp.panel_data_did.functional.PanelOutput

  Generate a realistic Gamma DID panel for positive continuous outcomes.

  Preferred usage is explicit `n_pre_periods` and `n_post_periods`. If both are omitted, they are inferred from `n`.

causalis.dgp.panel_data_did.functional.generate_did_poisson_data(n: int = 960, seed: int = 42, return_panel_data: bool = True, include_oracle: bool = True, n_treated_units: int = 20, n_control_units: int = 60, treatment_effect_rate: float = 0.08, treatment_effect_slope: float = 0.0, n_pre_periods: Optional[int] = None, n_post_periods: Optional[int] = None, **advanced_params: Any) → causalis.dgp.panel_data_did.functional.PanelOutput

  Generate a realistic Poisson DID panel for count outcomes.

  Preferred usage is explicit `n_pre_periods` and `n_post_periods`. If both are omitted, they are inferred from `n`.

causalis.dgp.panel_data_did.functional.generate_did_gamma(*, seed: int = 42, return_panel_data: bool = True, include_oracles: bool = True, n_treated_units: int = 20, n_control_units: int = 60, n_pre_periods: Optional[int] = None, n_post_periods: Optional[int] = None, treatment_effect_rate: float = 0.08, treatment_effect_slope: float = 0.0, advanced_params: Optional[dict[str, Any]] = None) → causalis.dgp.panel_data_did.functional.PanelOutput

  Scenario-style Gamma DID wrapper with Causalis 26 naming.

causalis.dgp.panel_data_did.functional.generate_did_gamma_26_data

  None

causalis.dgp.panel_data_did.functional.generate_did_poisson_26_data(*, seed: int = 42, return_panel_data: bool = True, include_oracles: bool = True, n_treated_units: int = 20, n_control_units: int = 60, n_pre_periods: Optional[int] = None, n_post_periods: Optional[int] = None, treatment_effect_rate: float = 0.08, treatment_effect_slope: float = 0.0, advanced_params: Optional[dict[str, Any]] = None) → causalis.dgp.panel_data_did.functional.PanelOutput

  Scenario-style Poisson DID wrapper with Causalis 26 naming.