Simulates assurance sequentially in batches, stopping early per cell based on Wilson confidence intervals.
brms_inla_power_sequential(
formula,
family = gaussian(),
family_control = NULL,
Ntrials = NULL,
E = NULL,
scale = NULL,
priors = NULL,
data_generator = NULL,
effect_name,
effect_grid,
sample_sizes,
metric = c("direction", "threshold", "rope", "bf"),
target = 0.8,
prob_threshold = 0.95,
effect_threshold = 0,
rope_bounds = NULL,
credible_level = 0.95,
compute_bayes_factor = FALSE,
error_sd = 1,
group_sd = 0.5,
obs_per_group = 10,
predictor_means = NULL,
predictor_sds = NULL,
seed = 1,
batch_size = 20,
min_sims = 40,
max_sims = 600,
ci_conf = 0.95,
margin = 0.02,
inla_num_threads = NULL,
family_args = list(),
progress = TRUE
)List containing summary per cell and simulation settings.
brms-style model formula.
GLM family (e.g., gaussian(), binomial()).
Optional list for INLA's control.family.
Optional vector of binomial trial counts (for binomial families).
Optional vector of exposures (for Poisson families).
Optional numeric vector for scale parameter in INLA.
brms prior specification object.
Optional function(n, effect) to simulate data.
Character vector of fixed effects to assess.
Data frame or vector of effect values.
Vector of sample sizes.
Character; one of "direction", "threshold", "rope", or "bf" for Bayesian decision metric.
Target assurance value for stopping.
Posterior probability threshold for decision metrics.
Effect-size threshold.
Numeric length-2 vector defining ROPE.
Credible interval level for Bayesian inference.
Logical; TRUE if metric is "bf".
Residual standard deviation.
Standard deviation of random effects.
Number of observations per group.
Optional named list of predictor means.
Optional named list of predictor standard deviations.
Random seed.
Number of simulations per sequential look.
Minimum simulations before early stopping.
Maximum simulations per cell.
Confidence level for Wilson confidence intervals.
Margin around target for early stopping decision.
Character string specifying INLA threading (e.g., "4:1"). If NULL (default), automatically detects optimal setting based on CPU cores.
List of family-specific args passed to data generator.
Logical; if TRUE, show progress messages.
Sequential Bayesian Assurance Simulation Engine (Modern, Multi-Effect Ready)
Simulates assurance sequentially in batches, stopping early per cell based on Wilson confidence intervals.
if (FALSE) {
# Sequential design with automatic threading
results <- brms_inla_power_sequential(
formula = outcome ~ treatment,
effect_name = "treatment",
effect_grid = c(0.2, 0.5, 0.8),
sample_sizes = c(50, 100, 200),
metric = "direction",
target = 0.80
)
print(results$summary)
}
Run the code above in your browser using DataLab