causalis.dgp.causaldata_instrumental.functional.generate_iv_datagenerate_iv_data
Generate a synthetic instrumental-variable dataset.
Parameters
- nint, default=1000
Number of samples.
- outcome_type{“continuous”, “binary”, “poisson”, “gamma”}, default=”continuous”
Outcome family.
- thetafloat, default=1.0
Constant treatment effect on the structural outcome scale.
- first_stagefloat, default=1.25
Additive log-odds effect of the instrument on treatment.
- target_z_ratefloat, optional
Target marginal instrument rate.
- target_d_ratefloat, optional
Target marginal treatment rate after instrument assignment.
- u_strength_d, u_strength_yfloat, default=0.8
Latent confounding strengths in treatment and outcome.
- return_causal_databool, default=False
If True, return a validated :class:
IVCausalDataobject.- instrument_namestr, default=”z”
Instrument column name.
Returns
Synthetic IV dataset or validated IV data contract.
Examples
Canonical target
causalis.dgp.causaldata_instrumental.functional.generate_iv_data
Sections