Skip to contents

Expands a grid over DGP designs, sample sizes, covariate dimensions, and instrument counts, then runs sim_iv_one_rep() for each replicate. Each cell uses the same replicate seed vector so methods are compared on aligned draws.

Usage

sim_iv_run(
  designs = c("dgp1_iv_justid_linear", "dgp2_iv_homog_overid", "dgp3_iv_heterog_overid",
    "dgp4_iv_weak_local", "dgp5_iv_correlated_instruments",
    "dgp6_iv_nonlinear_firststage"),
  n_vals = c(500L, 1000L, 2000L),
  kx_vals = 2L,
  q_vals = c(1L, 2L, 3L),
  n_reps = 500L,
  master_seed = 42L,
  k = 1L,
  s_fn = function(n, kx) floor(0.4 * n^((kx + 1L)/(kx + 2L))),
  tuning = NULL,
  methods = "dnn_iv_oracle",
  alpha = 0.05,
  sigma = 0.5,
  clip = 0.001,
  n_folds = 5L,
  verbose = TRUE
)

Arguments

designs

Character vector of IV DGP names.

n_vals

Integer vector of sample sizes.

kx_vals

Integer vector of covariate dimensions.

q_vals

Integer vector of requested instrument counts. The just-identified design is run once with realized q = 1.

n_reps

Number of Monte Carlo replications per cell.

master_seed

Seed used to generate replicate seeds.

k

Integer DNN neighbor count.

s_fn

Function f(n, kx) returning kernel order. The finite-sample default is \(\lfloor 0.4 n^{(k_x+1)/(k_x+2)} \rfloor\).

tuning

Optional tuning specification. When supplied, omit s_fn.

methods

Character vector of methods; see sim_iv_methods().

alpha

Nominal test size.

sigma

Noise SD forwarded to sim_iv_data().

clip

Clipping bound forwarded to DGPs and nuisance fits.

n_folds

Number of cross-fitting folds.

verbose

Print one progress line per cell.

Value

Raw replicate-level data.frame.

Examples

if (FALSE) { # \dontrun{
raw <- sim_iv_run(
  designs = "dgp2_iv_homog_overid",
  n_vals = 200,
  q_vals = 2,
  n_reps = 10,
  methods = c("dnn_iv_oracle", "iv_oracle")
)
summarise_iv_results(raw)
} # }