Skip to contents

Simulate an experimental dataset with selection bias

Usage

selDGP(
  n = 10000,
  p = 10,
  treatProb = 0.5,
  xb = c(-1, 1),
  piF = function(x) 1/2,
  tauF = function(x) 1/exp(-x[3]),
  y0F = function(x) 3 * pmax(x[1] + x[2], 0) + 5 * sin(x[5]) * 2 * pmax(x[7], 0.5),
  selF = function(x) x[1] - 5 * x[3] + pmax(x[4], 0)
)

Arguments

n

sample size (default 10000)

p

number of covariates (default 10)

xb

bounds of uniform random variables for X (default -1, 1)

piF

propensity score function (fixed number indicates simple randomization - default 1/2)

tauF

treatment heterogeneity function (nonlinear by default)

y0F

baseline outcome function (nonlinear by default)

selF

selection bias function (nonlinear by default). When null, no missingness is introduced.

Value

list with outcome (with missing values corresponding with s = 0), treatment, covariates, selection, and true treatment effect