causalis.scenarios.classic_rct.dgp

Module Contents

Functions

generate_classic_rct_26

A pre-configured classic RCT dataset with 3 binary confounders. n=10000, split=0.5, outcome is conversion (binary). Baseline control p=0.10 and treatment p=0.11 are set on the log-odds scale (X=0), so marginal rates and ATE can differ once covariate effects are included. Includes a deterministic user_id column.

classic_rct_gamma_26

A pre-configured classic RCT dataset with a gamma outcome. n=10000, split=0.5, mean uplift ~10%. Includes deterministic user_id and ancillary columns.

API

causalis.scenarios.classic_rct.dgp.generate_classic_rct_26(seed: int = 42, add_pre: bool = False, beta_y: Optional[Union[List[float], numpy.ndarray]] = None, outcome_depends_on_x: bool = True, include_oracle: bool = False, return_causal_data: bool = True, *, n: int = 10000, split: float = 0.5, outcome_params: Optional[Dict] = None, add_ancillary: bool = False, deterministic_ids: bool = True, **kwargs)

A pre-configured classic RCT dataset with 3 binary confounders. n=10000, split=0.5, outcome is conversion (binary). Baseline control p=0.10 and treatment p=0.11 are set on the log-odds scale (X=0), so marginal rates and ATE can differ once covariate effects are included. Includes a deterministic user_id column.

Parameters

seed : int, default=42 Random seed. add_pre : bool, default=False Whether to generate a pre-period covariate (‘y_pre’) and include prognostic signal from X. beta_y : array-like, optional Linear coefficients for confounders in the outcome model. outcome_depends_on_x : bool, default=True Whether to add default effects for confounders if beta_y is None. include_oracle : bool, default=False Whether to include oracle ground-truth columns like ‘cate’, ‘propensity’, etc. return_causal_data : bool, default=True Whether to return a CausalData object. n : int, default=10000 Number of samples. split : float, default=0.5 Proportion of samples assigned to the treatment group. outcome_params : dict, optional Binary outcome parameters, e.g. {“p”: {“A”: 0.10, “B”: 0.11}}. add_ancillary : bool, default=False Whether to add standard ancillary columns (age, platform, etc.). deterministic_ids : bool, default=True Whether to generate deterministic user IDs. **kwargs : Additional arguments passed to generate_classic_rct.

Returns

CausalData or pd.DataFrame

causalis.scenarios.classic_rct.dgp.classic_rct_gamma_26(seed: int = 42, add_pre: bool = False, beta_y: Optional[Union[List[float], numpy.ndarray]] = None, outcome_depends_on_x: bool = True, include_oracle: bool = False, return_causal_data: bool = True, *, n: int = 10000, split: float = 0.5, outcome_params: Optional[Dict] = None, add_ancillary: bool = True, deterministic_ids: bool = True, **kwargs)

A pre-configured classic RCT dataset with a gamma outcome. n=10000, split=0.5, mean uplift ~10%. Includes deterministic user_id and ancillary columns.

Parameters

seed : int, default=42 Random seed. add_pre : bool, default=False Whether to generate a pre-period covariate (‘y_pre’). beta_y : array-like, optional Linear coefficients for confounders in the outcome model. outcome_depends_on_x : bool, default=True Whether to add default effects for confounders if beta_y is None. include_oracle : bool, default=False Whether to include oracle ground-truth columns like ‘cate’, ‘propensity’, etc. return_causal_data : bool, default=True Whether to return a CausalData object. n : int, default=10000 Number of samples. split : float, default=0.5 Proportion of samples assigned to the treatment group. outcome_params : dict, optional Gamma outcome parameters, e.g. {“shape”: 2.0, “scale”: {“A”: 15.0, “B”: 16.5}}. add_ancillary : bool, default=True Whether to add standard ancillary columns (age, platform, etc.). deterministic_ids : bool, default=True Whether to generate deterministic user IDs. **kwargs : Additional arguments passed to classic_rct_gamma.

Returns

CausalData or pd.DataFrame