Skip to content
Submodule
causalis.scenarios.classic_rct.dgp

dgp

Submodule causalis.scenarios.classic_rct.dgp with no child pages and 2 documented members.

Functions

Jump directly into the documented functions for this page.

2 items
function
causalis.scenarios.classic_rct.dgp.generate_classic_rct_26

generate_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:

P(Y=1D,X)=logit1(αy+θD+βyX)P(Y=1 | D, X) = \text{logit}^{-1}(\alpha_y + \theta D + \beta_y X)

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 CausalData object or a pd.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

CausalData or pd.DataFrame

The generated dataset.

Canonical target

causalis.scenarios.classic_rct.dgp.generate_classic_rct_26

Sections

NotesParametersReturnsExamples
Link to this symbol
function
causalis.scenarios.classic_rct.dgp.classic_rct_gamma_26

classic_rct_gamma_26

A pre-configured classic RCT dataset with a Gamma-distributed outcome.

The dataset is designed to represent skewed metrics like revenue or spend. It includes three binary confounders: platform_ios, country_usa, and source_paid.

Notes

The outcome $Y$ is generated from a Gamma distribution using a log link for the mean:

YGamma(κ,μ(D,X)/κ)Y \sim \text{Gamma}(\kappa, \mu(D, X) / \kappa)

where:

log(μ(D,X))=αy+θD+βyX\log(\mu(D, X)) = \alpha_y + \theta D + \beta_y X

and $\kappa$ is the shape parameter. This implies multiplicative treatment effects on the mean scale.

Examples

Parameters

seedint, default 42

Random seed for reproducibility.

add_prebool, default False

Whether to generate a pre-period covariate (‘y_pre’).

beta_yarray-like, optional

Linear coefficients for confounders in the outcome model. Default is [0.25, 0.20, 0.45].

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 CausalData object or a pd.DataFrame.

nint, default 10000

Number of samples to generate.

splitfloat, default 0.5

Proportion of samples assigned to the treatment group.

outcome_paramsdict, optional

Gamma outcome parameters, e.g. {“shape”: 2.0, “scale”: {“A”: 15.0, “B”: 16.5}}.

add_ancillarybool, default True

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 classic_rct_gamma.

Returns

CausalData or pd.DataFrame

The generated dataset.

Canonical target

causalis.scenarios.classic_rct.dgp.classic_rct_gamma_26

Sections

NotesParametersReturnsExamples
Link to this symbol