Provides Bayesian power analysis and assurance calculation using INLA (Integrated Nested Laplace Approximation) for efficient computation. Implements simulation-based power analysis for generalized linear mixed models with automatic threading optimization.
brms_inla_power(
formula,
family = gaussian(),
family_control = NULL,
Ntrials = NULL,
E = NULL,
scale = NULL,
priors = NULL,
data_generator = NULL,
effect_name,
effect_grid = 0.5,
sample_sizes = c(50, 100, 200, 400),
nsims = 200,
power_threshold = 0.8,
precision_target = NULL,
prob_threshold = 0.95,
effect_threshold = 0,
credible_level = 0.95,
rope_bounds = NULL,
error_sd = 1,
group_sd = 0.5,
obs_per_group = 10,
predictor_means = NULL,
predictor_sds = NULL,
seed = 123,
inla_hyper = NULL,
compute_bayes_factor = FALSE,
bf_method = c("sd", "marglik"),
bf_cutoff = 10,
inla_num_threads = NULL,
progress = c("auto", "text", "none"),
family_args = list()
)List with results, summary, and settings.
Model formula.
brms GLM family (e.g., gaussian(), binomial()).
Optional list for INLA's control.family.
Optional vector for binomial trials.
Optional vector for Poisson exposure.
Optional vector scale parameter for INLA families.
Optional brms::prior specification.
Optional function(n, effect) returning a dataset.
Character vector of fixed effect names.
Vector/data.frame of effect values (supports multi-effect). For single effects, use a numeric vector. For multiple effects, use a data.frame with column names matching effect_name.
Vector of sample sizes.
Number of simulations per cell.
Decision probability threshold for summary.
Optional credible interval width target.
Posterior probability threshold for decision rules.
Effect-size threshold.
Credible interval level (default 0.95).
Optional Region of Practical Equivalence bounds (length 2 vector).
Gaussian residual standard deviation.
Random effects standard deviation.
Observations per group.
Optional named list of predictor means.
Optional named list of predictor standard deviations.
Random seed.
Optional INLA-specific hyperparameters.
Logical, compute Bayes Factor if TRUE.
Character. "sd" = Savage-Dickey at 0 (requires proper Normal prior on the tested coefficient); "marglik" = marginal-likelihood Bayes factor via INLA by comparing full vs reduced model (slower).
Numeric Bayes-factor threshold for declaring a "hit" (default 10).
Character string specifying INLA threading (e.g., "4:1" for 4 threads). If NULL (default), automatically detects optimal setting: "4:1" for 4+ cores, "2:1" for 2-3 cores, "1:1" otherwise.
One of "auto", "text", or "none" for progress display.
List of arguments for family-specific data generators.