Inverts the RI test over a grid of sharp null hypotheses to find the set of
hypotheses that cannot be rejected at level alpha. The bounds of that
set form the confidence interval.
Arguments
- ...
Arguments passed to
conduct_ri.- alpha
Significance level. Defaults to 0.05.
- n_grid
Number of candidate sharp hypotheses to evaluate. Defaults to 40. Increase for a finer grid and more precise bounds.
Details
The permutation matrix is generated once and reused across all grid points,
so the cost is roughly n_grid times the cost of a single
conduct_ri call (without the permutation matrix generation step).
Currently only supported for two-arm trials (single-term formulas). For
multi-arm designs, call ri_ci separately for each pairwise comparison
by setting condition1 and condition2 in the formula.
Examples
declaration <- randomizr::declare_ra(N = 40, m = 20)
Z <- randomizr::conduct_ra(declaration)
Y <- 0.5 * Z + rnorm(40)
dat <- data.frame(Y, Z)
# sims and n_grid are kept small here so the example runs quickly;
# use larger values in practice for a finer, less noisy interval.
ri_ci(Y ~ Z, declaration = declaration, assignment = "Z", data = dat,
sims = 100, n_grid = 20)
#> term ci_lower ci_upper alpha
#> 1 Z 0.1443276 1.118599 0.05