Generate Data for Simulation Studies

generate_data(
  n_obs = 200,
  ps_type = c("la", "nla", "nlna", "omit", "complex", "rct"),
  p_c = 0.7,
  alpha = 1,
  beta_1 = 0.5,
  beta_2 = -0.7,
  beta_3 = 0,
  error_dist = c("gumbel", "normal")
)

Arguments

n_obs

numeric Number of observations.

ps_type

character Type of IV propensity score DGP.

p_c

numeric Compliance rate.

alpha

numeric Coefficient associated with the treatment difference.

beta_1

numeric Coefficients associated with x1.

beta_2

numeric Coefficients associated with x2.

beta_3

numeric Coefficients associated with x1 * x2.

error_dist

"gumbel" or "normal".

Value

A data frame

Examples

set.seed(42)
generate_data(n_obs = 6, ps_type = "la")
#>          x1        x2        eta         p z c a          ey          y
#> 1 0.9148060 0.7365883  0.6198471 0.6501838 0 1 0 -0.05820880 -0.9330284
#> 2 0.9370754 0.1346666  2.4701510 0.9220226 1 1 1  1.37427109  4.9348077
#> 3 0.2861395 0.6569923 -0.3986978 0.4016252 0 0 1  1.77822261  1.5519152
#> 4 0.8304476 0.7050648  0.5457009 0.6331376 0 1 0 -0.07832154  1.0934560
#> 5 0.6417455 0.4577418  0.9102657 0.7130545 0 0 1  2.00031746  2.7443554
#> 6 0.5190959 0.7191123 -0.1191449 0.4702490 0 0 1  1.82931858  2.3039565