Finds the actual size of the MFET for a given \(\gamma_0\) by numerically
maximising the local size over the nuisance parameter \(p_0 \in (0, 1)\).
Supports two methods: "zoom" evaluates the local size at a grid of
points and iteratively refines the maximum (matches the SAS macro default);
"trust" uses a trust-region optimiser with the analytic gradient from
.local_size_gradient_modified().
Usage
size_modified(
.c,
.odds_ratio,
.m,
.n,
.df,
.alpha,
.precision,
.method,
.maze,
.zoom_iter,
.rejection_base = NULL
)Arguments
- .c
The \(\gamma_0\) value for which the actual size is to be computed. Supplied as a length-1 list element; typically one element of the sorted randomisation probability vector from the test frame.
- .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.
- .df
Test frame (data frame) generated by
construct_test_frame(), containing critical values \(c_1\), \(c_2\) and randomisation probabilities \(\gamma_1\), \(\gamma_2\) for every possible total \(T\).- .alpha
Nominal significance level \(\alpha\). No default.
- .precision
Numerical precision. No default.
- .method
Numerical method:
"zoom"or"trust".- .maze
Number of grid points evaluated at each zoom iteration.
- .zoom_iter
Number of zoom iterations (
"zoom"method only).- .rejection_base
Optional precomputed base object from
.build_rejection_base(), containing the part of the rejection matrix that depends only on.df,.m,.n(not on the \(\gamma_0\) value in.c). Defaults toNULL, in which case it is built internally. Supply a prebuilt base when calling repeatedly with the same test frame across different \(\gamma_0\) candidates (asoptimise_gamma0()does during its bisection search) to avoid rebuilding it on every call. If supplied, it must correspond to the same.df,.m,.npassed alongside it; this is not checked.
Value
A single numeric value: the actual size of the test, i.e. the local size maximised over the nuisance parameter, in \([0, 1]\).
See also
optimise_gamma0() which maximises this quantity to find the optimal gamma0; local_size_modified() for the local size at a fixed nuisance parameter value, of which this is the maximum; local_size_asymptotic(), local_size_probability(), local_size_randomised() for the equivalent quantity under alternative tests.
Other modified:
construct_test_frame(),
local_size_modified(),
modified_fisher_exact_test(),
optimise_gamma0(),
power_modified()
Other size:
local_size_asymptotic(),
local_size_modified(),
local_size_probability(),
local_size_randomised()
Examples
df <- construct_test_frame(.odds_ratio = 1, .m = 6, .n = 4,
.alpha = 0.05, .precision = 1e-3)
# Actual size of the test at a candidate gamma0 threshold of 0.05:
size_modified(.c = 0.05, .odds_ratio = 1, .m = 6, .n = 4, .df = df,
.alpha = 0.05, .precision = 1e-3, .method = "zoom",
.maze = 10, .zoom_iter = 6)
#> [1] 0.2170814
