causalis.scenarios.iv.dgp.generate_offer_iv_26generate_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_eligibleis the binary instrument (Z). It affects whether customers can accept an offer, but it has no direct outcome effect in the DGP.accepted_offeris the binary endogenous treatment (D).net_revenue_90dis 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 affect both treatment and outcome , but not the instrument :
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.IVCausalDataobject. If False, returns a :class:pandas.DataFrame.- deterministic_idsbool, default True
Whether to generate stable, deterministic user IDs.
Returns
The generated dataset.
Examples
Generate data as a pandas DataFrame
Canonical target
causalis.scenarios.iv.dgp.generate_offer_iv_26
Sections