Skip to contents

Split-sample IV

Usage

morie_iv_split_sample(
  data,
  outcome,
  endogenous,
  instruments,
  exogenous = NULL,
  split_fraction = 0.5,
  seed = 42,
  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.

split_fraction

Fraction of the data used in the first stage.

seed

RNG seed.

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_split_sample(df, "y", "d", "z", split_fraction = 0.5, seed = 1)
res$coefficients
#> (Intercept)    hatcol_d 
#>  -0.1669981   0.8575604