Skip to contents

Two-step efficient GMM (rmorie native; HC0-weighted second step).

Usage

morie_iv_gmm(
  data,
  outcome,
  endogenous,
  instruments,
  exogenous = NULL,
  weight_matrix = "optimal",
  robust = TRUE,
  alpha = 0.05
)

Arguments

data

Data frame.

outcome

Name of the outcome column.

endogenous

Character vector of endogenous regressor names.

instruments

Character vector of excluded-instrument names.

exogenous

Optional character vector of exogenous covariate names.

weight_matrix

One of "optimal" (default, two-step) or "identity" (one-step / 2SLS-equivalent).

robust

Logical; if TRUE use HC1 robust standard errors.

alpha

Significance level for confidence intervals.

Value

A named list with elements coefficients, std_errors, t_stats, p_values, ci_lower, ci_upper, variable_names, n_obs, method, details.

Examples

set.seed(1)
n <- 400
z <- rbinom(n, 1, 0.5); u <- rnorm(n)
d <- rbinom(n, 1, plogis(0.8 * z + 0.3 * u))
y <- 0.5 * d + 0.4 * u + rnorm(n, sd = 0.5)
df <- data.frame(y, d, z)
res <- morie_iv_gmm(df, "y", "d", "z")
res$coefficients
#> (Intercept)           d 
#> -0.05005272  0.55823628