README.md

powerbrmsINLA

CRAN status

Overview

powerbrmsINLA provides tools for Bayesian power analysis and assurance calculations using the statistical frameworks of brms and INLA.

It includes simulation-based approaches, support for multiple decision rules (direction, threshold, ROPE, Bayes factors, precision), sequential and two-stage adaptive designs, and a comprehensive suite of visualisation functions.

What's New in 1.3.0

What's New in 1.2.0

See NEWS.md for the full changelog.

Installation

Install from CRAN:

install.packages("powerbrmsINLA")

INLA is listed under Suggests and must be installed separately:

if (!requireNamespace("INLA", quietly = TRUE)) {
  install.packages(
    "INLA",
    repos = c(getOption("repos"),
              INLA = "https://inla.r-inla-download.org/R/stable"),
    dep = TRUE
  )
}

To install the development version from GitHub:

# install.packages("remotes")
remotes::install_github("Tony-Myers/powerbrmsINLA")

Quick Example

library(powerbrmsINLA)

# Step 1: Conditional power simulation
results <- brms_inla_power(
  formula      = y ~ treatment,
  effect_name  = "treatment",
  effect_grid  = c(0.2, 0.5, 0.8),
  sample_sizes = c(50, 100),
  nsims        = 50,
  seed         = 123
)
results$summary

# Step 2: Unconditional assurance (new in 1.2.0)
assurance <- compute_assurance(
  results,
  prior_weights = list(dist = "normal", mean = 0.5, sd = 0.2),
  metric = "direction"
)
print(assurance)

# Step 3: Sample size recommendation
decide_sample_size(
  results,
  direction = 0.80,
  prior_weights = list(dist = "normal", mean = 0.5, sd = 0.2)
)

Model Complexity Considerations

For optimal performance:

Citation

If you use powerbrmsINLA in published work, please cite:

Myers, T. (2026). powerbrmsINLA: Bayesian Power Analysis Using 'brms' and 'INLA'. R package version 1.2.0. https://cran.r-project.org/package=powerbrmsINLA

License

This package is released under the MIT License. See the LICENSE file for details.



Try the powerbrmsINLA package in your browser

Any scripts or data that you put into this service are public.

powerbrmsINLA documentation built on July 2, 2026, 5:07 p.m.