Skip to contents

Executes a single Monte Carlo simulation run comparing OLS, 2SLS (Lewbel), and set identification approaches for estimating the endogenous parameter.

Usage

run_single_lewbel_simulation(
  sim_id,
  params,
  endog_var = "Y2",
  exog_vars = "Xk",
  compute_bounds_se = FALSE,
  return_models = FALSE,
  df_adjust = "asymptotic"
)

Arguments

sim_id

Integer. Simulation run identifier.

params

List. Parameters for data generation and estimation.

endog_var

Character. Name of endogenous variable (default: "Y2").

exog_vars

Character vector. Names of exogenous variables (default: "Xk").

compute_bounds_se

Logical. Whether to compute bootstrap SE for bounds (default: FALSE).

return_models

Logical. Whether to return the fitted model objects (default: FALSE).

df_adjust

Character. Method for degrees of freedom adjustment:

  • "asymptotic": No adjustment (default)

  • "finite": Finite sample adjustment using HC2 formula

Value

If return_models = FALSE: A data.frame with one row containing simulation results including OLS and 2SLS estimates, coverage indicators, first-stage F-statistic, and identification bounds. If return_models = TRUE: A list containing:

  • results: The data.frame described above

  • models: A list with ols_model, first_stage_model, tsls_model

  • data: The generated data

References

Lewbel, A. (2012). Using heteroscedasticity to identify and estimate mismeasured and endogenous regressor models. Journal of Business & Economic Statistics, 30(1), 67-80. doi:10.1080/07350015.2012.643126

See also

calculate_lewbel_bounds for set identification

Examples

if (FALSE) { # \dontrun{
config <- create_default_config()
params <- list(
  sample_size = config$main_sample_size,
  beta1_0 = config$beta1_0, beta1_1 = config$beta1_1, gamma1 = config$gamma1,
  beta2_0 = config$beta2_0, beta2_1 = config$beta2_1,
  alpha1 = config$alpha1, alpha2 = config$alpha2,
  delta_het = config$delta_het, tau_set_id = config$tau_set_id,
  bootstrap_reps = config$bootstrap_reps
)
result <- run_single_lewbel_simulation(1, params)

# With models
result_with_models <- run_single_lewbel_simulation(
  1, params,
  return_models = TRUE
)
} # }