Skip to contents

Pre-computes the dynamic, pair-specific betting fractions required to evaluate the Sequential Model Confidence Set under the strong null hypothesis, using the Online Newton Step (ONS-m) algorithm.

Usage

build_ons_betting_array(scores, c_mat, period = 1, ...)

Arguments

scores

A \(T \times m\) matrix of positively-oriented scores.

c_mat

A numeric scalar, an \(m \times m\) matrix, or a \(T \times m \times m\) array of predictable bounds (matching the c_param argument of smcs_strong()).

period

Integer. If greater than 1, uses the periodic betting variant of ONS-m, which updates the betting fraction only every period time steps.

...

Additional arguments passed to lambda_betting_ons() (e.g., eta).

Value

A \(T \times m \times m\) numeric array of predictable betting fractions, suitable for passing to the lambda_param argument of smcs_strong().

Examples

set.seed(43)
y <- rbinom(50, 1, 0.5)
forecasts <- matrix(runif(150), nrow = 50, ncol = 3)
scores <- matrix(0, nrow = 50, ncol = 3)
for (i in 1:3) scores[, i] <- brier_score(forecasts[, i], y)

# For Brier scores, differences are bounded in [-1, 1], so c = 2
lam_array <- build_ons_betting_array(scores, c_mat = 2)
dim(lam_array) # 50 x 3 x 3
#> [1] 50  3  3