ivqr: Instrumental Variable Qauntile Regression

Description Usage Arguments Value Examples

Description

Instrumental Variable Qauntile Regression

Usage

1
2
ivqr(formula, taus = 0.5, data, grid, gridMethod = "Default",
  ivqrMethod = "iqr", qrMethod = "br")

Arguments

taus

The quantile(s) to be estimated, which should be a vector that contains number strictly between 0 and 1.

data

A data.frame in which to interpret the variables named in the formula.

grid

A vector (resp. list) when number of endogenous variable is one (resp. two). The grid should be reasonably large and fine so that the objective function is properly minimized. When there are two endogenous variables, the list should contain two vectors, each specifies a grid for one of the variables. Users are encouraged to try different grids and use the function diagnose() to visually inspect the objective functions.

gridMethod

The type of grid search. In the current version, only the method "Default" is available, which is simply an exhaustive searching.

ivqrMethod

The algorithm to compute the fit. In the current version, only the "iqr" (instrumental quantile regression) algorithm is available.

qrMethod

The algorithmic method used in the (conventional) quantile regression, which is part of the instrumental quantile regression algorithm. For more information, see the help file of function rq() from the package quantreg.

fomula

A Formula (not the built-in formula) object. A correct model specificaion should look like y ~ d | z | x, where y is the outcome variable, d is the endogenous variable, z is the instrument, and x is the control variable'. If no control is needed, write y ~ d | z | 1. Constant has to be included, and number of endogenous variable should be no more than two.

Value

An ivqr object. Use functions such as summary() or plot() to see the coefficient estimates and standard errors. Weak-IV robust inference and general inferences are implemented respectively by the fucntions weakIVtest() and ivqr.ks(). An object of class "ivqr" is a list containing at least the following components:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(ivqr_eg)
fit <- ivqr(y ~ d | z | x, 0.5, grid = seq(-2,2,0.2), data = ivqr_eg) # median
fit <- ivqr(y ~ d | z | x, 0.25, grid = seq(-2,2,0.2), data = ivqr_eg) # the first quartile
fit <- ivqr(y ~ d | z | x, seq(0.1,0.9,0.1), grid = seq(-2,2,0.2), data = ivqr_eg) # a process
plot(fit) # plot the coefficients of the endogenous variable along with 95% CI

data(ivqr_eg2) # An example with two endogenous variables
grid2 <- list(seq(-1,1,0.05),seq(1.5,2.5,0.05)) # Two grids
fit <- ivqr(y ~ d1 + d2 | z1 + z2 | x, seq(0.1,0.9,0.1), grid = grid2, data = ivqr_eg2) # median
plot(fit,1) # plot the coefficients of the first endogenous variable along with 95% CI
plot(fit,2) # plot the coefficients of the second endogenous variable along with 95% CI
summary(fit) # print the results

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