generate_data_IV: Generate Simulated IV data

Description Usage Arguments Value

View source: R/generate_data.R

Description

Data set contains measured covariates X, outcome Y, treatment assignment t, and logit(propensity), mu.

covariate data ~ normal(0,1); mu = true_mu; t ~ binom(p = 1 / (1 + exp(-mu))); y ~ rho * X1 + sqrt(1-rho^2) * X2 + tau * t + epsilon epsilon ~ normal(0, 1); Z instrument correllated with X1 by rho_z

Usage

1
2
3
4
5
6
7
8
9
generate_data_IV(
  N = 2000,
  p = 10,
  true_mu = "X1/2 + Z/2 - 3.25",
  rho = 0,
  rho_z = 0.2,
  sigma = 1,
  tau = 1
)

Arguments

N

numeric, sample size

p

numeric, number of features

true_mu

string formula giving true propensity score linear model

rho

numeric between 0 and 1. 0 => prog orthogonal to prop, 1=> prog || prop

rho_z

numeric between 0 and 1. correllation between Z and X1

sigma

numeric noise to be added to y. y += sigma*rnorm(0,1)

tau

numeric additive treatment effect

Value

data.frame of covariates, y, t, and true prop (logit scale) and prog


raikens1/RACplots documentation built on July 10, 2021, 11:08 a.m.