Skip to contents

Constructs a predictable betting-fraction sequence for the product-form strong-null e-process (eprocess_betting()), by mapping the constant-bound score-difference stream onto \([0,1]\) and applying the aGRAPA plug-in estimator of Waudby-Smith & Ramdas (2024), Online Supplementary Material, Section B.3, evaluated at the fixed null \(m = 1/2\).

Usage

lambda_betting_agrapa(
  xs,
  c,
  kappa = 0.5,
  prior_mean = 0.5,
  prior_variance = 0.25,
  fake_obs = 1
)

Arguments

xs

Numeric vector. Score-difference stream \(\hat\delta_t = S(p_t,y_t) - S(q_t,y_t)\).

c

Numeric > 0. Either a scalar (constant bound) or a length-length(xs) predictable vector c_t (must satisfy |xs_t| <= c_t/2 pointwise, with c_t known before xs_t is observed). Scalars are recycled to a vector of the same length as xs.

kappa

Numeric in (0, 1]. WSR's internal truncation safeguard on the Y-scale ([-2*kappa, 2*kappa]). Default 0.5. Note on saturation: Because seqcomp applies a strict [0, 1] explicit projection after WSR's native truncation to ensure one-sided null validity, any kappa >= 0.5 is mathematically equivalent. The lower bound -2*kappa is always superseded by the 0 floor, and for kappa >= 0.5, the upper bound 2*kappa >= 1 is superseded by the 1 cap. kappa only actively restricts the bet size when kappa < 0.5 (e.g., kappa = 0.1).

prior_mean

Numeric. Regularization prior for the running mean estimator on the Y-scale. Default 0.5 (WSR's own default; also happens to equal the fixed null m = 1/2 here, which is why the very first returned value is exactly 0).

prior_variance

Numeric in (0, 0.25]. Regularization prior for the running variance estimator. Default 0.25 (WSR's own default).

fake_obs

Numeric > 0. Number of "fake observations" for regularization. Default 1 (WSR's own default).

Value

Numeric vector of length length(xs): predictable \(\lambda_t\) values in [0, 1/c], for use as eprocess_betting()'s lambda_t argument together with c_t = c.

Details

Derivation (constant c only): map \(Y_t = \hat\delta_t / c + 1/2 \in [0,1]\), so the null \(\mu_t \le 0\) becomes \(\mathbb{E}[Y_t \mid \mathcal{F}_{t-1}] \le 1/2\). WSR's aGRAPA plug-in is run exactly as published, fixed at m = 1/2, on the Y-scale running mean/variance. Two clips are then applied in sequence: WSR's own native truncation [-2*kappa, 2*kappa], followed by an explicit floor/cap onto [0, 1]. The floor is important for the one-sided composite null mu <= 0 to remain valid, the played lambda_t must be nonnegative on every round. WSR's raw aGRAPA value routinely goes negative whenever the running mean currently sits below the null, which happens routinely under the null itself. The cap enforces Arnold's own Prop 3.2 bound lambda_d <= 1/c, which is strictly tighter than WSR's native bankruptcy-avoidance bound.

The floor/cap projection and the m_0 = 1/2 null hold identically for a predictable, time-varying c_t. Because c_t is \(F_{t-1}\)-measurable, \(Y_t = x_t / c_t + 1/2\) still satisfies \(\mathbb{E}[Y_t \mid \mathcal{F}_{t-1}] \le 1/2\) under the strong null, and the same aGRAPA plug-in can be run unmodified at the fixed null m = 1/2; only the final \(Y \mapsto d\) conversion (lam_Y / c) becomes pointwise. This time-varying extension is original to this package.

References

Waudby-Smith, I. and Ramdas, A. (2024). Estimating means of bounded random variables by betting. Journal of the Royal Statistical Society Series B: Statistical Methodology, 86(1), 1–27.

Examples

xs <- c(0.6, -0.2, 0.4)
lambda_betting_agrapa(xs, c = 2)
#> [1] 0.0000000 0.4724409 0.3188663