Skip to contents

Performs the Anderson Rubin test, which is robust to weak instruments.

Usage

AR_test(data, Y, D, Z, controls, FE = NULL, cl = NULL, weights = NULL, 
  prec = 4, CI = TRUE, alpha = 0.05, parallel = NULL, cores = NULL)

Arguments

data

name of a dataframe.

Y

a string indicating the outcome variable.

D

a string indicating the treatment variable.

Z

a vector of strings indicating the instrumental variables.

controls

a vector of strings indicating the control variables.

FE

a vector of strings indicating the fixed effects variables.

cl

a string indicating the clustering variable.

weights

a string indicating the variable that stores weights.

CI

a logical flag controlling whether to calcualte the confidence interval using the inversion method.

prec

precision of results (4 by default).

alpha

level of statitical significance; the default is 0.05.

parallel

a logical flag controlling parallel computing.

cores

setting the number of cores.

Value

Fstat

F statistic, degrees of freedoms, and p-value.

ci.print

Confidence interval via intervsion (printed version).

ci

Confidence interval via intervsion (numeric version).

bounded

If the confidence interval is bounded.

See also

References

Chernozhukov, Victor, and Christian Hansen. 2008. "The Reduced Form: A Simple Approach to Inference with Weak Instruments." Economics Letters 100 (1): 68–71.

Examples

data(ivDiag)
AR.out <- AR_test(data = rueda, Y = "e_vote_buying", D = "lm_pob_mesa", 
    Z = "lz_pob_mesa_f", controls = c("lpopulation", "lpotencial"),
    cl = "muni_code", CI = FALSE)
library(testthat)    
test_that("Check AR results", {
  expect_equal(as.numeric(AR.out$Fstat[1]), 50.5097)
})
#> Test passed 🌈