powerbrmsINLA provides tools for Bayesian power analysis and
assurance calculations using the statistical frameworks of
brms and
INLA.
It includes simulation-based and analytical approaches, support for
multiple decision rules (direction, threshold, rope), sequential
and two-stage designs, and visualisation helpers for power curves,
precision, Bayes factors, and robustness.
You can install the development version from GitHub:
# install.packages("remotes")
remotes::install_github("https://github.com/Tony-Myers/powerbrmsINLA")Here is a minimal example to get started. For speed in a README, the code is not evaluated on knit.
library(powerbrmsINLA)
# Run Bayesian power analysis
results <- brms_inla_power(
formula = outcome ~ treatment,
effect_name = "treatment",
effect_grid = c(0.2, 0.5, 0.8),
sample_sizes = c(50, 100),
nsims = 5 # Reduced for speed
)
# Inspect summary results
results$summary
# Plot power heatmap
plot_power_heatmap(results)For optimal performance:
- Simple to moderate models: All sample sizes supported
- Complex random effects (e.g.,
(1 + time | subject)): Recommend n ≥ 50 subjects - Large effect grids: Consider starting with fewer simulations (nsims = 50-100) for initial exploration
The package handles the vast majority of Bayesian power analysis scenarios. For computationally demanding models, standard Bayesian modeling best practices apply (adequate sample sizes, model complexity appropriate to data).
If you use pkgdown you can build a
website:
usethis::use_pkgdown() # once, to set up pkgdown
pkgdown::build_site() # build the site locally
# usethis::use_pkgdown_github_pages() # set up GitHub PagesThis package is released under the MIT License.
See the LICENSE file for details.