Skip to content
Submodule
causalis.scenarios.iv.dgp

dgp

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

Functions

Jump directly into the documented functions for this page.

1 items

Data

Jump directly into the documented data for this page.

1 items
function
causalis.scenarios.iv.dgp.generate_offer_iv_26

generate_offer_iv_26

Generate a realistic IV dataset with a positive business effect.

This scenario mimics an offer-eligibility experiment in a customer product:

  • offer_eligible is the binary instrument (Z). It affects whether customers can accept an offer, but it has no direct outcome effect in the DGP.

  • accepted_offer is the binary endogenous treatment (D).

  • net_revenue_90d is a continuous outcome (Y) with a positive heterogeneous treatment effect among customers induced into treatment by eligibility.

The DGP follows a structural model where unobserved confounders UU affect both treatment DD and outcome YY, but not the instrument ZZ:

Z &= f_Z(X, \epsilon_Z) \ D &= f_D(Z, X, U, \epsilon_D) \ Y &= f_Y(D, X, U, \epsilon_Y)

Parameters

nint, default 20_000

Number of observations to generate.

seedint, default 42

Random seed for reproducibility.

include_oraclebool, default True

Whether to include latent variables (ITE, LATE, etc.) in the output DataFrame.

return_causal_databool, default True

If True, returns an :class:~causalis.data_contracts.iv_causal_data.IVCausalData object. If False, returns a :class:pandas.DataFrame.

deterministic_idsbool, default True

Whether to generate stable, deterministic user IDs.

Returns

Union[pd.DataFrame, IVCausalData]

The generated dataset.

Examples

Generate data as a pandas DataFrame

Canonical target

causalis.scenarios.iv.dgp.generate_offer_iv_26

Sections

ParametersReturnsExamples
Link to this symbol
data
causalis.scenarios.iv.dgp.__all__

__all__

Value: ['generate_offer_iv_26']

[‘generate_offer_iv_26’]

Canonical target

causalis.scenarios.iv.dgp.__all__

Link to this symbol