causalis.scenarios.classic_rct.dgp.generate_classic_rct_26generate_classic_rct_26
A pre-configured classic RCT dataset with a binary (conversion) outcome.
The dataset includes three binary confounders: platform_ios,
country_usa, and source_paid. Treatment assignment is completely
random and independent of these confounders.
Notes
The outcome $Y$ (conversion) is generated using a logistic link function:
where:
$D$ is the binary treatment indicator ($D=1$ for treatment, $D=0$ for control).
$X$ are the confounders (platform, country, source).
$\alpha_y$ is the baseline log-odds of conversion.
$\theta$ is the treatment effect on the log-odds scale.
$\beta_y$ are the coefficients for the confounders.
The default parameters set the baseline control rate to ~10% and the treatment rate to ~11% (marginal rates may vary due to $X$).
Examples
Parameters
- seedint, default 42
Random seed for reproducibility.
- add_prebool, default False
Whether to generate a pre-period covariate (‘y_pre’) and include prognostic signal from X.
- beta_yarray-like, optional
Linear coefficients for confounders in the outcome model. Default is [0.6, 0.4, 0.8].
- outcome_depends_on_xbool, default True
Whether to add default effects for confounders if beta_y is None.
- include_oraclebool, default False
Whether to include oracle ground-truth columns like ‘cate’, ‘propensity’, etc.
- return_causal_databool, default True
Whether to return a
CausalDataobject or apd.DataFrame.- nint, default 10000
Number of samples to generate.
- splitfloat, default 0.5
Proportion of samples assigned to the treatment group.
- outcome_paramsdict, optional
Binary outcome parameters, e.g. {“p”: {“A”: 0.10, “B”: 0.11}}.
- add_ancillarybool, default False
Whether to add standard ancillary columns (age, platform, etc.).
- deterministic_idsbool, default True
Whether to generate deterministic user IDs.
- **kwargsAny
Additional arguments passed to the underlying
generate_classic_rct.
Returns
The generated dataset.
Canonical target
causalis.scenarios.classic_rct.dgp.generate_classic_rct_26
Sections