## one way to do it is by adding correlation to x.obs and y that isn't in w.
## in other words, the model is missing an important feature of x.obs that's related to y.
-simulate_data <- function(N, m, B0, Bxy, Bzy, seed, prediction_accuracy=0.73, x_bias=-0.75){
+simulate_data <- function(N, m, B0, Bxy, Bzy, Py, seed, prediction_accuracy=0.73, x_bias=-0.75){
set.seed(seed)
# make w and y dependent
z <- rbinom(N, 1, 0.5)
x <- rbinom(N, 1, 0.5)
- ystar <- Bzy * z + Bxy * x + B0
+ ystar <- Bzy * z + Bxy * x + B0 + qlogix(Py)
y <- rbinom(N,1,plogis(ystar))
# glm(y ~ x + z, family="binomial")
parser <- add_argument(parser, "--x_bias", help='how is the classifier biased?', default=0.75)
parser <- add_argument(parser, "--Bxy", help='coefficient of x on y', default=0.3)
parser <- add_argument(parser, "--Bzy", help='coeffficient of z on y', default=-0.3)
+parser <- add_argument(parser, "--Py", help='Base rate of y', default=0.5)
parser <- add_argument(parser, "--outcome_formula", help='formula for the outcome variable', default="y~x+z")
parser <- add_argument(parser, "--proxy_formula", help='formula for the proxy variable', default="w_pred~y*x")