Learn R Programming

powerbrmsINLA (version 1.3.0)

assurance_prior_weights: Create prior weights over an effect grid for use with compute_assurance()

Description

A convenience wrapper that evaluates a parametric prior distribution at each value in effects, normalises the densities to sum to 1, and returns a named numeric vector that can be passed directly to compute_assurance() as prior_weights.

Usage

assurance_prior_weights(effects, dist = c("normal", "uniform", "beta"), ...)

Value

Named numeric vector of normalised weights (sums to 1), with names equal to as.character(effects).

Arguments

effects

Numeric vector of effect-grid values (the same vector passed to brms_inla_power() as effect_grid).

dist

Character string naming the distribution. One of "normal", "uniform", or "beta".

...

Named distribution parameters forwarded to the internal density calculator. See compute_assurance() @details for the full list per distribution.

Details

The output format is identical to that of beta_weights_on_grid(), which can also be used directly when a beta prior is appropriate.

Examples

Run this code
effects <- c(0.1, 0.3, 0.5, 0.7, 0.9)
# Normal prior centred on 0.5
assurance_prior_weights(effects, dist = "normal", mean = 0.5, sd = 0.2)
# Uniform prior (equal weight)
assurance_prior_weights(effects, dist = "uniform")

Run the code above in your browser using DataLab