# `causalis.dgp.panel_data_scm.functional`

## Notes

Use `generate_scm_data` for Gaussian outcomes and the Gamma/Poisson wrappers when you want strictly positive or count-like panels. All public wrappers can return either a raw `DataFrame` or a :class:`PanelDataSCM` container.

## Examples

> > > from causalis.dgp.panel_data_scm.functional import generate_scm_data panel = generate_scm_data( … n_donors=5, … n_pre_periods=24, … n_post_periods=6, … return_panel_data=True, … ) panel.unit_col, panel.time_col (‘unit_id’, ‘calendar_time’)

Panel-data DGP wrappers for synthetic control and SCM-style benchmarks.

This module exposes high-level functions that build donor-pool panel datasets with one treated unit, a pre/post intervention split, and optional oracle counterfactual paths.

## Module Contents

### Functions

`generate_scm_data` | Medium-level wrapper for Gaussian SCM panel generation.
`generate_scm_gamma_data` | Medium-level wrapper for realistic Gamma SCM panel generation.
`generate_scm_poisson_data` | Medium-level wrapper for realistic Poisson SCM panel generation.
`generate_scm_gamma_26_data` |
`generate_scm_poisson_26_data` |

### Data

`PanelOutput` |

### API

causalis.dgp.panel_data_scm.functional.PanelOutput

  None

causalis.dgp.panel_data_scm.functional.generate_scm_data(n_donors: int = 5, n_pre_periods: int = 20, n_post_periods: int = 10, treatment_effect: float = 2.0, treatment_effect_slope: float = 0.0, donor_noise_std: float = 0.2, treated_noise_std: float = 0.1, common_factor_std: float = 0.15, time_start: int = 1, treated_unit: Hashable = 'treated', donor_prefix: str = 'donor_', random_state: Optional[int] = 42, return_panel_data: bool = True, dirichlet_alpha: float = 1.0, rho_common: float = 0.0, rho_donor: float = 0.0, n_latent_factors: int = 0, latent_factor_std: float = 0.2, latent_loading_std: float = 0.35, rho_latent: float = 0.0, prefit_mismatch_std: float = 0.0, rho_prefit_mismatch: float = 0.0, treatment_effect_mode: Literal[additive, multiplicative] = 'additive') → causalis.dgp.panel_data_scm.functional.PanelOutput

  Medium-level wrapper for Gaussian SCM panel generation.

  Notes

  The Gaussian treated counterfactual path is exact SCM only when both `treated_noise_std=0.0` and `prefit_mismatch_std=0.0`. With either term non-zero, the generator intentionally produces an approximate-SCM fit path.

  Examples

  > > > from causalis.dgp.panel_data_scm.functional import generate_scm_data panel = generate_scm_data( … n_donors=4, … n_pre_periods=18, … n_post_periods=6, … treatment_effect=3.0, … return_panel_data=True, … ) panel.treated_unit ‘treated’ {“y”, “y_cf”}.issubset(panel.df.columns) True

causalis.dgp.panel_data_scm.functional.generate_scm_gamma_data(n: int = 432, seed: int = 42, return_panel_data: bool = True, n_donors: int = 8, treatment_effect_rate: float = 0.12, treatment_effect_slope: float = 0.01, n_pre_periods: Optional[int] = None, n_post_periods: Optional[int] = None, **advanced_params) → causalis.dgp.panel_data_scm.functional.PanelOutput

  Medium-level wrapper for realistic Gamma SCM panel generation.

  Preferred usage is explicit `n_pre_periods` and `n_post_periods`. If both are omitted, they are inferred from `n`. The post-treatment effect path uses a ramp-in: at the first post period, the effective relative lift is `treatment_effect_rate * (1 - exp(-1 / 2.5))` (about 0.33x of the parameter when slope is zero).

  Examples

  > > > from causalis.dgp.panel_data_scm.functional import generate_scm_gamma_data panel = generate_scm_gamma_data( … n_donors=6, … n_pre_periods=24, … n_post_periods=6, … treatment_effect_rate=0.12, … return_panel_data=True, … ) “tau_mean_true” in panel.df.columns True

causalis.dgp.panel_data_scm.functional.generate_scm_poisson_data(n: int = 432, seed: int = 42, return_panel_data: bool = True, n_donors: int = 8, treatment_effect_rate: float = 0.1, treatment_effect_slope: float = 0.005, n_pre_periods: Optional[int] = None, n_post_periods: Optional[int] = None, **advanced_params) → causalis.dgp.panel_data_scm.functional.PanelOutput

  Medium-level wrapper for realistic Poisson SCM panel generation.

  Preferred usage is explicit `n_pre_periods` and `n_post_periods`. If both are omitted, they are inferred from `n`. The post-treatment effect path uses a ramp-in: at the first post period, the effective relative lift is `treatment_effect_rate * (1 - exp(-1 / 2.5))` (about 0.33x of the parameter when slope is zero).

  Examples

  > > > from causalis.dgp.panel_data_scm.functional import generate_scm_poisson_data panel = generate_scm_poisson_data( … n_donors=6, … n_pre_periods=24, … n_post_periods=6, … treatment_effect_rate=0.10, … return_panel_data=True, … ) panel.df[“y”].ge(0).all() True

causalis.dgp.panel_data_scm.functional.generate_scm_gamma_26_data(*, seed: int, return_panel_data: bool, include_oracles: bool, n_donors: int, n_pre_periods: Optional[int], n_post_periods: Optional[int], treatment_effect_rate: float, treatment_effect_slope: float, advanced_params: dict[str, Any]) → causalis.dgp.panel_data_scm.functional.PanelOutput

causalis.dgp.panel_data_scm.functional.generate_scm_poisson_26_data(*, seed: int, return_panel_data: bool, include_oracles: bool, n_donors: int, n_pre_periods: Optional[int], n_post_periods: Optional[int], treatment_effect_rate: float, treatment_effect_slope: float, advanced_params: dict[str, Any]) → causalis.dgp.panel_data_scm.functional.PanelOutput