Description Usage Format Examples
A dataset illustrating 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 | # The data generation process
sim_ivqr_eg <- function(n = 10 ^ 4){
u <- runif(n)
x <- rbinom(n, 1,0.2)
z <- rbinom(n, 1, 0.37)
v <- rnorm(n)
d <- z * (u > 0.5 * v)
y0 <- 0 + x * 2 + qnorm(u,0,1)
y1 <- (u - 0.5) + x * 2 + qnorm(u,0,1)
y <- d * y1 + (1 - d) * y0
value <- list()
value$y <- y
value$d <- d
value$z <- z
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.