ivqr_eg: An example data created by simulation.

Description Usage Format Examples

Description

A dataset illustrating the usage of the IVQR pacakge.

Usage

1

Format

A data frame with 10000 rows and 4 variables:

y

outcome variable

d

binary endogenous variable

z

binary instrumental variable

x

control variable

...

Examples

 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)
}

yuchang0321/IVQR documentation built on May 29, 2019, 12:19 p.m.