Skip to contents

Anderson-Rubin (AR) weak-IV-robust test

Usage

morie_iv_anderson_rubin(
  data,
  outcome,
  endogenous,
  instruments,
  exogenous = NULL,
  beta0 = NULL,
  alpha = 0.05
)

Arguments

data

A data.frame (or tibble) holding the outcome, endogenous regressors, instruments, and any exogenous controls.

outcome

Character; column name of the response variable.

endogenous

Character vector; column names of the endogenous regressors.

instruments

Character vector; column names of the instrumental variables.

exogenous

Optional character vector of additional exogenous regressors included in both the structural equation and the first stage. NULL (default) for a just-identified design.

beta0

Numeric scalar or vector; the structural-coefficient value(s) to test under H0. Length must match length(endogenous).

alpha

Significance level (default 0.05); controls the confidence-set / acceptance-region cut-off.

Value

A named list with elements statistic, F_statistic, p_value, name, df, df_resid, beta0.

Examples

set.seed(1); n <- 400
z1 <- rbinom(n, 1, 0.5); z2 <- rnorm(n); u <- rnorm(n)
d <- 0.5 * z1 + 0.4 * z2 + 0.3 * u + rnorm(n, sd = 0.3)
y <- 0.5 * d + 0.4 * u + rnorm(n, sd = 0.5)
df <- data.frame(y, d, z1, z2)
morie_iv_anderson_rubin(df, "y", "d", c("z1", "z2"))
#> $statistic
#> [1] 37.10968
#> 
#> $F_statistic
#> [1] 18.55484
#> 
#> $p_value
#> [1] 8.744515e-09
#> 
#> $name
#> [1] "Anderson-Rubin"
#> 
#> $df
#> [1] 2
#> 
#> $df_resid
#> [1] 397
#> 
#> $beta0
#> [1] 0
#>