Processing math: 100%

Generate a synthetic data set with qualitative outcomes under an instrumental variables design. The data include a binary treatment indicator and a binary instrument. Potential outcomes and potential treatments are independent of the instrument. Moreover, the instrument does not directly impact potential outcomes, has an impact on treatment probability, and can only increase the probability of treatment.

generate_qualitative_data_iv(n, outcome_type)

Arguments

n

Sample size.

outcome_type

String controlling the outcome type. Must be either "multinomial" or "ordered". Affects how potential outcomes are generated.

Value

A list storing a data frame with the observed data, the true propensity score, the true instrument propensity score, and the true local probabilities of shift.

Details

Outcome type

Potential outcomes are generated differently according to outcome_type. If outcome_type == "multinomial", generate_qualitative_data_iv computes linear predictors for each class using the covariates:

ηmi(d)=βdm1Xi1+βdm2Xi2+βdm3Xi3,d=0,1,

and then transforms ηmi(d) into valid probability distributions using the softmax function:

P(Yi(d)=m|Xi)=exp(ηmi(d))mexp(ηmi(d)),d=0,1.

It then generates potential outcomes Yi(1) and Yi(0) by sampling from {1, 2, 3} using Pi(Y(d)=m|X),d=0,1.

If instead outcome_type == "ordered", generate_qualitative_data_iv first generates latent potential outcomes:

Yi(d)=τd+Xi1+Xi2+Xi3+N(0,1),d=0,1,

with τ=2. It then constructs Yi(d) by discretizing Yi(d) using threshold parameters ζ1=2 and ζ2=4. Then,

P(Yi(d)=m|Xi)=P(ζm1<Yi(d)ζm|Xi)=Φ(ζmjXijτd)Φ(ζm1jXijτd),d=0,1,

which allows us to analytically compute the local probabilities of shift.

Treatment assignment and instrument

The instrument is always generated as ZiBernoulli(0.5). Treatment is always modeled as DiBernoulli(π(Xi,Zi)), with π(Xi,Zi)=P(Di=1|Xi,Zi))=(Xi1+Xi3+Zi)/3. Thus, Zi can increase the probability of treatment intake but cannot decrease it.

Other details

The function always generates three independent covariates from U(0,1). Observed outcomes Yi are always constructed using the usual observational rule.

The DGPs outlined above ensure that Zi is a valid instrument for D_i.

Author

Riccardo Di Francesco

Examples

## Generate synthetic data.
set.seed(1986)

data <- generate_qualitative_data_iv(100,
                                     outcome_type = "ordered")

data$local_pshifts
#> [1] -0.576468964 -0.003873771  0.580342735