causalis.dgp.causaldata_instrumental.base.InstrumentalGeneratorInstrumentalGenerator
Bases: causalis.dgp.causaldata.base.CausalDatasetGenerator
Generate synthetic datasets for binary instrumental-variable estimation.
The generated structural system is:
Xis sampled with the same confounder machinery as :class:~causalis.dgp.causaldata.base.CausalDatasetGenerator.Zis a binary instrument generated fromP(Z=1|X).Dis a binary endogenous treatment generated fromP(D=1|Z,X,U).Ydepends onD,X, and optionally the latentU, but has no direct dependence onZ.
Parameters inherited from CausalDatasetGenerator keep their usual
meaning for the outcome equation and the non-instrument part of the
treatment equation. In particular, beta_d, g_d, alpha_d,
target_d_rate, and u_strength_d affect treatment assignment.
Parameters
- instrument_namestr, default=”z”
Column name for the binary instrument.
- first_stagefloat, default=1.25
Additive log-odds effect of
Zon treatment assignment. Positive values make the instrument encourage treatment.- beta_zarray-like, optional
Linear coefficients of confounders in the instrument propensity.
- g_zcallable, optional
Nonlinear instrument score
g_z(X) -> shape (n,).- alpha_zfloat, default=0.0
Instrument propensity intercept. If
target_z_rateis set, this is calibrated on each generated sample.- target_z_ratefloat, optional
Target marginal instrument rate. Defaults to
0.5.- instrument_sharpnessfloat, default=1.0
Multiplier on the X-driven instrument score.
- include_oraclebool, default=True
Whether to include oracle columns for IV nuisance functions and treatment potential-outcome means.
Notes
With include_oracle=True, returned oracle columns include:
m: instrument propensityP(Z=1|X).r_z0andr_z1: first-stage nuisancesP(D=1|Z=0,X)andP(D=1|Z=1,X).g_z0andg_z1: reduced-form nuisancesE[Y|Z=0,X]andE[Y|Z=1,X).iv_first_stageandiv_reduced_form: conditional differences in the first stage and reduced form.late_xandlate: conditional and sample-average Wald ratios.g_d0,g_d1, andcate: treatment potential-outcome means and their natural-scale contrast.
Canonical target
causalis.dgp.causaldata_instrumental.base.InstrumentalGenerator
Sections