Skip to contents

Finds the optimal \(\gamma_0\) threshold: the largest value of \(\gamma_0\) such that the actual size of the MFET (the maximum of the local size over the nuisance parameter \(p_0\)) does not exceed \(\alpha\). Uses a bisection search over the \(2(m + n + 1)\) sorted randomisation probability values from the test frame.

Usage

optimise_gamma0(
  .odds_ratio,
  .m,
  .n,
  .alpha,
  .precision,
  .method,
  .maze,
  .zoom_iter,
  .df = NULL
)

Arguments

.odds_ratio

The null hypothesis odds ratio \(\theta_0\). No default.

.m

Number of trials in group 1.

.n

Number of trials in group 2.

.alpha

Nominal significance level \(\alpha\). No default.

.precision

Numerical precision. No default.

.method

Numerical method for maximising the local size: "zoom" or "trust".

.maze

Number of grid points evaluated at each zoom iteration.

.zoom_iter

Number of zoom iterations ("zoom" method only).

.df

Optional precomputed test frame from construct_test_frame() for this exact .odds_ratio/.m/.n/.alpha/ .precision combination. Defaults to NULL, in which case it is built internally. Every call site in modified_fisher_exact_test() already has a matching test frame on hand (it was just built to derive .odds_ratio, or is the frame the observed table is being tested against), so supplying it avoids rebuilding an identical frame from scratch. If supplied, it must correspond to the same arguments; this is not checked.

Value

A single numeric value: the optimal threshold \(\gamma_0\).

See also

modified_fisher_exact_test() for the main user-facing function; construct_test_frame() for the test frame passed to this function; size_modified() for the size function being maximised.

Other modified: construct_test_frame(), local_size_modified(), modified_fisher_exact_test(), power_modified(), size_modified()

Examples

optimise_gamma0(.odds_ratio = 1, .m = 6, .n = 4, .alpha = 0.05,
                .precision = 1e-3, .method = "zoom", .maze = 10,
                .zoom_iter = 6)
#> [1] 0.3488889