Simulate a binary-instrument, binary-treatment design with non-compliance.
Parameters
Name
Type
Description
Default
n
int
Number of units.
10000
effect_scale
float
Scale of the heterogeneous treatment effect effect_scale * u. The effect increases with the quantile.
2.0
covariate_effect
float
Coefficient of the covariate in the outcome.
1.0
offer_probability
float
Baseline propensity of being assigned the instrument (p_0 in the logit model); it is the instrument probability when instrument_propensity_slope is zero.
0.67
instrument_propensity_slope
float
Coefficient of x in the logit model for P(Z = 1 \| x). 0 makes the instrument independent of the covariate.
0.0
base_takeup_threshold
float
Take-up threshold at x = 0; with takeup_threshold_slope = 0, P(D(1) = 1 \| u) = min(1, u / base_takeup_threshold).
0.75
takeup_threshold_slope
float
Coefficient of x in the take-up threshold T(x) = base_takeup_threshold * exp(takeup_threshold_slope * x). 0 makes compliance independent of the covariate.
0.0
seed
int
Seed for numpy.random.default_rng.
None
Returns
Name
Type
Description
polars.DataFrame
Columns x, instrument, treatment, y, y_0, y_1 and complier.