Skip to contents

Estimate a finite-sample variance confidence rectangle from pilot data and return the two-arm Conditional Minimax Regret (CMR) assignment.

Usage

cmr_two_arm(
  y,
  d,
  alpha = 0.05,
  method = c("auto", "bounded", "bernoulli", "maurer_pontil", "mp", "bernoulli_exact",
    "martinez_taboada_ramdas", "mtr", "unbounded", "unbounded_mom", "median_of_means",
    "mom"),
  beta = NULL,
  correction = c("bonferroni", "sidak_arms"),
  normalize = FALSE,
  lower = NULL,
  upper = NULL,
  psi = NULL,
  na.rm = TRUE,
  tol = 1e-11
)

cmr_binary(
  y,
  d,
  alpha = 0.05,
  method = c("auto", "bounded", "bernoulli", "maurer_pontil", "mp", "bernoulli_exact",
    "martinez_taboada_ramdas", "mtr", "unbounded", "unbounded_mom", "median_of_means",
    "mom"),
  beta = NULL,
  correction = c("bonferroni", "sidak_arms"),
  normalize = FALSE,
  lower = NULL,
  upper = NULL,
  psi = NULL,
  na.rm = TRUE,
  tol = 1e-11
)

Arguments

y

Pilot outcomes. For bounded and Bernoulli methods, outcomes must be in [0, 1] unless normalize = TRUE. For unbounded methods, outcomes are raw numeric values and psi is required.

d

Pilot treatment indicator; treatment is 1 and control is 0.

alpha

Target joint error level for the variance confidence set.

method

Confidence-set method. "auto" uses exact Bernoulli bounds for 0/1 outcomes and bounded Maurer–Pontil bounds otherwise. "bounded", "maurer_pontil", and "mp" are synonyms. "bernoulli" and "bernoulli_exact" use folded-binomial exact bounds. "mtr" and "martinez_taboada_ramdas" use the empirical-Bernstein MTR bounds. "unbounded", "unbounded_mom", "median_of_means", and "mom" dispatch to the unbounded-outcome median-of-means extension.

beta

Optional endpoint error allocation. If NULL, error is split across lower and upper endpoints using correction.

correction

Endpoint error correction, either "bonferroni" or "sidak_arms" for two-arm bounded/Bernoulli/proxy workflows.

normalize

If TRUE, normalize bounded outcomes to [0, 1] before computing the rectangle. For guarantee-bearing bounded CMR on a non-unit scale, provide known lower and upper bounds.

lower, upper

Optional lower and upper outcome bounds used when normalize = TRUE. If either is omitted, the pilot minimum and/or maximum is used with a warning; that data-dependent normalization is exploratory and does not carry the finite-sample bounded-outcome CMR guarantee.

psi

Bounded-kurtosis parameter for unbounded-outcome methods. Provide a scalar or a treatment/control pair.

na.rm

If TRUE, drop rows with missing y or d.

tol

Numerical tolerance for exact Bernoulli bound inversion.

Value

A list of class cmr_two_arm with treatment share pi, regret certificate U_CMR, confidence rectangle, pilot summaries, endpoint error allocation, and diagnostics. For Maurer–Pontil bounded-outcome fits, pilot$vhat contains raw Bessel sample variances and can exceed 0.25 in finite samples; use confidence_set$treatment$statistic$projected_vhat and confidence_set$control$statistic$projected_vhat for diagnostics that require unit-interval variances. The object has compact print() and summary() methods.

Examples

set.seed(1)
d <- rep(c(1, 0), each = 40)
y <- c(rbeta(40, 2, 6), rbeta(40, 4, 4))

fit <- cmr_two_arm(y, d, alpha = 0.05, method = "bounded")
fit
#> <cmr_two_arm>
#>   pi: 0.5
#>   U_CMR: 0.25
#>   method: bounded
#>   n: 80
summary(fit)
#> <summary.cmr_two_arm>
#>   pi: 0.5
#>   U_CMR: 0.25
#>   method: bounded
#>   n: 80