Skip to contents

Monte Carlo Fisher-randomization p-value with Clopper-Pearson early stopping.

Usage

oda_mc_p_value(
  x,
  y,
  w = NULL,
  attr_type,
  priors_on,
  primary,
  secondary,
  miss_codes = NULL,
  chance_model = c("class", "attribute"),
  mc_iter = 25000L,
  mc_target = 0.05,
  mc_stop = 99.9,
  mc_stopup = NA,
  mc_adjust = FALSE,
  seed = NULL,
  ess_obs = NULL,
  direction = c("both", "off", "greater", "less"),
  direction_map = NULL
)

Arguments

x, y, w

Data for the current attribute (already cleaned).

attr_type

"ordered", "categorical", or "binary".

priors_on

Logical.

primary, secondary

Tie-break heuristic strings.

miss_codes

Optional numeric vector of additional missing codes.

chance_model

"class" (1/2) or "attribute" (1/k_attr).

mc_iter

Maximum iterations.

mc_target

Significance threshold (e.g. 0.05).

mc_stop

Confidence level for lower-tail stop (e.g. 99.9).

mc_stopup

Confidence level for upper-tail stop (e.g. 20 -> 0.20). Default NA (disabled).

mc_adjust

Kept for API compatibility; not used.

seed

Optional RNG seed.

ess_obs

Observed ESS (must be supplied).

direction

Directional constraint forwarded from oda_univariate_core(): "both" (canonical non-directional default), "off" (synonym for "both"), "greater", or "less". Each permutation refit uses the same constraint.

direction_map

Named integer vector for categorical fixed-partition DIRECTIONAL. When supplied, each permutation evaluates the SAME fixed mapping on permuted y labels. Default NULL.

Value

List with p_mc, ge_count, iter_used, ess_obs.