AR_test: Anderson Rubin Test

View source: R/AR_test.R

AR_testR Documentation

Anderson Rubin Test

Description

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. A factor or character instrument enters as dummy variables for all its levels but the first (base) level, named <instrument>_<level>, so a factor with K levels counts as K - 1 instruments.

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

no longer used (the confidence set no longer needs a grid of regressions); kept for backward compatibility.

cores

no longer used; kept for backward compatibility.

Details

The confidence set collects every value \beta_0 that the AR test does not reject, on the whole real line. The reduced-form coefficients on the instruments are linear in \beta_0, and their robust or cluster-robust variance is quadratic in \beta_0; both are recovered exactly from three regressions and checked at a fourth. With one instrument the set solves a quadratic inequality: a bounded interval, two unbounded rays, the whole real line, or (rarely) empty. With several instruments the AR statistic is evaluated over the whole real line (writing \beta_0 = \hat\beta_{2SLS} + SE \cdot \tan\theta) and every boundary is refined by root finding; the set can then also be a union of several intervals. If the variance is not quadratic in \beta_0 (for example, a multiway cluster-robust variance repaired to be positive definite), the regression is run at each point instead.

Versions up to 1.0.6 inverted the test on a grid of \hat\beta_{2SLS} \pm 10 SEs and could miss pieces of the set outside the grid.

Value

Fstat

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

ci.print

Confidence interval via intervsion (printed version).

ci

Confidence set via inversion (numeric version): the end points in increasing order, in pairs, with -Inf/Inf for unbounded pieces; e.g. c(-Inf, a, b, Inf) is (-\infty, a] \cup [b, \infty). NA if empty.

bounded

If the confidence set is bounded and not empty.

References

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

See Also

ivDiag

Examples

data(ivDiag)
AR.out <- AR_test(data = mcclendon, Y = "intended", D = "openedesteem", 
    Z = "esteem", controls = NULL)
AR.out$ci.print

ivDiag documentation built on Nov. 12, 2026, 5:06 p.m.