Description Usage Format Examples
A dataset with 2 endogenous variables to illustrate the usage of the IVQR pacakge.
1 |
A data frame with 10000 rows and 4 variables:
outcome variable
binary endogenous variable
binary instrumental variable
control variable
...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # The data generation process
sim_ivqr_eg2 <- function(n = 10 ^ 4){
u <- runif(n)
x <- rbinom(n, 1,0.2)
z1 <- rbinom(n, 1, 0.37)
v1 <- rnorm(n)
d1 <- z1 * (u > 0.5 * v1)
z2 <- rbinom(n, 1, 0.37)
v2 <- rnorm(n)
d2 <- z2 * (u > 0.5 * v1)
y00 <- 0 + x * 2 + qnorm(u,0,1)
y10 <- u + x * 2 + qnorm(u,0,1)
y01 <- 2 + x * 2 + qnorm(u,0,1)
y11 <- 2 + u + x * 2 + qnorm(u,0,1)
y <- d1 * d2 * y11 + (1 - d1) * d2 * y01 + d1 * (1 - d2) * y10 + (1 - d1) * (1 - d2) * y00
value <- list()
value$y <- y
value$d1 <- d1
value$d2 <- d2
value$z1 <- z1
value$z2 <- z2
value$x <- x
value <- data.frame(value)
return(value)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.